Security Attributes Database Library Functions getuserattr(3SECDB)
NAME
getuserattr, getusernam, getuseruid, free_userattr,
setuserattr, enduserattr, fgetuserattr - get user_attr entry
SYNOPSIS
cc [ flag... ] file... -lsecdb -lsocket -lnsl [ library... ]
#include
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);
DESCRIPTION
The getuserattr(), getusernam(), and getuseruid() functionseach return a user_attr(4) entry. Entries can come from any
of the sources specified in the nsswitch.conf(4) file. Thegetuserattr() function enumerates user_attr entries. The
getusernam() function searches for a user_attr entry with a
given user name name. The getuseruid() function searches fora user_attr entry with a given user ID uid. Successive calls
to these functions return either successive user_attr
entries or NULL. The fgetuserattr() function does not use nsswitch.conf but reads and parses the next line from the stream f. Thisstream is assumed to have the format of the user_attr files.
The free_userattr() function releases memory allocated by
the getusernam(), getuserattr(), and fgetuserattr() func-
tions.SunOS 5.11 Last change: 31 Mar 2005 1
Security Attributes Database Library Functions getuserattr(3SECDB)The internal representation of a user_attr entry is a
userattr_t structure defined in
lowing 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 */with the fol- 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, sosetuserattr() should be called before the first call to
getuserattr(). The enduserattr() function may be called to indicate thatuser_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 successfully 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 bedeallocated with the free_userattr() function.
Individual attributes can be referenced in the attr struc-
ture by calling the kva_match(3SECDB) function.
WARININGS Because the list of legal keys is likely to expand, codemust be written to ignore unknown key-value pairs without
error. FILES/etc/user_attr extended user attributes
SunOS 5.11 Last change: 31 Mar 2005 2
Security Attributes Database Library Functions getuserattr(3SECDB) /etc/nsswitch.conf configuration file lookup information for the name server switchATTRIBUTES
See attributes(5) for descriptions of the following attri-
butes:____________________________________________________________
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
|_____________________________|_____________________________|
| MT-Level | MT-Safe |
|_____________________________|_____________________________|
SEE ALSO
getauthattr(3SECDB), getexecattr(3SECDB),getprofattr(3SECDB), user_attr(4), attributes(5)
SunOS 5.11 Last change: 31 Mar 2005 3
Security Attributes Database Library Functions getuserattr(3SECDB)SunOS 5.11 Last change: 31 Mar 2005 4