File: user.sgml

package info (click to toggle)
libuser 1%3A0.56.9.dfsg.1-1
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 6,604 kB
  • ctags: 1,619
  • sloc: ansic: 15,970; sh: 10,210; xml: 2,060; python: 1,740; yacc: 782; makefile: 258; sed: 16
file content (468 lines) | stat: -rw-r--r-- 11,922 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
<!-- ##### SECTION Title ##### -->
user

<!-- ##### SECTION Short_Description ##### -->

Functions for initializing the library, looking up information, and making 
changes to the system information store.

<!-- ##### SECTION Long_Description ##### -->
<para>

user.h contains declarations for functions which start up and shut down the
libuser library, and for functions which perform lookup queries and
modifications of the system information store.

</para>

<!-- ##### SECTION See_Also ##### -->
<para>

</para>

<!-- ##### SECTION Stability_Level ##### -->


<!-- ##### FUNCTION lu_start ##### -->
<para>
Initializes the libuser library.
</para>

@authname: suggested client name to use when connecting to servers, or %NULL
@auth_type: whether auth_name is a user or a group
@modules: a list of modules to use for queries (separated by whitespace or
commas), or %NULL to use modules specified in the config file
@create_modules: a list of modules to use for entity creation (separated by
whitespace or commas), or %NULL to use modules specified in the config file
@prompter: a function to use for getting information from the user
@callback_data: data for @prompter
@error: filled with a #lu_error if an error occurs
@Returns: a context which should be freed by lu_end() on success, %NULL on
failure


<!-- ##### FUNCTION lu_end ##### -->
<para>
Destroys a libuser library context
</para>

@context: a context


<!-- ##### FUNCTION lu_set_prompter ##### -->
<para>
Changes the prompter function in a context
</para>

@context: a context
@prompter: a new function to user for getting information from the user
@callback_data: data for @prompter


<!-- ##### FUNCTION lu_get_prompter ##### -->
<para>
Gets current prompter function from a context
</para>

@context: a context
@prompter: if not %NULL, points to a place where the current prompter function
will be stored
@callback_data: if not %NULL, points to a place where the current prompter
function data will be stored


<!-- ##### FUNCTION lu_set_modules ##### -->
<para>
Replaces the current set of modules for queries in @context to @list.
</para>

@context: a context
@list: a list of modules (separated by whitespace or commas)
@error: filled with a #lu_error if an error occurs
@Returns: %TRUE on success, %FALSE on failure


<!-- ##### FUNCTION lu_get_modules ##### -->
<para>
Returns a list of modules for queries in @context.
</para>

@context: a context
@Returns: a list of modules separated by spaces, or %NULL if the list of
modules is empty.  The list should not be freed by the caller.


<!-- ##### FUNCTION lu_uses_elevated_privileges ##### -->
<para>
Checks if any module uses elevated privileges (e.g. modifies files that
normal users can't modify).
</para>

@context: a context
@Returns: %TRUE if at least one module uses elevated privileges


<!-- ##### FUNCTION lu_user_lookup_name ##### -->
<para>
Looks up an user by name.
</para>

@context: a context
@name: user name
@ent: an entity filled with received information
@error: filled with a #lu_error if an error occurs
@Returns: %TRUE on success


<!-- ##### FUNCTION lu_user_lookup_id ##### -->
<para>
Looks up an user by UID.
</para>

@context: a context
@uid: user ID
@ent: an entity filled with received information
@error: filled with a #lu_error if an error occurs
@Returns: %TRUE on success


<!-- ##### FUNCTION lu_user_default ##### -->
<para>
Fills out an user entity as specified by the config file and modules
to prepare for creation of the user.
</para>

@ctx: a context
@name: new user name
@system_account: non-zero if the user is a system user
@ent: an entity
@Returns: %TRUE on success


<!-- ##### FUNCTION lu_user_add ##### -->
<para>
Creates an user in all modules specified for entity creation.
</para>

@context: a context
@ent: an entity describing the user, on success updated with resulting account
@error: filled with a #lu_error if an error occurs
@Returns: %TRUE on success


<!-- ##### FUNCTION lu_user_modify ##### -->
<para>
Modifies an user entity.
</para>

@context: a context
@ent: an entity with pending modifications, on success updated with current
information
@error: filled with a #lu_error if an error occurs
@Returns: %TRUE on success


<!-- ##### FUNCTION lu_user_delete ##### -->
<para>
Deletes an user.
</para>

@context: a context
@ent: an entity describing the user
@error: filled with a #lu_error if an error occurs
@Returns: %TRUE on success


<!-- ##### FUNCTION lu_user_setpass ##### -->
<para>
Changes an user's password.
</para>

@context: a context
@ent: an entity describing the user, on success updated with current
information and LU_SHADOWLASTCHANGE
@newpass: new password
@crypted: non-zero if @newpass is already encrypted
@error: filled with an #lu_error if an error occurs
@Returns: %TRUE on success


<!-- ##### FUNCTION lu_user_removepass ##### -->
<para>
Changes an user's password to an empty string.
</para>

@context: a context
@ent: an entity describing the user, on success updated with current
information and LU_SHADOWLASTCHANGE
@error: filled with an #lu_error if an error occurs
@Returns: %TRUE on success


<!-- ##### FUNCTION lu_user_lock ##### -->
<para>
Locks an user account.
</para>

@context: a context
@ent: an entity describing the user, on success updated with current
information
@error: filled with a #lu_error if an error occurs
@Returns: %TRUE on success


<!-- ##### FUNCTION lu_user_unlock ##### -->
<para>
Unlocks an user account.
</para>

@context: a context
@ent: an entity describing the user, on success updated with current
information
@error: filled with a #lu_error if an error occurs
@Returns: %TRUE on success


<!-- ##### FUNCTION lu_user_unlock_nonempty ##### -->
<para>
Unlocks an user account.  If unlocking the account would result in an empty
password field, it fails with %lu_error_unlock_empty.  Note that the
password can still be empty.
</para>

@context: a context
@ent: an entity describing the user, on success updated with current
information
@error: filled with a #lu_error if an error occurs
@Returns: %TRUE on success


<!-- ##### FUNCTION lu_user_islocked ##### -->
<para>
Checks if an user account is locked.
</para>

@context: a context
@ent: an entity describing the user
@error: filled with a #lu_error if an error occurs
@Returns: %TRUE if the account is locked in at least one module


<!-- ##### FUNCTION lu_users_enumerate ##### -->
<para>
Returns a list of all users matching a pattern.
</para>

@context: a context
@pattern: a glob-like pattern for user name
@error: filled with a #lu_error if an error occurs
@Returns: an array of strings, each representing one user name.  The array
should be freed by the caller.


<!-- ##### FUNCTION lu_users_enumerate_by_group ##### -->
<para>
Returns a list of all members of a group @group.
</para>

@context: a context
@group: group name
@error: filled with a #lu_error if an error occurs
@Returns: an array of strings, each representing one user name.  The array
should be freed by the caller.


<!-- ##### FUNCTION lu_users_enumerate_full ##### -->
<para>
Returns a list of entities, one for each user matching a pattern.
</para>

@context: a context
@pattern: a glob-like pattern for user name
@error: filled with a #lu_error if an error occurs
@Returns: a list of pointers to user entities.  The entities and the
list should be freed by the caller.


<!-- ##### FUNCTION lu_group_lookup_name ##### -->
<para>
Looks up a group by name.
</para>

@context: a context
@name: group name
@ent: an entity filled with received information
@error: filled with a #lu_error if an error occurs
@Returns: %TRUE on success


<!-- ##### FUNCTION lu_group_lookup_id ##### -->
<para>
Looks up a group by GID.
</para>

@context: a context
@gid: group ID
@ent: an entity filled with received information
@error: filled with a #lu_error if an error occurs
@Returns: %TRUE on success


<!-- ##### FUNCTION lu_group_default ##### -->
<para>
Fills out a group entity as specified by the config file and modules
to prepare for creation of the group.
</para>

@ctx: a context
@name: new group name
@system_account: non-zero if the group is a system group
@ent: an entity
@Returns: %TRUE on success


<!-- ##### FUNCTION lu_group_add ##### -->
<para>
Creates a group in all modules specified for entity creation.
</para>

@context: a context
@ent: an entity describing the group, on success updated with resulting account
@error: filled with a #lu_error if an error occurs
@Returns: %TRUE on success


<!-- ##### FUNCTION lu_group_modify ##### -->
<para>
Modifies a group entity.
</para>

@context: a context
@ent: an entity with pending modifications, on success updated with current
information
@error: filled with a #lu_error if an error occurs
@Returns: %TRUE on success


<!-- ##### FUNCTION lu_group_delete ##### -->
<para>
Deletes a group.
</para>

@context: a context
@ent: an entity describing the group
@error: filled with a #lu_error if an error occurs
@Returns: %TRUE on success


<!-- ##### FUNCTION lu_group_setpass ##### -->
<para>
Changes a group password.
</para>

@context: a contect
@ent: an entity describing the group, on success updated with current
information and LU_SHADOWLASTCHANGE
@newpass: new password
@crypted: non-zero if @newpass is already encrypted
@error: filled with an #lu_error if an error occurs
@Returns: %TRUE on success


<!-- ##### FUNCTION lu_group_removepass ##### -->
<para>
Changes a group password to an empty string.
</para>

@context: a context
@ent: an entity describing the group, on success udpated with current
information and LU_SHADOWLASTCHANGE
@error: filled with in #lu_error if an error occurs
@Returns: %TRUE on success


<!-- ##### FUNCTION lu_group_lock ##### -->
<para>
Locks a group account
</para>

@context: a context
@ent: an entity describing the group, on success updated with current
information
@error: filled with a #lu_error if an error occurs
@Returns: %TRUE on success


<!-- ##### FUNCTION lu_group_unlock ##### -->
<para>
Unlocks a group account.
</para>

@context: a context
@ent: an entity describing the group, on success updated with current
information
@error: filled with a #lu_error if an error occurs
@Returns: %TRUE on success


<!-- ##### FUNCTION lu_group_unlock_nonempty ##### -->
<para>
Unlocks a group account.  If unlocking the account would result in an empty
password field, it fails with %lu_error_unlock_empty.  Note that the
password can still be empty.
</para>

@context: a context
@ent: an entity describing the group, on success updated with current
information
@error: filled with a #lu_error if an error occurs
@Returns: %TRUE on success


<!-- ##### FUNCTION lu_group_islocked ##### -->
<para>
Checks if a group account is locked.
</para>

@context: a context
@ent: an entity describing the group
@error: filled with a #lu_error if an error occurs
@Returns: %TRUE if the account is locked in at least one module


<!-- ##### FUNCTION lu_groups_enumerate ##### -->
<para>
Returns a list of all groups matching a pattern.
</para>

@context: a context
@pattern: a glob-like pattern for group name
@error: filled with a #lu_error if an error occurs
@Returns: an array of strings, each representing one group name.  The array
should be freed by the caller.


<!-- ##### FUNCTION lu_groups_enumerate_by_user ##### -->
<para>
Returns a list of all groups containing an user @user.
</para>

@context: a context
@user: user name
@error: filled with a #lu_error if an error occurs
@Returns: an array of strings, each representing one group name.  The array
should be freed by the caller.


<!-- ##### FUNCTION lu_groups_enumerate_full ##### -->
<para>
Returns a list of entities, one for each group matching a pattern.
</para>

@context: a context
@pattern: a glob-like pattern for group name
@error: filled with a #lu_error if an error occurs
@Returns: a list of pointers to group entities.  The entities and the
list should be freed by the caller.