FreeBSD Manual Pages
getuserattr(3SECDB) Introduction to Library Functions getuserattr(3SECDB) NAME getuserattr, getusernam, getuseruid, free_userattr, setuserattr, en- duserattr - get user_attr entry SYNOPSIS cc [ flag... ] file...- lsecdb - lsocket - lnsl - lintl [ 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); DESCRIPTION The getuserattr(), getusernam(), and getuseruid() functions each return a user_attr(4) entry. Entries can come from any of the sources speci- fied in the nsswitch.conf(4) file. The getuserattr() function enumer- ates 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 getuser- nam() and getuserattr() functions. The internal representation of a user_attr entry is a userattr_t struc- ture 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 enumera- tion of user_attr entries. Calls to getusernam() may leave the enumer- ation in an indeterminate state, so setuserattr() should be called be- fore 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. RETURN VALUES The getuserattr() function returns a pointer to a userattr_t if it successfully enumerates an entry; otherwise it returns NULL, indicating the end of the enumeration. The getusernam() function returns a pointer to a userattr_t if it suc- cessfully locates the requested entry; otherwise it returns NULL. USAGE The getuserattr() and getusernam() functions both allocate memory for the pointers they return. This memory should be deallocated with the free_userattr() function. Applications that use the interfaces described in this manual page can- not be linked statically, since the implementations of these functions employ dynamic loading and linking of shared objects at run time. Note that these interfaces are reentrant even though they do not use the _r suffix naming convention. Individual attributes may be referenced in the attr structure by call- ing the kva_match(3SECDB) function. WARININGS Because the list of legal keys is likely to expand, code must be writ- ten to ignore unknown key-value pairs without error. FILES /etc/user_attr extended user attributes /etc/nsswitch.conf configuration file lookup information for the name server switch ATTRIBUTES See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |MT-Level |MT-Safe | +-----------------------------+-----------------------------+ SEE ALSO getauthattr(3SECDB), getexecattr(3SECDB), getprofattr(3SECDB), user_attr(4), attributes(5) SunOS 5.9 12 Aug 1999 getuserattr(3SECDB)
NAME | SYNOPSIS | DESCRIPTION | RETURN VALUES | USAGE | WARININGS | FILES | ATTRIBUTES | SEE ALSO
Want to link to this manual page? Use this URL:
<https://www.freebsd.org/cgi/man.cgi?query=getusernam&sektion=3secdb&manpath=SunOS+5.9>