10.  Obtaining Password and Group File Entries  

      The procedures defined in this section are used to obtain entries from the system's passwd and group databases.

(unix-get-passwd)
(unix-get-passwd user)

If invoked without an argument, this procedure returns the next entry from the passwd database. Successive calls to unix-get-passwd return entries in a random order. The user argument, if present, is either the login name of a user (a string or symbol) or a numeric user-ID (an integer). In this case, the passwd entry for this user is returned.

unix-get-passwd returns a passwd-record with the following fields:

+---------+---------+--------------------------+
| Field   |  Type   |         Contents         |
+---------+---------+--------------------------+
+---------+---------+--------------------------+
|name     | string  | login name               |
+---------+---------+--------------------------+
|password | string  | login password           |
+---------+---------+--------------------------+
|uid      | integer | numeric user-ID          |
+---------+---------+--------------------------+
|gid      | integer | numeric primary group-ID |
+---------+---------+--------------------------+
|gecos    | string  | contents of GECOS field  |
+---------+---------+--------------------------+
|homedir  | string  | home directory of user   |
+---------+---------+--------------------------+
|shell    | string  | login shell of user      |
+---------+---------+--------------------------+

unix-get-passwd is based on the UNIX getpwent(), getpwuid(), and getpwnam() functions.

(unix-get-group)
(unix-get-group group)

unix-get-group is identical to unix-get-passwd (see above), except that the system's group database is used instead of the passwd database.

The result value is a group-record with these fields:

+---------+-----------------+------------------+
| Field   |      Type       |     Contents     |
+---------+-----------------+------------------+
|name     | string          | group's name     |
+---------+-----------------+------------------+
|password | string          | group's password |
+---------+-----------------+------------------+
|gid      | integer         | numeric group-ID |
+---------+-----------------+------------------+
|members  | list of symbols | group members    |
+---------+-----------------+------------------+

unix-get-group is based on the UNIX getgrent(), getgrgid(), and getgrnam() functions.

(unix-rewind-passwd)
(unix-rewind-group)

These procedures rewind the passwd and group files by calling the setpwent() and setgrent() UNIX functions.

(unix-end-passwd)
(unix-end-group)

unix-end-passwd and unix-end-group close the passwd and group files by calling the UNIX functions endpwent() and endgrent().


Markup created by unroff 1.0,    September 24, 1996,    net@informatik.uni-bremen.de