Imported Upstream version 0.66.1
[hcoop/debian/courier-authlib.git] / userdb / userdb.h
1 #ifndef userdb_h
2 #define userdb_h
3
4 /*
5 ** Copyright 1998 - 2001 Double Precision, Inc.
6 ** See COPYING for distribution information.
7 */
8
9
10 #include <sys/types.h>
11
12 #ifdef __cplusplus
13 extern "C" {
14 #endif
15
16 /*
17 Functions to access local/config/userdb.dat
18 */
19
20 void userdb_set_debug(int);
21 void userdb_init(const char *);
22 void userdb_close();
23 char *userdb(const char *); /* Fetch the record */
24 char *userdbshadow(const char *,
25 const char *); /* Fetch the userdbshadow record */
26
27 /* Extract field from the record */
28 const char *userdb_get(const char *, /* The record */
29 const char *, /* Field name */
30 int *); /* Content length returned */
31
32 /* Extract numerical field from record */
33
34 unsigned userdb_getu(const char *, /* The record */
35 const char *, /* Field name */
36 unsigned); /* Returned if field not found */
37
38 /* Extract string into malloced buffer */
39 char *userdb_gets(const char *, /* The record */
40 const char *); /* The field */
41
42 struct userdbs {
43 char *udb_name; /* Account name, ONLY set by userdb_createsuid */
44 char *udb_gecos; /* GECOS */
45 char *udb_dir; /* Home directory */
46 char *udb_shell; /* Shell */
47 char *udb_mailbox; /* Default mailbox */
48 char *udb_quota; /* Maildir quota */
49 char *udb_options; /* Options, see INSTALL */
50 uid_t udb_uid;
51 gid_t udb_gid;
52
53 char *udb_source; /* Non-blank - source file in userdb dir */
54 } ;
55
56 struct userdbs *userdb_creates(const char *);
57 struct userdbs *userdb_createsuid(uid_t);
58 struct userdbs *userdb_enum_first();
59 struct userdbs *userdb_enum_next();
60
61 void userdb_frees(struct userdbs *);
62 char *userdb_mkmd5pw(const char *);
63
64 #ifdef __cplusplus
65 } ;
66 #endif
67
68 #endif