GETUSERATTR(3SECDB) | Security Attributes Database Library Functions | GETUSERATTR(3SECDB) |
cc [ flag... ] file... -lsecdb -lsocket -lnsl [ library... ] #include <user_attr.h> userattr_t *getuserattr(void);
userattr_t *getusernam(const char *name);
userattr_t *getuseruid(uid_t uid);
void free_userattr(userattr_t *userattr);
void setuserattr(void);
void enduserattr(void);
userattr_t *fgetuserattr(FILE *f);
The fgetuserattr() function does not use nsswitch.conf but reads and parses the next line from the stream f. This stream is assumed to have the format of the user_attr files.
The free_userattr() function releases memory allocated by the getusernam(), getuserattr(), and fgetuserattr() 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.
The getusernam() function returns a pointer to a userattr_t if it successfully locates the requested entry; otherwise it returns NULL.
Individual attributes can be referenced in the attr structure by calling the kva_match(3SECDB) function.
/etc/nsswitch.conf
ATTRIBUTE TYPE | ATTRIBUTE VALUE |
MT-Level | MT-Safe |
August 13, 2018 | OmniOS |