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