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