userdb: Allow "+", ":", and "_" in usernames.
[hcoop/debian/courier-authlib.git] / auth_login.3
CommitLineData
d9898ee8 1.\" <!-- $Id: auth_login.sgml,v 1.3 2007/04/01 00:21:34 mrsam Exp $ -->
2.\" <!-- Copyright 2004 Double Precision, Inc. See COPYING for -->
3.\" <!-- distribution information. -->
4.\" Title: auth_login
5.\" Author:
6.\" Generator: DocBook XSL Stylesheets v1.72.0 <http://docbook.sf.net/>
7.\" Date: 04/06/2007
8.\" Manual: Double Precision, Inc.
9.\" Source: Double Precision, Inc.
10.\"
11.TH "AUTH_LOGIN" "3" "04/06/2007" "Double Precision, Inc." "Double Precision, Inc."
12.\" disable hyphenation
13.nh
14.\" disable justification (adjust text to left margin only)
15.ad l
16.SH "NAME"
17auth_login \- Validate a userid and password
18.SH "SYNOPSIS"
19.sp
20.RS 4
21.nf
22#include <courierauth.h>
23.fi
24.RE
25.HP 18
26.BI "int rc=auth_login(const\ char\ *" "service" ", const\ char\ *" "userid" ", const\ char\ *" "password" ", int\ (*" "callback_func" ")(struct\ authinfo\ *,\ void\ *), void\ *" "callback_arg" ");"
27.SH "DESCRIPTION"
28.PP
29
30\fBauth_login\fR
31verifies whether
32\fIuserid\fR
33exists, and whether it's
34\fIpassword\fR
35is correct.
36\fIservice\fR
37specifies which so\-called "service" is being authenticated; like
38\(lqimap\(rq
39or
40\(lqpop3\(rq.
41\fIservice\fR
42may or may not be used by the Courier authentication library's configured back\-end module.
43.SH "RETURNS"
44.PP
45
46\fBcallback_func\fR
47will be invoked if
48\fBauth_login\fR
49succeeds, and
50\fBcallback_func\fR's return value becomes the return value from
51\fBauth_login\fR
52(which should be 0, by convention).
53\fBcallback_func\fR
54will not be invoked if an error occurs, which is reported by a non\-zero return value from
55\fBauth_login\fR. By convention, a positive return value indicates an internal, temporary failure, such as the authentication daemon process not running; a negative return value indicates that this request was processed, but it failed.
56.PP
57The second argument to
58\fBcallback_func\fR
59will be
60\fBcallback_arg\fR, which is not interpreted by this function in any way. The first argument will be a pointer to the following structure:
61\fBExample\ 1.\ struct authinfo\fR
62.sp
63.RS 4
64.nf
65struct authinfo {
66 const char *sysusername;
67 const uid_t *sysuserid;
68 gid_t sysgroupid;
69 const char *homedir;
70
71 const char *address;
72 const char *fullname;
73 const char *maildir;
74 const char *quota;
75 const char *passwd;
76 const char *clearpasswd;
77
78 const char *options;
79
80 } ;
81.fi
82.RE
83.PP
84Description of the above fields:
85.PP
86address
87.RS 4
88The authenticated login ID.
89.RE
90.PP
91sysusername
92.RS 4
93The authenticated account's userid and groupid can be looked up in the password file using
94address. If this field is
95NULL, obtain the userid and the groupid from
96sysuserid
97and
98sysgroupid.
99.RE
100.PP
101sysuserid
102.RS 4
103
104sysuserid
105may be
106NULL
107if
108sysusername
109is initialized, otherwise it's a pointer to the account's numeric userid.
110.RE
111.PP
112sysgroupid
113.RS 4
114Account's numeric groupid.
115sysgroupid
116is only used when
117sysusername
118is
119NULL.
120.RE
121.PP
122fullname
123.RS 4
124This is the account's full name. This field is optional, it may be
125NULL.
126.RE
127.PP
128homedir
129.RS 4
130The account's home directory. This field cannot be
131NULL.
132.RE
133.PP
134maildir
135.RS 4
136The pathname to the account's mailbox. This field is optional, it can be
137NULL
138in which case the default location is assumed.
139.RE
140.PP
141quota
142.RS 4
143Optional maildir quota on the account's mailbox (and
144NULL
145if no quota is set).
146.RE
147.PP
148passwd
149.RS 4
150The account's encrypted password, if available. If the account has a cleartext password defined, this field can be set to
151NULL. The encrypted password can take several formats:
152.RS 4
153\h'-04'\(bu\h'+03'A traditional triple\-DES crypted password, or a MD5+salt\-hashed password, as used in Linux.
154.RE
155.RS 4
156\h'-04'\(bu\h'+03'
157\(lq{MD5}\(rq
158followed by a base64\-encoded MD5 hash of the password.
159.RE
160.RS 4
161\h'-04'\(bu\h'+03'
162\(lq{SHA}\(rq
163followed by a base64\-encoded SHA1 hash of the password.
164.RE
165.RE
166.PP
167clearpasswd
168.RS 4
169The account's cleartext password, if available. If the account has an encrypted password defined, this field can be set to
170NULL.
171.RE
172.PP
173options
174.RS 4
175A comma\-separated list of miscellaneous account options. See below for more information.
176.RE
177.SS "Account options"
178.PP
179Depending on the configuration of the Courier authentication library, accounts may have individual options associated with them. If the authentication library configuration does not implement account options, the option string will be
180NULL. Otherwise it will be a comma\-separated list of
181\(lq\fIoption\fR=\fIvalue\fR\(rq
182settings.
183.sp
184.it 1 an-trap
185.nr an-no-space-flag 1
186.nr an-break-flag 1
187.br
188\fBNote\fR
189.PP
190This is the account option implementation that's used by Courier, Courier\-IMAP, and SqWebMail packages. Some of the following information is obviously not applicable for a particular package. The inapplicable bits should be obvious.
191.PP
192The following options are recognized by the various Courier packages:
193.sp
194.it 1 an-trap
195.nr an-no-space-flag 1
196.nr an-break-flag 1
197.br
198\fBNote\fR
199.PP
200The application is responsible for enforcing all the
201\(lqdisabled\(rq
202option. An authentication request for service
203\(lqimap\(rq, for example, will succeed provided that the userid and the password are valid, even if
204\(lqdisableimap=1\(rq
205is set. The application's
206\fBcallback_func\fR
207should check for this condition, and return a negative return code.
208.PP
209disableimap=\fIn\fR
210.RS 4
211If "n" is 1, IMAP access to this account should be disabled.
212.RE
213.PP
214disablepop3=\fIn\fR
215.RS 4
216If "n" is 1, POP3 access to this account should be disabled.
217.RE
218.PP
219disablewebmail=\fIn\fR
220.RS 4
221If "n" is 1, webmail access to this account should be disabled.
222.RE
223.PP
224disableshared=\fIn\fR
225.RS 4
226If "n" is 1, this account should not have access to shared folders or be able to share its own folders with other people.
227.RE
228.PP
229group=\fIname\fR
230.RS 4
231This account is a member of access group
232\fIname\fR. Instead of granting access rights on individual mail folders to individual accounts, the access rights can be granted to an access group
233\(lqname\(rq, and all members of this group get the specified access rights.
234.sp
235The access group name
236\(lqadministrators\(rq
237is a reserved group. All accounts in the
238administrators
239group automatically receive all rights to all accessible folders.
240.sp
241.it 1 an-trap
242.nr an-no-space-flag 1
243.nr an-break-flag 1
244.br
245\fBNote\fR
246This option may be specified multiple times to specify that the account belongs to multiple account groups.
247.RE
248.PP
249sharedgroup=\fIname\fR
250.RS 4
251Append "name" to the name of the top level virtual shared folder index file. This setting restricts which virtual shared folders this account could possibly access (and that's on top of whatever else the access control lists say). See the virtual shared folder documentation for more information.
252.sp
253For technical reasons, group names may not include comma, tab, "/" or "|" characters.
254.RE
255.SH "SEE ALSO"
256.PP
257
258\fI\fBauthlib\fR(3)\fR\&[1],
259\fI\fBauth_generic\fR(3)\fR\&[2],
260\fI\fBauth_getuserinfo\fR(3)\fR\&[3],
261\fI\fBauth_enumerate\fR(3)\fR\&[4],
262\fI\fBauth_passwd\fR(3)\fR\&[5],
263\fI\fBauth_getoption\fR(3)\fR\&[6].
264.SH "REFERENCES"
265.IP " 1." 4
266\fBauthlib\fR(3)
267.RS 4
268\%authlib.html
269.RE
270.IP " 2." 4
271\fBauth_generic\fR(3)
272.RS 4
273\%auth_generic.html
274.RE
275.IP " 3." 4
276\fBauth_getuserinfo\fR(3)
277.RS 4
278\%auth_getuserinfo.html
279.RE
280.IP " 4." 4
281\fBauth_enumerate\fR(3)
282.RS 4
283\%auth_enumerate.html
284.RE
285.IP " 5." 4
286\fBauth_passwd\fR(3)
287.RS 4
288\%auth_passwd.html
289.RE
290.IP " 6." 4
291\fBauth_getoption\fR(3)
292.RS 4
293\%auth_getoption.html
294.RE