Merge branch 'debian'
[hcoop/debian/courier-authlib.git] / userdb / userdb.h
CommitLineData
d9898ee8 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
d9898ee8 9
10#include <sys/types.h>
11
12#ifdef __cplusplus
13extern "C" {
14#endif
15
16/*
17 Functions to access local/config/userdb.dat
18*/
19
20void userdb_set_debug(int);
21void userdb_init(const char *);
22void userdb_close();
23char *userdb(const char *); /* Fetch the record */
24char *userdbshadow(const char *,
25 const char *); /* Fetch the userdbshadow record */
26
27 /* Extract field from the record */
28const 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
34unsigned 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 */
39char *userdb_gets(const char *, /* The record */
40 const char *); /* The field */
41
42struct 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
56struct userdbs *userdb_creates(const char *);
57struct userdbs *userdb_createsuid(uid_t);
58struct userdbs *userdb_enum_first();
59struct userdbs *userdb_enum_next();
60
61void userdb_frees(struct userdbs *);
62char *userdb_mkmd5pw(const char *);
63
64#ifdef __cplusplus
65} ;
66#endif
67
68#endif