Security Attributes Database Library Functions
getuserattr(3SECDB)
NAME
getuserattr, getusernam, getuseruid, freeuserattr,
setuserattr, enduserattr, fgetuserattr - get userattr entry
SYNOPSIS
cc [ flag... ] file... -lsecdb -lsocket -lnsl [ library... ]
#include
userattrt *getuserattr(void);
userattrt *getusernam(const char *name);
userattrt *getuseruid(uidt uid);
void freeuserattr(userattrt *userattr);
void setuserattr(void);
void enduserattr(void);
userattrt *fgetuserattr(FILE *f);
DESCRIPTION
The getuserattr(), getusernam(), and getuseruid() functions
each return a userattr(4) entry. Entries can come from any
of the sources specified in the nsswitch.conf(4) file. The
getuserattr() function enumerates userattr entries. The
getusernam() function searches for a userattr entry with a
given user name name. The getuseruid() function searches for
a userattr entry with a given user ID uid. Successive calls
to these functions return either successive userattr
entries or NUL.
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 userattr files.
The freeuserattr() 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 userattr entry is a
userattrt structure defined in with the fol-
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 */
kvat *attr; /* list of attributes */
The setuserattr() function "rewinds" to the beginning of the
enumeration of userattr 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
userattr processing is complete; the library may then close
any open userattr file, deallocate any internal storage,
and so forth.
RETURN VALUES
The getuserattr() function returns a pointer to a userattrt
if it successfully enumerates an entry; otherwise it returns
NUL, indicating the end of the enumeration.
The getusernam() function returns a pointer to a userattrt
if it successfully locates the requested entry; otherwise it
returns NUL.
USAGE
The getuserattr() and getusernam() functions both allocate
memory for the pointers they return. This memory should be
deallocated with the freeuserattr() function.
Individual attributes can be referenced in the attr struc-
ture by calling the kvamatch(3SECDB) function.
WARININGS
Because the list of legal keys is likely to expand, code
must be written to ignore unknown key-value pairs without
error.
FILES
/etc/userattr 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 switch
ATRIBUTES
See attributes(5) for descriptions of the following attri-
butes:
ATRIBUTE TYPE ATRIBUTE VALUE
MT-Level MT-Safe
SEE ALSO
getauthattr(3SECDB), getexecattr(3SECDB),
getprofattr(3SECDB), userattr(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
|