|
1 /** @file ../include/pwd.h |
|
2 @internalComponent |
|
3 */ |
|
4 |
|
5 |
|
6 /** @fn getpwnam(const char *name) |
|
7 @param name |
|
8 |
|
9 Refer to getpwent() for the documentation |
|
10 |
|
11 @see getgrent() |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 @publishedAll |
|
17 @externallyDefinedApi |
|
18 */ |
|
19 |
|
20 /** @fn getpwuid(uid_t uid) |
|
21 @param uid |
|
22 |
|
23 Refer to getpwent() for the documentation |
|
24 |
|
25 @see getgrent() |
|
26 |
|
27 |
|
28 |
|
29 |
|
30 @publishedAll |
|
31 @externallyDefinedApi |
|
32 */ |
|
33 |
|
34 /** @fn endpwent(void) |
|
35 |
|
36 Refer to getpwent() for the documentation |
|
37 @see getgrent() |
|
38 |
|
39 |
|
40 |
|
41 |
|
42 @publishedAll |
|
43 @externallyDefinedApi |
|
44 */ |
|
45 |
|
46 /** @fn getpwent(void) |
|
47 |
|
48 Note: This description also covers the following functions - |
|
49 getpwnam() getpwnam_r() getpwuid() getpwuid_r() setpwent() endpwent() |
|
50 |
|
51 @return The functions getpwent, getpwnam, and getpwuid return a valid pointer to a passwd structure on success |
|
52 or NULL if the entry is not found or if an error occurs. |
|
53 If an error does occur, errno will be set. |
|
54 The functions getpwnam_r, and getpwuid_r return 0 if no error occurred, or an error number to indicate failure. |
|
55 It is not an error if a matching entry is not found. |
|
56 (Thus, if result is NULL and the return value is 0, no matching entry exists.) The endpwent and setpwent functions |
|
57 have no return value. |
|
58 |
|
59 These APIs belongs to set which are only build supported and not available functionally. The reason why only build support is extended to these APIs is that Symbian operating system does not support the creation of multiple users and groups in its environment. Moreover it may not make sense to have multiple users and groups in the context of a mobile environment. |
|
60 We refer to the structure |
|
61 @code |
|
62 #include <pwd.h> |
|
63 struct passwd { |
|
64 char *pw_name; /* user name */ |
|
65 char *pw_passwd; /* encrypted password */ |
|
66 uid_t pw_uid; /* user uid */ |
|
67 gid_t pw_gid; /* user gid */ |
|
68 time_t pw_change; /* password change time */ |
|
69 char *pw_class; /* user access class */ |
|
70 char *pw_gecos; /* Honeywell login info */ |
|
71 char *pw_dir; /* home directory */ |
|
72 char *pw_shell; /* default shell */ |
|
73 time_t pw_expire; /* account expiration */ |
|
74 int pw_fields; /* internal: fields filled in */ |
|
75 }; |
|
76 |
|
77 @endcode |
|
78 |
|
79 |
|
80 The functions getpwnam and getpwuid returns the default values for a single user system i.e., pw_name,pw_passwd,pw_uid and pw_gid set to root,NULL,0 and 0 respectively in case the input parameter uid/login is 0/ root else the error number is set and NULL is returned by the APIs. |
|
81 |
|
82 The getpwent when called the first time by an application returns the pointer to a valid passwd structure,that of the simulated single-user group.Subsequent calls return NULL until setpwent is called |
|
83 |
|
84 The functions getpwnam_r, and getpwuid_r are thread-safe versions of getpwnam, and getpwuid, respectively. The caller must provide storage for the results of the search in the pwd, buffer, bufsize, and result arguments. When these functions are successful, the pwd argument will be filled-in, and a pointer to that argument will be stored in result. If an entry is not found or an error occurs, result will be set to NULL. |
|
85 |
|
86 The setpwent function sets the library such that subsequent getpwent call returns a filled passwd structure. |
|
87 |
|
88 endpwent function sets up the library such that the subsequent getpwent call returns NULL. |
|
89 |
|
90 |
|
91 |
|
92 |
|
93 |
|
94 |
|
95 @see getgrent() |
|
96 |
|
97 |
|
98 Bugs: |
|
99 |
|
100 The functions getpwent, getpwnam, and getpwuid, leave their results in an internal static object and return |
|
101 a pointer to that object. |
|
102 Subsequent calls to |
|
103 the same function |
|
104 will modify the same object. The functions getpwent, endpwent, and setpwent are fairly useless in a networked environment and should be |
|
105 avoided, if possible. |
|
106 |
|
107 |
|
108 |
|
109 @publishedAll |
|
110 @externallyDefinedApi |
|
111 */ |
|
112 |
|
113 /** @fn setpwent(void) |
|
114 |
|
115 Refer to getpwent() for the documentation |
|
116 @see getgrent() |
|
117 |
|
118 |
|
119 |
|
120 |
|
121 @publishedAll |
|
122 @externallyDefinedApi |
|
123 */ |
|
124 |
|
125 /** @fn getpwnam_r(const char *name, struct passwd *pwd, char *, size_t, struct passwd **result) |
|
126 @param name |
|
127 @param pwd |
|
128 @param result |
|
129 |
|
130 Refer to getpwent() for the documentation |
|
131 |
|
132 @see getgrent() |
|
133 |
|
134 |
|
135 |
|
136 |
|
137 @publishedAll |
|
138 @externallyDefinedApi |
|
139 */ |
|
140 |
|
141 /** @fn getpwuid_r(uid_t uid, struct passwd *pwd, char *, size_t, struct passwd **result) |
|
142 @param uid |
|
143 @param pwd |
|
144 @param result |
|
145 |
|
146 Refer to getpwent() for the documentation |
|
147 |
|
148 @see getgrent() |
|
149 |
|
150 |
|
151 |
|
152 |
|
153 @publishedAll |
|
154 @externallyDefinedApi |
|
155 */ |
|
156 |
|
157 /** @struct passwd |
|
158 |
|
159 The passwd data structure is used to hold information about entries in the system user data base |
|
160 |
|
161 @publishedAll |
|
162 @externallyDefinedApi |
|
163 */ |
|
164 |
|
165 /** @var passwd::pw_name |
|
166 user name |
|
167 */ |
|
168 |
|
169 /** @var passwd::pw_passwd |
|
170 encrypted password |
|
171 */ |
|
172 |
|
173 /** @var passwd::pw_uid |
|
174 user uid |
|
175 */ |
|
176 |
|
177 /** @var passwd::pw_gid |
|
178 user gid |
|
179 */ |
|
180 |
|
181 /** @var passwd::pw_change |
|
182 password change time |
|
183 */ |
|
184 |
|
185 /** @var passwd::pw_class |
|
186 user access class |
|
187 */ |
|
188 |
|
189 /** @var passwd::pw_gecos |
|
190 login info |
|
191 */ |
|
192 |
|
193 /** @var passwd::pw_dir |
|
194 home directory |
|
195 */ |
|
196 |
|
197 /** @var passwd::pw_shell |
|
198 default shell |
|
199 */ |
|
200 |
|
201 /** @var passwd::pw_expire |
|
202 account expiration |
|
203 */ |
|
204 |
|
205 /** @var passwd::pw_fields |
|
206 internal: fields filled in |
|
207 */ |
|
208 |
|
209 /** @def _PATH_PWD |
|
210 |
|
211 Defines to "//etc" |
|
212 |
|
213 @publishedAll |
|
214 @released |
|
215 */ |
|
216 |
|
217 |
|
218 /** @def _PATH_PASSWD |
|
219 |
|
220 Defines to "//etc//passwd" |
|
221 |
|
222 @publishedAll |
|
223 @released |
|
224 */ |
|
225 |
|
226 |
|
227 /** @def _PASSWD |
|
228 |
|
229 Defines to "passwd" |
|
230 |
|
231 @publishedAll |
|
232 @released |
|
233 */ |
|
234 |
|
235 |
|
236 /** @def _PATH_MASTERPASSWD |
|
237 |
|
238 Defines to "//etc//master.passwd" |
|
239 |
|
240 @publishedAll |
|
241 @released |
|
242 */ |
|
243 |
|
244 /** @def _MASTERPASSWD |
|
245 |
|
246 "master.passwd" |
|
247 |
|
248 @publishedAll |
|
249 @released |
|
250 */ |
|
251 |
|
252 |
|
253 /** @def _PATH_MP_DB |
|
254 |
|
255 Defines to "//etc//pwd.db" |
|
256 |
|
257 @publishedAll |
|
258 @released |
|
259 */ |
|
260 |
|
261 |
|
262 /** @def _MP_DB |
|
263 |
|
264 Defines to "pwd.db" |
|
265 |
|
266 @publishedAll |
|
267 @released |
|
268 */ |
|
269 |
|
270 |
|
271 |
|
272 /** @def _PATH_SMP_DB |
|
273 |
|
274 Defines to "//etc//spwd.db" |
|
275 |
|
276 @publishedAll |
|
277 @released |
|
278 */ |
|
279 |
|
280 |
|
281 /** @def _SMP_DB |
|
282 |
|
283 Defines to "spwd.db" |
|
284 |
|
285 @publishedAll |
|
286 @released |
|
287 */ |
|
288 |
|
289 |
|
290 /** @def _PATH_PWD_MKDB |
|
291 |
|
292 Defines to "//usr//sbin//pwd_mkdb" |
|
293 |
|
294 @publishedAll |
|
295 @released |
|
296 */ |
|
297 |
|
298 |
|
299 /** @def _PASSWORD_LEN |
|
300 |
|
301 max length, not counting NULL |
|
302 |
|
303 @publishedAll |
|
304 @released |
|
305 */ |
|
306 |
|
307 |
|
308 |
|
309 |