The getuserattr(), getusernam(), and getuseruid() functions each return a user_attr(4) entry. Entries can come from any of the sources specified in the nsswitch.conf(4) file. The getuserattr() function enumerates user_attr entries. The getusernam() function searches for a user_attr entry with a given user name name. The getuseruid() function searches for a user_attr entry with a given user id uid. Successive calls to these functions return either successive user_attr entries or NULL.
The free_userattr() function releases memory allocated by the getusernam() and getuserattr() functions.
The internal representation of a user_attr entry is a userattr_t structure defined in <user_attr.h> with the following members:
|
char *name; /* name of the user */
char *qualifier; /* reserved for future use */
char *res1; /* reserved for future use */
char *res2; /* reserved for future use */
kva_t *attr; /* list of attributes */
|
The setuserattr() function "rewinds" to the beginning of the enumeration of user_attr entries. Calls to getusernam() may leave
the enumeration in an indeterminate state, so setuserattr() should be called before the first call to getuserattr().
The enduserattr() function may be called to indicate that user_attr processing is complete; the library may then close any open user_attr file,
deallocate any internal storage, and so forth.
|