Imported upstream version 0.59.3
[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 static const char userdb_rcsid_h[]="$Id: userdb.h,v 1.8 2004/04/18 15:54:39 mrsam Exp $";
10
11 #include <sys/types.h>
12
13 #ifdef __cplusplus
14 extern "C" {
15 #endif
16
17 /*
18 Functions to access local/config/userdb.dat
19 */
20
21 void userdb_set_debug(int);
22 void userdb_init(const char *);
23 void userdb_close();
24 char *userdb(const char *); /* Fetch the record */
25 char *userdbshadow(const char *,
26 const char *); /* Fetch the userdbshadow record */
27
28 /* Extract field from the record */
29 const char *userdb_get(const char *, /* The record */
30 const char *, /* Field name */
31 int *); /* Content length returned */
32
33 /* Extract numerical field from record */
34
35 unsigned userdb_getu(const char *, /* The record */
36 const char *, /* Field name */
37 unsigned); /* Returned if field not found */
38
39 /* Extract string into malloced buffer */
40 char *userdb_gets(const char *, /* The record */
41 const char *); /* The field */
42
43 struct userdbs {
44 char *udb_name; /* Account name, ONLY set by userdb_createsuid */
45 char *udb_gecos; /* GECOS */
46 char *udb_dir; /* Home directory */
47 char *udb_shell; /* Shell */
48 char *udb_mailbox; /* Default mailbox */
49 char *udb_quota; /* Maildir quota */
50 char *udb_options; /* Options, see INSTALL */
51 uid_t udb_uid;
52 gid_t udb_gid;
53
54 char *udb_source; /* Non-blank - source file in userdb dir */
55 } ;
56
57 struct userdbs *userdb_creates(const char *);
58 struct userdbs *userdb_createsuid(uid_t);
59 struct userdbs *userdb_enum_first();
60 struct userdbs *userdb_enum_next();
61
62 void userdb_frees(struct userdbs *);
63 char *userdb_mkmd5pw(const char *);
64
65 #ifdef __cplusplus
66 } ;
67 #endif
68
69 #endif