Revert the disabling of pam_setcred so that IMAP works as expected.
[hcoop/debian/courier-authlib.git] / auth_generic.3
1 .\" <!-- $Id: auth_generic.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_generic
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_GENERIC" "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_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 \fBExample\ 1.\ struct authinfo\fR
91 .sp
92 .RS 4
93 .nf
94 struct authinfo {
95 const char *sysusername;
96 const uid_t *sysuserid;
97 gid_t sysgroupid;
98 const char *homedir;
99
100 const char *address;
101 const char *fullname;
102 const char *maildir;
103 const char *quota;
104 const char *passwd;
105 const char *clearpasswd;
106
107 const char *options;
108
109 } ;
110 .fi
111 .RE
112 .PP
113 Description of the above fields:
114 .PP
115 address
116 .RS 4
117 The authenticated login ID.
118 .RE
119 .PP
120 sysusername
121 .RS 4
122 The authenticated account's userid and groupid can be looked up in the password file using
123 address. If this field is
124 NULL, obtain the userid and the groupid from
125 sysuserid
126 and
127 sysgroupid.
128 .RE
129 .PP
130 sysuserid
131 .RS 4
132
133 sysuserid
134 may be
135 NULL
136 if
137 sysusername
138 is initialized, otherwise it's a pointer to the account's numeric userid.
139 .RE
140 .PP
141 sysgroupid
142 .RS 4
143 Account's numeric groupid.
144 sysgroupid
145 is only used when
146 sysusername
147 is
148 NULL.
149 .RE
150 .PP
151 fullname
152 .RS 4
153 This is the account's full name. This field is optional, it may be
154 NULL.
155 .RE
156 .PP
157 homedir
158 .RS 4
159 The account's home directory. This field cannot be
160 NULL.
161 .RE
162 .PP
163 maildir
164 .RS 4
165 The pathname to the account's mailbox. This field is optional, it can be
166 NULL
167 in which case the default location is assumed.
168 .RE
169 .PP
170 quota
171 .RS 4
172 Optional maildir quota on the account's mailbox (and
173 NULL
174 if no quota is set).
175 .RE
176 .PP
177 passwd
178 .RS 4
179 The account's encrypted password, if available. If the account has a cleartext password defined, this field can be set to
180 NULL. The encrypted password can take several formats:
181 .RS 4
182 \h'-04'\(bu\h'+03'A traditional triple\-DES crypted password, or a MD5+salt\-hashed password, as used in Linux.
183 .RE
184 .RS 4
185 \h'-04'\(bu\h'+03'
186 \(lq{MD5}\(rq
187 followed by a base64\-encoded MD5 hash of the password.
188 .RE
189 .RS 4
190 \h'-04'\(bu\h'+03'
191 \(lq{SHA}\(rq
192 followed by a base64\-encoded SHA1 hash of the password.
193 .RE
194 .RE
195 .PP
196 clearpasswd
197 .RS 4
198 The account's cleartext password, if available. If the account has an encrypted password defined, this field can be set to
199 NULL.
200 .RE
201 .PP
202 options
203 .RS 4
204 A comma\-separated list of miscellaneous account options. See below for more information.
205 .RE
206 .SS "Account options"
207 .PP
208 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
209 NULL. Otherwise it will be a comma\-separated list of
210 \(lq\fIoption\fR=\fIvalue\fR\(rq
211 settings.
212 .sp
213 .it 1 an-trap
214 .nr an-no-space-flag 1
215 .nr an-break-flag 1
216 .br
217 \fBNote\fR
218 .PP
219 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.
220 .PP
221 The following options are recognized by the various Courier packages:
222 .sp
223 .it 1 an-trap
224 .nr an-no-space-flag 1
225 .nr an-break-flag 1
226 .br
227 \fBNote\fR
228 .PP
229 The application is responsible for enforcing all the
230 \(lqdisabled\(rq
231 option. An authentication request for service
232 \(lqimap\(rq, for example, will succeed provided that the userid and the password are valid, even if
233 \(lqdisableimap=1\(rq
234 is set. The application's
235 \fBcallback_func\fR
236 should check for this condition, and return a negative return code.
237 .PP
238 disableimap=\fIn\fR
239 .RS 4
240 If "n" is 1, IMAP access to this account should be disabled.
241 .RE
242 .PP
243 disablepop3=\fIn\fR
244 .RS 4
245 If "n" is 1, POP3 access to this account should be disabled.
246 .RE
247 .PP
248 disablewebmail=\fIn\fR
249 .RS 4
250 If "n" is 1, webmail access to this account should be disabled.
251 .RE
252 .PP
253 disableshared=\fIn\fR
254 .RS 4
255 If "n" is 1, this account should not have access to shared folders or be able to share its own folders with other people.
256 .RE
257 .PP
258 group=\fIname\fR
259 .RS 4
260 This account is a member of access group
261 \fIname\fR. Instead of granting access rights on individual mail folders to individual accounts, the access rights can be granted to an access group
262 \(lqname\(rq, and all members of this group get the specified access rights.
263 .sp
264 The access group name
265 \(lqadministrators\(rq
266 is a reserved group. All accounts in the
267 administrators
268 group automatically receive all rights to all accessible folders.
269 .sp
270 .it 1 an-trap
271 .nr an-no-space-flag 1
272 .nr an-break-flag 1
273 .br
274 \fBNote\fR
275 This option may be specified multiple times to specify that the account belongs to multiple account groups.
276 .RE
277 .PP
278 sharedgroup=\fIname\fR
279 .RS 4
280 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.
281 .sp
282 For technical reasons, group names may not include comma, tab, "/" or "|" characters.
283 .RE
284 .SH "SEE ALSO"
285 .PP
286
287 \fI\fBauthlib\fR(3)\fR\&[2],
288 \fI\fBauth_login\fR(3)\fR\&[1],
289 \fI\fBauth_getuserinfo\fR(3)\fR\&[3],
290 \fI\fBauth_enumerate\fR(3)\fR\&[4],
291 \fI\fBauth_passwd\fR(3)\fR\&[5],
292 \fI\fBauth_getoption\fR(3)\fR\&[6].
293 .SH "REFERENCES"
294 .IP " 1." 4
295 \fBauth_login\fR(3)
296 .RS 4
297 \%auth_login.html
298 .RE
299 .IP " 2." 4
300 \fBauthlib\fR(3)
301 .RS 4
302 \%authlib.html
303 .RE
304 .IP " 3." 4
305 \fBauth_getuserinfo\fR(3)
306 .RS 4
307 \%auth_getuserinfo.html
308 .RE
309 .IP " 4." 4
310 \fBauth_enumerate\fR(3)
311 .RS 4
312 \%auth_enumerate.html
313 .RE
314 .IP " 5." 4
315 \fBauth_passwd\fR(3)
316 .RS 4
317 \%auth_passwd.html
318 .RE
319 .IP " 6." 4
320 \fBauth_getoption\fR(3)
321 .RS 4
322 \%auth_getoption.html
323 .RE