GETUSERATTR(3SECDB) Security Attributes Database Library Functions NNAAMMEE getuserattr, getusernam, getuseruid, free_userattr, setuserattr, enduserattr, fgetuserattr - get user_attr entry SSYYNNOOPPSSIISS cc [ _f_l_a_g... ] _f_i_l_e... -lsecdb -lsocket -lnsl [ _l_i_b_r_a_r_y... ] #include uusseerraattttrr__tt **ggeettuusseerraattttrr(vvooiidd); uusseerraattttrr__tt **ggeettuusseerrnnaamm(ccoonnsstt cchhaarr **_n_a_m_e); uusseerraattttrr__tt **ggeettuusseerruuiidd(uuiidd__tt _u_i_d); vvooiidd ffrreeee__uusseerraattttrr(uusseerraattttrr__tt **_u_s_e_r_a_t_t_r); vvooiidd sseettuusseerraattttrr(vvooiidd); vvooiidd eenndduusseerraattttrr(vvooiidd); uusseerraattttrr__tt **ffggeettuusseerraattttrr(FFIILLEE **_f); DDEESSCCRRIIPPTTIIOONN The ggeettuusseerraattttrr(()), ggeettuusseerrnnaamm(()), and ggeettuusseerruuiidd(()) functions each return a uusseerr__aattttrr(4) entry. Entries can come from any of the sources specified in the nnsssswwiittcchh..ccoonnff(4) file. The ggeettuusseerraattttrr(()) function enumerates uusseerr__aattttrr entries. The ggeettuusseerrnnaamm(()) function searches for a uusseerr__aattttrr entry with a given user name _n_a_m_e. The ggeettuusseerruuiidd(()) function searches for a uusseerr__aattttrr entry with a given user ID _u_i_d. Successive calls to these functions return either successive uusseerr__aattttrr entries or _N_U_L_L. The ffggeettuusseerraattttrr(()) function does not use nnsssswwiittcchh..ccoonnff but reads and parses the next line from the stream _f. This stream is assumed to have the format of the uusseerr__aattttrr files. The ffrreeee__uusseerraattttrr(()) function releases memory allocated by the ggeettuusseerrnnaamm(()), ggeettuusseerraattttrr(()), and ffggeettuusseerraattttrr(()) functions. The internal representation of a uusseerr__aattttrr entry is a uusseerraattttrr__tt structure defined in 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 sseettuusseerraattttrr(()) function "rewinds" to the beginning of the enumeration of uusseerr__aattttrr entries. Calls to ggeettuusseerrnnaamm(()) may leave the enumeration in an indeterminate state, so sseettuusseerraattttrr(()) should be called before the first call to ggeettuusseerraattttrr(()). The eenndduusseerraattttrr(()) function may be called to indicate that uusseerr__aattttrr processing is complete; the library may then close any open uusseerr__aattttrr file, deallocate any internal storage, and so forth. RREETTUURRNN VVAALLUUEESS The ggeettuusseerraattttrr(()) function returns a pointer to a uusseerraattttrr__tt if it successfully enumerates an entry; otherwise it returns _N_U_L_L, indicating the end of the enumeration. The ggeettuusseerrnnaamm(()) function returns a pointer to a uusseerraattttrr__tt if it successfully locates the requested entry; otherwise it returns _N_U_L_L. UUSSAAGGEE The ggeettuusseerraattttrr(()) and ggeettuusseerrnnaamm(()) functions both allocate memory for the pointers they return. This memory should be deallocated with the ffrreeee__uusseerraattttrr(()) function. Individual attributes can be referenced in the aattttrr structure by calling the kkvvaa__mmaattcchh(3SECDB) function. WWAARRNNIINNGGSS Because the list of legal keys is likely to expand, code must be written to ignore unknown key-value pairs without error. FFIILLEESS //eettcc//uusseerr__aattttrr extended user attributes //eettcc//nnsssswwiittcchh..ccoonnff configuration file lookup information for the name service switch AATTTTRRIIBBUUTTEESS See aattttrriibbuutteess(5) for descriptions of the following attributes: +---------------+-----------------+ |ATTRIBUTE TYPE | ATTRIBUTE VALUE | +---------------+-----------------+ |MT-Level | MT-Safe | +---------------+-----------------+ SSEEEE AALLSSOO ggeettaauutthhaattttrr(3SECDB), ggeetteexxeeccaattttrr(3SECDB), ggeettpprrooffaattttrr(3SECDB), kkvvaa__mmaattcchh(3SECDB), uusseerr__aattttrr(4), aattttrriibbuutteess(5) August 13, 2018 GETUSERATTR(3SECDB)