Build courier-authlib 0.59.3-1hcoop1.
[hcoop/debian/courier-authlib.git] / auth_login.3
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"
17 auth_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
31 verifies whether
32 \fIuserid\fR
33 exists, and whether it's
34 \fIpassword\fR
35 is correct.
36 \fIservice\fR
37 specifies which so\-called "service" is being authenticated; like
38 \(lqimap\(rq
39 or
40 \(lqpop3\(rq.
41 \fIservice\fR
42 may 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
47 will be invoked if
48 \fBauth_login\fR
49 succeeds, 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
54 will 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
57 The second argument to
58 \fBcallback_func\fR
59 will 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
65 struct 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
84 Description of the above fields:
85 .PP
86 address
87 .RS 4
88 The authenticated login ID.
89 .RE
90 .PP
91 sysusername
92 .RS 4
93 The authenticated account's userid and groupid can be looked up in the password file using
94 address. If this field is
95 NULL, obtain the userid and the groupid from
96 sysuserid
97 and
98 sysgroupid.
99 .RE
100 .PP
101 sysuserid
102 .RS 4
103
104 sysuserid
105 may be
106 NULL
107 if
108 sysusername
109 is initialized, otherwise it's a pointer to the account's numeric userid.
110 .RE
111 .PP
112 sysgroupid
113 .RS 4
114 Account's numeric groupid.
115 sysgroupid
116 is only used when
117 sysusername
118 is
119 NULL.
120 .RE
121 .PP
122 fullname
123 .RS 4
124 This is the account's full name. This field is optional, it may be
125 NULL.
126 .RE
127 .PP
128 homedir
129 .RS 4
130 The account's home directory. This field cannot be
131 NULL.
132 .RE
133 .PP
134 maildir
135 .RS 4
136 The pathname to the account's mailbox. This field is optional, it can be
137 NULL
138 in which case the default location is assumed.
139 .RE
140 .PP
141 quota
142 .RS 4
143 Optional maildir quota on the account's mailbox (and
144 NULL
145 if no quota is set).
146 .RE
147 .PP
148 passwd
149 .RS 4
150 The account's encrypted password, if available. If the account has a cleartext password defined, this field can be set to
151 NULL. 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
158 followed by a base64\-encoded MD5 hash of the password.
159 .RE
160 .RS 4
161 \h'-04'\(bu\h'+03'
162 \(lq{SHA}\(rq
163 followed by a base64\-encoded SHA1 hash of the password.
164 .RE
165 .RE
166 .PP
167 clearpasswd
168 .RS 4
169 The account's cleartext password, if available. If the account has an encrypted password defined, this field can be set to
170 NULL.
171 .RE
172 .PP
173 options
174 .RS 4
175 A comma\-separated list of miscellaneous account options. See below for more information.
176 .RE
177 .SS "Account options"
178 .PP
179 Depending 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
180 NULL. Otherwise it will be a comma\-separated list of
181 \(lq\fIoption\fR=\fIvalue\fR\(rq
182 settings.
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
190 This 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
192 The 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
200 The application is responsible for enforcing all the
201 \(lqdisabled\(rq
202 option. 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
205 is set. The application's
206 \fBcallback_func\fR
207 should check for this condition, and return a negative return code.
208 .PP
209 disableimap=\fIn\fR
210 .RS 4
211 If "n" is 1, IMAP access to this account should be disabled.
212 .RE
213 .PP
214 disablepop3=\fIn\fR
215 .RS 4
216 If "n" is 1, POP3 access to this account should be disabled.
217 .RE
218 .PP
219 disablewebmail=\fIn\fR
220 .RS 4
221 If "n" is 1, webmail access to this account should be disabled.
222 .RE
223 .PP
224 disableshared=\fIn\fR
225 .RS 4
226 If "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
229 group=\fIname\fR
230 .RS 4
231 This 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
235 The access group name
236 \(lqadministrators\(rq
237 is a reserved group. All accounts in the
238 administrators
239 group 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
246 This option may be specified multiple times to specify that the account belongs to multiple account groups.
247 .RE
248 .PP
249 sharedgroup=\fIname\fR
250 .RS 4
251 Append "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
253 For 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