summaryrefslogtreecommitdiffstats
path: root/userdb/userdb.h
blob: 3b2690a33e024968bc03e04c1052ba9c527414ce (plain)
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
#ifndef	userdb_h
#define	userdb_h

/*
** Copyright 1998 - 2001 Double Precision, Inc.
** See COPYING for distribution information.
*/


#include	<sys/types.h>

#ifdef	__cplusplus
extern "C" {
#endif

/*
	Functions to access local/config/userdb.dat
*/

void userdb_set_debug(int);
void userdb_init(const char *);
void userdb_close();
char	*userdb(const char *);	/* Fetch the record */
char	*userdbshadow(const char *,
		const char *);	/* Fetch the userdbshadow record */

		/* Extract field from the record */
const char	*userdb_get(const char *,	/* The record */
			const char *,	/* Field name */
			int *);		/* Content length returned */

		/* Extract numerical field from record */

unsigned userdb_getu(const char *,	/* The record */
	const char *,			/* Field name */
	unsigned);			/* Returned if field not found */

		/* Extract string into malloced buffer */
char *userdb_gets(const char *,	/* The record */
	const char *);	/* The field */

struct userdbs {
	char *udb_name;	   /* Account name, ONLY set by userdb_createsuid */
	char *udb_gecos;	/* GECOS */
	char *udb_dir;		/* Home directory */
	char *udb_shell;	/* Shell */
	char *udb_mailbox;	/* Default mailbox */
	char *udb_quota;	/* Maildir quota */
	char *udb_options;	/* Options, see INSTALL */
	uid_t	udb_uid;
	gid_t	udb_gid;

	char *udb_source;	/* Non-blank - source file in userdb dir */
	} ;

struct userdbs *userdb_creates(const char *);
struct userdbs *userdb_createsuid(uid_t);
struct userdbs *userdb_enum_first();
struct userdbs *userdb_enum_next();

void	userdb_frees(struct userdbs *);
char *userdb_mkmd5pw(const char *);

#ifdef	__cplusplus
} ;
#endif

#endif