Imported Upstream version 0.63.0
[hcoop/debian/courier-authlib.git] / auth_generic.3
1 .\" <!-- $Id: auth_generic.sgml,v 1.4 2007/07/21 20:05:53 mrsam Exp $ -->
2 .\" <!-- Copyright 2004 Double Precision, Inc. See COPYING for -->
3 .\" <!-- distribution information. -->
4 .\" Title: auth_generic
5 .\" Author:
6 .\" Generator: DocBook XSL Stylesheets v1.73.2 <http://docbook.sf.net/>
7 .\" Date: 08/23/2008
8 .\" Manual: Double Precision, Inc.
9 .\" Source: Double Precision, Inc.
10 .\"
11 .TH "AUTH_GENERIC" "3" "08/23/2008" "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_generic - Generic authentication request
18 .SH "SYNOPSIS"
19 .sp
20 .RS 4
21 .nf
22 #include <courierauth\.h>
23 .fi
24 .RE
25 .HP 20
26 .BI "int rc=auth_generic(const\ char\ *" "service" ", const\ char\ *" "authtype" ", const\ char\ *" "authdata" ", int\ " "(*callback_func)" "\ (struct\ authinfo\ *,\ void\ *), void\ *" "callback_arg" ");"
27 .SH "DESCRIPTION"
28 .PP
29
30 \fBauth_generic\fR
31 processes a generic authentication request\. You do not want to use this function\. You really want to use
32 \fI\fBauth_login\fR(3)\fR\&[1]\.
33 \fIservice\fR
34 specifies which so\-called "service" is being authenticated; like
35 \(lqimap\(rq
36 or
37 \(lqpop3\(rq\.
38 \fIservice\fR
39 may or may not be used by the Courier authentication library\'s configured back\-end module\.
40 .PP
41
42 \fBauthtype\fR
43 specifies the format of the authentication request\. Three authentication formats are defined in
44 \fIcourierauth\.h\fR:
45 .PP
46 AUTHTYPE_LOGIN
47 .RS 4
48
49 \fIauthdata\fR
50 contains the following string:
51 \(lq\fIuserid\fR\en\fIpassword\fR\en\(rq\. That is, the userid being authenticated, an
52 ASCII
53 newline character, the password, and a second newline character\.
54 .RE
55 .PP
56 AUTHTYPE_CRAMMD5 or AUTHTYPE_CRAMSHA1
57 .RS 4
58 This format is used with
59 CRAM\-MD5
60 or
61 CRAM\-SHA1\.
62 \fIauthdata\fR
63 contains the following string:
64 \(lq\fIchallenge\fR\en\fIresponse\fR\en\(rq\.
65 \fIchallenge\fR
66 is the base64\-encoded challenge, which is followed by an
67 ASCII
68 newline character\.
69 \fIresponse\fR
70 is a base64\-encoded string that\'s followed by a second newline character\. The base64\-encoded string consists of the responding userid, a space character, then the response to the challenge expressed as hexadecimal digits\.
71 .RE
72 .SH "RETURNS"
73 .PP
74
75 \fBcallback_func\fR
76 will be invoked if
77 \fBauth_generic\fR
78 succeeds, and
79 \fBcallback_func\fR\'s return value becomes the return value from
80 \fBauth_generic\fR
81 (which should be 0, by convention)\.
82 \fBcallback_func\fR
83 will not be invoked if an error occurs, which is reported by a non\-zero return value from
84 \fBauth_generic\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\.
85 .PP
86 The second argument to
87 \fBcallback_func\fR
88 will be
89 \fBcallback_arg\fR, which is not interpreted by this function in any way\. The first argument will be a pointer to the following structure:
90 .PP
91 \fBExample\ 1.\ struct authinfo\fR
92 .sp
93 .RS 4
94 .nf
95 struct authinfo {
96 const char *sysusername;
97 const uid_t *sysuserid;
98 gid_t sysgroupid;
99 const char *homedir;
100
101 const char *address;
102 const char *fullname;
103 const char *maildir;
104 const char *quota;
105 const char *passwd;
106 const char *clearpasswd;
107
108 const char *options;
109
110 } ;
111 .fi
112 .RE
113 .PP
114 Description of the above fields:
115 .PP
116 address
117 .RS 4
118 The authenticated login ID\.
119 .RE
120 .PP
121 sysusername
122 .RS 4
123 The authenticated account\'s userid and groupid can be looked up in the password file using
124 address\. If this field is
125 NULL, obtain the userid and the groupid from
126 sysuserid
127 and
128 sysgroupid\.
129 .RE
130 .PP
131 sysuserid
132 .RS 4
133
134 sysuserid
135 may be
136 NULL
137 if
138 sysusername
139 is initialized, otherwise it\'s a pointer to the account\'s numeric userid\.
140 .RE
141 .PP
142 sysgroupid
143 .RS 4
144 Account\'s numeric groupid\.
145 sysgroupid
146 is only used when
147 sysusername
148 is
149 NULL\.
150 .RE
151 .PP
152 fullname
153 .RS 4
154 This is the account\'s full name\. This field is optional, it may be
155 NULL\.
156 .RE
157 .PP
158 homedir
159 .RS 4
160 The account\'s home directory\. This field cannot be
161 NULL\.
162 .RE
163 .PP
164 maildir
165 .RS 4
166 The pathname to the account\'s mailbox\. This field is optional, it can be
167 NULL
168 in which case the default location is assumed\.
169 .RE
170 .PP
171 quota
172 .RS 4
173 Optional maildir quota on the account\'s mailbox (and
174 NULL
175 if no quota is set)\.
176 .RE
177 .PP
178 passwd
179 .RS 4
180 The account\'s encrypted password, if available\. If the account has a cleartext password defined, this field can be set to
181 NULL\. The encrypted password can take several formats:
182 .sp
183 .RS 4
184 \h'-04'\(bu\h'+03'A traditional triple\-DES crypted password, or a MD5+salt\-hashed password, as used in Linux\.
185 .RE
186 .sp
187 .RS 4
188 \h'-04'\(bu\h'+03'
189 \(lq{MD5}\(rq
190 followed by a base64\-encoded MD5 hash of the password\.
191 .RE
192 .sp
193 .RS 4
194 \h'-04'\(bu\h'+03'
195 \(lq{SHA}\(rq
196 followed by a base64\-encoded SHA1 hash of the password\.
197 .RE
198 .RE
199 .PP
200 clearpasswd
201 .RS 4
202 The account\'s cleartext password, if available\. If the account has an encrypted password defined, this field can be set to
203 NULL\.
204 .RE
205 .PP
206 options
207 .RS 4
208 A comma\-separated list of miscellaneous account options\. See below for more information\.
209 .RE
210 .SS "Account options"
211 .PP
212 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
213 NULL\. Otherwise it will be a comma\-separated list of
214 \(lq\fIoption\fR=\fIvalue\fR\(rq
215 settings\.
216 .sp
217 .it 1 an-trap
218 .nr an-no-space-flag 1
219 .nr an-break-flag 1
220 .br
221 Note
222 .PP
223 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\.
224 .PP
225 The following options are recognized by the various Courier packages:
226 .sp
227 .it 1 an-trap
228 .nr an-no-space-flag 1
229 .nr an-break-flag 1
230 .br
231 Note
232 .PP
233 The application is responsible for enforcing all the
234 \(lqdisabled\(rq
235 option\. An authentication request for service
236 \(lqimap\(rq, for example, will succeed provided that the userid and the password are valid, even if
237 \(lqdisableimap=1\(rq
238 is set\. The application\'s
239 \fBcallback_func\fR
240 should check for this condition, and return a negative return code\.
241 .PP
242 disableimap=\fIn\fR
243 .RS 4
244 If "n" is 1, IMAP access to this account should be disabled\.
245 .RE
246 .PP
247 disablepop3=\fIn\fR
248 .RS 4
249 If "n" is 1, POP3 access to this account should be disabled\.
250 .RE
251 .PP
252 disablewebmail=\fIn\fR
253 .RS 4
254 If "n" is 1, webmail access to this account should be disabled\.
255 .RE
256 .PP
257 disableshared=\fIn\fR
258 .RS 4
259 If "n" is 1, this account should not have access to shared folders or be able to share its own folders with other people\.
260 .RE
261 .PP
262 group=\fIname\fR
263 .RS 4
264 This account is a member of access group
265 \fIname\fR\. Instead of granting access rights on individual mail folders to individual accounts, the access rights can be granted to an access group
266 \(lqname\(rq, and all members of this group get the specified access rights\.
267 .sp
268 The access group name
269 \(lqadministrators\(rq
270 is a reserved group\. All accounts in the
271 administrators
272 group automatically receive all rights to all accessible folders\.
273 .sp
274 .it 1 an-trap
275 .nr an-no-space-flag 1
276 .nr an-break-flag 1
277 .br
278 Note
279 This option may be specified multiple times to specify that the account belongs to multiple account groups\.
280 .RE
281 .PP
282 sharedgroup=\fIname\fR
283 .RS 4
284 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\.
285 .sp
286 For technical reasons, group names may not include comma, tab, "/" or "|" characters\.
287 .RE
288 .SH "SEE ALSO"
289 .PP
290
291 \fI\fBauthlib\fR(3)\fR\&[2],
292 \fI\fBauth_login\fR(3)\fR\&[1],
293 \fI\fBauth_getuserinfo\fR(3)\fR\&[3],
294 \fI\fBauth_enumerate\fR(3)\fR\&[4],
295 \fI\fBauth_passwd\fR(3)\fR\&[5],
296 \fI\fBauth_getoption\fR(3)\fR\&[6]\.
297 .SH "NOTES"
298 .IP " 1." 4
299 \fBauth_login\fR(3)
300 .RS 4
301 \%auth_login.html
302 .RE
303 .IP " 2." 4
304 \fBauthlib\fR(3)
305 .RS 4
306 \%authlib.html
307 .RE
308 .IP " 3." 4
309 \fBauth_getuserinfo\fR(3)
310 .RS 4
311 \%auth_getuserinfo.html
312 .RE
313 .IP " 4." 4
314 \fBauth_enumerate\fR(3)
315 .RS 4
316 \%auth_enumerate.html
317 .RE
318 .IP " 5." 4
319 \fBauth_passwd\fR(3)
320 .RS 4
321 \%auth_passwd.html
322 .RE
323 .IP " 6." 4
324 \fBauth_getoption\fR(3)
325 .RS 4
326 \%auth_getoption.html
327 .RE