1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244
|
.\" <!-- $Id: auth_generic.sgml,v 1.1 2004/10/21 00:10:49 mrsam Exp $ -->
.\" <!-- Copyright 2004 Double Precision, Inc. See COPYING for -->
.\" <!-- distribution information. -->
.\" This manpage has been automatically generated by docbook2man
.\" from a DocBook document. This tool can be found at:
.\" <http://shell.ipoline.com/~elmert/comp/docbook2X/>
.\" Please send any bug reports, improvements, comments, patches,
.\" etc. to Steve Cheng <steve@ggi-project.org>.
.TH "AUTH_GENERIC" "3" "15 July 2005" "Double Precision, Inc." ""
.SH NAME
auth_generic \- Generic authentication request
.SH SYNOPSIS
.nf
#include <courierauth.h>
.fi
.sp
\fB
.sp
int rc=auth_generic (const char *\fIservice\fB, const char *\fIauthtype\fB, const char *\fIauthdata\fB, int (*\fIcallback_func\fB)(struct authinfo *, void *), void *\fIcallback_arg\fB);
\fR
.SH "DESCRIPTION"
.PP
\fBauth_generic\fR processes a generic authentication request.
You do not want to use this function.
You really want to use
\fBauth_login\fR(3)\&.
\fIservice\fR specifies which so-called "service" is
being authenticated; like ``imap'' or ``pop3''\&.
\fIservice\fR may or may not be used by the Courier
authentication library's configured back-end module.
.PP
\fBauthtype\fR specifies the format of the authentication
request.
Three authentication formats are defined in
\fIcourierauth.h\fR:
.TP
\fBAUTHTYPE_LOGIN\fR
\fIauthdata\fR contains the following string:
``\fIuserid\fR\\n\fIpassword\fR\\n''\&.
That is, the userid being authenticated, an ASCII
newline character, the password, and a second newline character.
.TP
\fBAUTHTYPE_CRAMMD5 or AUTHTYPE_CRAMSHA1\fR
This format is used
with CRAM-MD5 or CRAM-SHA1\&.
\fIauthdata\fR contains the following string:
``\fIchallenge\fR\\n\fIresponse\fR\\n''\&.
\fIchallenge\fR is the base64-encoded challenge, which
is followed by an ASCII
newline character.
\fIresponse\fR 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.
.SH "RETURNS"
.PP
\fBcallback_func\fR will be invoked if
\fBauth_generic\fR
succeeds, and \fBcallback_func\fR\&'s return value becomes
the return value from \fBauth_generic\fR (which should be 0, by convention).
\fBcallback_func\fR will not be invoked if an error occurs,
which is reported by a non-zero return value from \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.
.PP
The second argument to \fBcallback_func\fR will be
\fBcallback_arg\fR, which is not interpreted by this
function in any way.
The first argument will be a pointer to the following structure:
.sp
.RS
.SS "STRUCT AUTHINFO"
.nf
struct authinfo {
const char *sysusername;
const uid_t *sysuserid;
gid_t sysgroupid;
const char *homedir;
const char *address;
const char *fullname;
const char *maildir;
const char *quota;
const char *passwd;
const char *clearpasswd;
const char *options;
} ;
.fi
.RE
.PP
Description of the above fields:
.TP
\fBaddress\fR
The authenticated login ID.
.TP
\fBsysusername\fR
The authenticated account's userid and groupid can be looked up in the
password file using address\&.
If this field is NULL, obtain the userid and the groupid from
sysuserid and sysgroupid\&.
.TP
\fBsysuserid\fR
sysuserid may be NULL if
sysusername is initialized, otherwise it's a pointer to
the account's numeric userid.
.TP
\fBsysgroupid\fR
Account's numeric groupid.
sysgroupid is only used when sysusername
is NULL\&.
.TP
\fBfullname\fR
This is the account's full name.
This field is optional, it may be NULL\&.
.TP
\fBhomedir\fR
The account's home directory.
This field cannot be NULL\&.
.TP
\fBmaildir\fR
The pathname to the account's mailbox.
This field is optional, it can be NULL in which case the
default location is assumed.
.TP
\fBquota\fR
Optional maildir quota on the account's mailbox (and NULL
if no quota is set).
.TP
\fBpasswd\fR
The account's encrypted password, if available.
If the account has a cleartext password defined, this field
can be set to NULL\&.
The encrypted password can take several formats:
.RS
.TP 0.2i
\(bu
A traditional triple-DES crypted password, or a MD5+salt-hashed password,
as used in Linux.
.TP 0.2i
\(bu
``{MD5}'' followed by a base64-encoded MD5 hash
of the password.
.TP 0.2i
\(bu
``{SHA}'' followed by a base64-encoded SHA1 hash
of the password.
.RE
.TP
\fBclearpasswd\fR
The account's cleartext password, if available.
If the account has an encrypted password defined, this field
can be set to NULL\&.
.TP
\fBoptions\fR
A comma-separated list of miscellaneous account options.
See below for more information.
.SS "ACCOUNT OPTIONS"
.PP
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 NULL\&.
Otherwise it will be a comma-separated list of
``\fIoption\fR=\fIvalue\fR''
settings.
.sp
.RS
.B "Note:"
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.
.RE
.PP
The following options are recognized by the various Courier
packages:
.sp
.RS
.B "Note:"
The application is responsible for enforcing all the ``disabled''
option.
An authentication request for service ``imap'', for example,
will succeed provided that the userid and the password are valid,
even if ``disableimap=1'' is set.
The application's \fBcallback_func\fR should check for this
condition, and return a negative return code.
.RE
.TP
\fBdisableimap=\fIn\fB\fR
If "n" is 1, IMAP access to this account should be disabled.
.TP
\fBdisablepop3=\fIn\fB\fR
If "n" is 1, POP3 access to this account should be disabled.
.TP
\fBdisablewebmail=\fIn\fB\fR
If "n" is 1, webmail access to this account should be disabled.
.TP
\fBdisableshared=\fIn\fB\fR
If "n" is 1, this account should not have access to shared folders or be able
to share its own folders with other people.
.TP
\fBgroup=\fIname\fB\fR
This account is a member of access group
\fIname\fR\&.
Instead of granting access rights on individual mail folders to individual
accounts, the access rights can be granted to an access group
``name'', and all members of this group get the specified access
rights.
The access group name ``administrators'' is a reserved group.
All accounts in the administrators group automatically
receive all rights to all accessible folders.
.sp
.RS
.B "Note:"
This option may be specified multiple times to specify that the account
belongs to multiple account groups.
.RE
.TP
\fBsharedgroup=\fIname\fB\fR
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.
For technical reasons, group names may not include comma, tab, "/" or "|"
characters.
.SH "SEE ALSO"
.PP
\fBauthlib\fR(3),
\fBauth_login\fR(3),
\fBauth_getuserinfo\fR(3),
\fBauth_enumerate\fR(3),
\fBauth_passwd\fR(3),
\fBauth_getoption\fR(3)\&.
|