1getuserattr(3SECDSBe)curity Attributes Database Library Functiognestuserattr(3SECDB)
2
3
4
6 getuserattr, getusernam, getuseruid, free_userattr, setuserattr,
7 enduserattr, fgetuserattr - get user_attr entry
8
10 cc [ flag... ] file... -lsecdb -lsocket -lnsl [ library... ]
11 #include <user_attr.h>
12
13 userattr_t *getuserattr(void);
14
15
16 userattr_t *getusernam(const char *name);
17
18
19 userattr_t *getuseruid(uid_t uid);
20
21
22 void free_userattr(userattr_t *userattr);
23
24
25 void setuserattr(void);
26
27
28 void enduserattr(void);
29
30
31 userattr_t *fgetuserattr(FILE *f);
32
33
35 The getuserattr(), getusernam(), and getuseruid() functions each return
36 a user_attr(4) entry. Entries can come from any of the sources speci‐
37 fied in the nsswitch.conf(4) file. The getuserattr() function enumer‐
38 ates user_attr entries. The getusernam() function searches for a
39 user_attr entry with a given user name name. The getuseruid() function
40 searches for a user_attr entry with a given user ID uid. Successive
41 calls to these functions return either successive user_attr entries or
42 NULL.
43
44
45 The fgetuserattr() function does not use nsswitch.conf but reads and
46 parses the next line from the stream f. This stream is assumed to have
47 the format of the user_attr files.
48
49
50 The free_userattr() function releases memory allocated by the getuser‐
51 nam(), getuserattr(), and fgetuserattr() functions.
52
53
54 The internal representation of a user_attr entry is a userattr_t struc‐
55 ture defined in <user_attr.h> with the following members:
56
57 char *name; /* name of the user */
58 char *qualifier; /* reserved for future use */
59 char *res1; /* reserved for future use */
60 char *res2; /* reserved for future use */
61 kva_t *attr; /* list of attributes */
62
63
64
65 The setuserattr() function "rewinds" to the beginning of the enumera‐
66 tion of user_attr entries. Calls to getusernam() may leave the enumer‐
67 ation in an indeterminate state, so setuserattr() should be called
68 before the first call to getuserattr().
69
70
71 The enduserattr() function may be called to indicate that user_attr
72 processing is complete; the library may then close any open user_attr
73 file, deallocate any internal storage, and so forth.
74
76 The getuserattr() function returns a pointer to a userattr_t if it suc‐
77 cessfully enumerates an entry; otherwise it returns NULL, indicating
78 the end of the enumeration.
79
80
81 The getusernam() function returns a pointer to a userattr_t if it suc‐
82 cessfully locates the requested entry; otherwise it returns NULL.
83
85 The getuserattr() and getusernam() functions both allocate memory for
86 the pointers they return. This memory should be deallocated with the
87 free_userattr() function.
88
89
90 Individual attributes can be referenced in the attr structure by call‐
91 ing the kva_match(3SECDB) function.
92
94 Because the list of legal keys is likely to expand, code must be writ‐
95 ten to ignore unknown key-value pairs without error.
96
98 /etc/user_attr extended user attributes
99
100
101 /etc/nsswitch.conf configuration file lookup information for the
102 name server switch
103
104
106 See attributes(5) for descriptions of the following attributes:
107
108
109
110
111 ┌─────────────────────────────┬─────────────────────────────┐
112 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
113 ├─────────────────────────────┼─────────────────────────────┤
114 │MT-Level │MT-Safe │
115 └─────────────────────────────┴─────────────────────────────┘
116
118 getauthattr(3SECDB), getexecattr(3SECDB), getprofattr(3SECDB),
119 user_attr(4), attributes(5)
120
121
122
123SunOS 5.11 31 Mar 2005 getuserattr(3SECDB)