summaryrefslogtreecommitdiffstats
path: root/maildrop/dovecotauth.h
blob: dcdc13f7513d24d6801c6d477b1d6daa07d63dee (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
#ifndef	dovecotauth_h
#define	dovecotauth_h

/*
** Copyright 2009 Marko Njezic
** Licensed under the same terms as Courier Authlib AND/OR Courier Maildrop.
**
** Partially based on courierauth.h from Courier Authlib, which had the following statement:
**
** Copyright 2004 Double Precision, Inc.  See COPYING for
** distribution information.
*/

#include	<sys/types.h>

#ifdef	__cplusplus
extern "C" {
#endif

static const char dovecotauth_h_rcsid[]="$Id$";

struct dovecotauthinfo {
	const char *address;
	const char *sysusername;
	const uid_t *sysuserid;
	gid_t sysgroupid;
	const char *homedir;
	const char *maildir;
	} ;

/*
	This structure is modeled after authinfo structure from Courier Authlib.

	Either sysusername or sysuserid may be NULL, but not both of them.
	They, and sysgroupid, specify the authenticated user's system
	userid and groupid.  homedir points to the authenticated user's
	home directory.  address and maildir, are obvious.

	After populating this tructure, the lookup function calls the
	callback function that's specified in its second argument.  The
	callback function receives a pointer to the authinfo structure.

	The callback function also receives a context pointer, which is
	the third argument to the lookup function.

	The lookup function should return a negative value if the userid
	does not exist, a positive value if there was a temporary error
	looking up the userid, or whatever is the return code from the
	callback function, if the user exists.
*/

int dovecotauth_getuserinfo(const char *addr, const char *user,
	int (*func)(struct dovecotauthinfo *, void *), void *arg);

#ifdef	__cplusplus
}
#endif

#endif