Import Debian package 0.61.0-1+lenny1
[hcoop/debian/courier-authlib.git] / auth_generic.html
CommitLineData
d9898ee8 1<?xml version="1.0"?>
2<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/><title>auth_generic</title><link rel="stylesheet" href="style.css" type="text/css"/><meta name="generator" content="DocBook XSL Stylesheets V1.72.0"/><link rel="start" href="#auth-generic" title="auth_generic"/><link xmlns="" rel="stylesheet" type="text/css" href="manpage.css"/><meta xmlns="" name="MSSmartTagsPreventParsing" content="TRUE"/><link xmlns="" rel="icon" href="icon.gif" type="image/gif"/><!--
3
4Copyright 1998 - 2007 Double Precision, Inc. See COPYING for distribution
5information.
6
7--></head><body><div class="refentry" lang="en" xml:lang="en"><a id="auth-generic" shape="rect"> </a><div class="titlepage"/><div class="refnamediv"><h2>Name</h2><p>auth_generic — Generic authentication request</p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><div class="literallayout"><p><br clear="none"/>
8#include &lt;courierauth.h&gt;<br clear="none"/>
64ff59ba 9</p></div><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0"><tr><td rowspan="1" colspan="1"><code class="funcdef">int rc=<b class="fsfunc">auth_generic</b>(</code></td><td rowspan="1" colspan="1">const char * </td><td rowspan="1" colspan="1"><var class="pdparam">service</var>, </td></tr><tr><td rowspan="1" colspan="1"> </td><td rowspan="1" colspan="1">const char * </td><td rowspan="1" colspan="1"><var class="pdparam">authtype</var>, </td></tr><tr><td rowspan="1" colspan="1"> </td><td rowspan="1" colspan="1">const char * </td><td rowspan="1" colspan="1"><var class="pdparam">authdata</var>, </td></tr><tr><td rowspan="1" colspan="1"> </td><td rowspan="1" colspan="1">int  </td><td rowspan="1" colspan="1"><var class="pdparam">(*callback_func)</var><code>(</code>struct authinfo *, void *<code>)</code>, </td></tr><tr><td rowspan="1" colspan="1"> </td><td rowspan="1" colspan="1">void * </td><td rowspan="1" colspan="1"><var class="pdparam">callback_arg</var><code>)</code>;</td></tr></table></div></div><div class="refsect1" lang="en" xml:lang="en"><a id="id282334" shape="rect"> </a><h2>DESCRIPTION</h2><p>
d9898ee8 10<code class="function">auth_generic</code> processes a generic authentication request.
11You do not want to use this function.
12You really want to use
13<a href="auth_login.html" target="_top" shape="rect"><span class="citerefentry"><span class="refentrytitle">auth_login</span>(3)</span></a>.
14<em class="parameter"><code>service</code></em> specifies which so-called "service" is
15being authenticated; like “<span class="quote">imap</span>” or “<span class="quote">pop3</span>”.
16<em class="parameter"><code>service</code></em> may or may not be used by the Courier
17authentication library's configured back-end module.</p><p>
18<code class="function">authtype</code> specifies the format of the authentication
19request.
20Three authentication formats are defined in
21<code class="filename">courierauth.h</code>:</p><div class="variablelist"><dl><dt><span class="term"><code class="literal">AUTHTYPE_LOGIN</code></span></dt><dd><p>
22<em class="parameter"><code>authdata</code></em> contains the following string:
23“<span class="quote"><em class="replaceable"><code>userid</code></em>\n<em class="replaceable"><code>password</code></em>\n</span>”.
24That is, the userid being authenticated, an <acronym class="acronym">ASCII</acronym>
25newline character, the password, and a second newline character.</p></dd><dt><span class="term"><code class="literal">AUTHTYPE_CRAMMD5</code> or <code class="literal">AUTHTYPE_CRAMSHA1</code></span></dt><dd><p>
26This format is used
27with <acronym class="acronym">CRAM-MD5</acronym> or <acronym class="acronym">CRAM-SHA1</acronym>.
28<em class="parameter"><code>authdata</code></em> contains the following string:
29“<span class="quote"><em class="replaceable"><code>challenge</code></em>\n<em class="replaceable"><code>response</code></em>\n</span>”.
30<em class="replaceable"><code>challenge</code></em> is the base64-encoded challenge, which
31is followed by an <acronym class="acronym">ASCII</acronym>
32newline character.
33<em class="replaceable"><code>response</code></em> is a base64-encoded string that's
34followed by a second newline character.
35The base64-encoded string consists of the responding userid, a space
36character, then the response to the challenge expressed as hexadecimal
64ff59ba 37digits.</p></dd></dl></div></div><div class="refsect1" lang="en" xml:lang="en"><a id="id282687" shape="rect"> </a><h2>RETURNS</h2><p>
d9898ee8 38<code class="function">callback_func</code> will be invoked if
39<code class="function">auth_generic</code>
40succeeds, and <code class="function">callback_func</code>'s return value becomes
41the return value from <code class="function">auth_generic</code> (which should be 0, by convention).
42<code class="function">callback_func</code> will not be invoked if an error occurs,
43which is reported by a non-zero return value from <code class="function">auth_generic</code>.
44By convention, a positive return value indicates an internal, temporary
45failure, such as the authentication daemon process not running; a negative
46return value indicates that this request was processed, but it failed.</p><p>
47The second argument to <code class="function">callback_func</code> will be
48<code class="function">callback_arg</code>, which is not interpreted by this
49function in any way.
64ff59ba 50The first argument will be a pointer to the following structure:</p><div class="blockquote"><blockquote class="blockquote"><div class="example"><a id="id281965" shape="rect"> </a><p class="title"><b>Example 1. struct authinfo</b></p><div class="example-contents"><pre class="programlisting" xml:space="preserve">
d9898ee8 51struct authinfo {
52 const char *sysusername;
53 const uid_t *sysuserid;
54 gid_t sysgroupid;
55 const char *homedir;
56
57 const char *address;
58 const char *fullname;
59 const char *maildir;
60 const char *quota;
61 const char *passwd;
62 const char *clearpasswd;
63
64 const char *options;
65
66 } ;
67</pre></div></div><br class="example-break" clear="none"/></blockquote></div><p>
68Description of the above fields:</p><div class="variablelist"><dl><dt><span class="term">address</span></dt><dd><p>
69The authenticated login ID.</p></dd><dt><span class="term">sysusername</span></dt><dd><p>
70The authenticated account's userid and groupid can be looked up in the
71password file using <code class="literal">address</code>.
72If this field is <code class="literal">NULL</code>, obtain the userid and the groupid from
73<code class="literal">sysuserid</code> and <code class="literal">sysgroupid</code>.</p></dd><dt><span class="term">sysuserid</span></dt><dd><p>
74<code class="literal">sysuserid</code> may be <code class="literal">NULL</code> if
75<code class="literal">sysusername</code> is initialized, otherwise it's a pointer to
76the account's numeric userid.</p></dd><dt><span class="term">sysgroupid</span></dt><dd><p>
77Account's numeric groupid.
78<code class="literal">sysgroupid</code> is only used when <code class="literal">sysusername</code>
79is <code class="literal">NULL</code>.</p></dd><dt><span class="term">fullname</span></dt><dd><p>
80This is the account's full name.
81This field is optional, it may be <code class="literal">NULL</code>.</p></dd><dt><span class="term">homedir</span></dt><dd><p>
82The account's home directory.
83This field cannot be <code class="literal">NULL</code>.</p></dd><dt><span class="term">maildir</span></dt><dd><p>
84The pathname to the account's mailbox.
85This field is optional, it can be <code class="literal">NULL</code> in which case the
86default location is assumed.</p></dd><dt><span class="term">quota</span></dt><dd><p>
87Optional maildir quota on the account's mailbox (and <code class="literal">NULL</code>
88if no quota is set).</p></dd><dt><span class="term">passwd</span></dt><dd><p>
89The account's encrypted password, if available.
90If the account has a cleartext password defined, this field
91can be set to <code class="literal">NULL</code>.
92The encrypted password can take several formats:</p><div class="itemizedlist"><ul type="disc"><li><p>
93A traditional triple-DES crypted password, or a MD5+salt-hashed password,
94as used in Linux.</p></li><li><p>
95“<span class="quote">{MD5}</span>” followed by a base64-encoded MD5 hash
96of the password.</p></li><li><p>
97“<span class="quote">{SHA}</span>” followed by a base64-encoded SHA1 hash
98of the password.</p></li></ul></div></dd><dt><span class="term">clearpasswd</span></dt><dd><p>
99The account's cleartext password, if available.
100If the account has an encrypted password defined, this field
101can be set to <code class="literal">NULL</code>.</p></dd><dt><span class="term">options</span></dt><dd><p>
102A comma-separated list of miscellaneous account options.
64ff59ba 103See below for more information.</p></dd></dl></div><div class="refsect2" lang="en" xml:lang="en"><a id="id325784" shape="rect"> </a><h3>Account options</h3><p>
d9898ee8 104Depending on the configuration of the Courier authentication library,
105accounts may have individual options associated with them.
106If the authentication library configuration does not implement account
107options, the option string will be <code class="literal">NULL</code>.
108Otherwise it will be a comma-separated list of
109“<span class="quote"><em class="replaceable"><code>option</code></em>=<em class="replaceable"><code>value</code></em></span>”
110settings.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>
111This is the account option implementation
112that's used by Courier, Courier-IMAP, and
113SqWebMail packages. Some of the following information is obviously
114not applicable for a particular package.
115The inapplicable bits should be obvious.</p></div><p>
116The following options are recognized by the various Courier
117packages:</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>
118The application is responsible for enforcing all the “<span class="quote">disabled</span>”
119option.
120An authentication request for service “<span class="quote">imap</span>”, for example,
121will succeed provided that the userid and the password are valid,
122even if “<span class="quote">disableimap=1</span>” is set.
123The application's <code class="function">callback_func</code> should check for this
124condition, and return a negative return code.</p></div><div class="variablelist"><dl><dt><span class="term"><code class="literal">disableimap=</code><em class="replaceable"><code>n</code></em></span></dt><dd><p>
125If "n" is 1, IMAP access to this account should be disabled.</p></dd><dt><span class="term"><code class="literal">disablepop3=</code><em class="replaceable"><code>n</code></em></span></dt><dd><p>
126If "n" is 1, POP3 access to this account should be disabled.</p></dd><dt><span class="term"><code class="literal">disablewebmail=</code><em class="replaceable"><code>n</code></em></span></dt><dd><p>
127If "n" is 1, webmail access to this account should be disabled.</p></dd><dt><span class="term"><code class="literal">disableshared=</code><em class="replaceable"><code>n</code></em></span></dt><dd><p>
128If "n" is 1, this account should not have access to shared folders or be able
129to share its own folders with other people.</p></dd><dt><span class="term"><code class="literal">group=</code><em class="replaceable"><code>name</code></em></span></dt><dd><p>
130This account is a member of access group
131<em class="replaceable"><code>name</code></em>.
132Instead of granting access rights on individual mail folders to individual
133accounts, the access rights can be granted to an access group
134“<span class="quote">name</span>”, and all members of this group get the specified access
135rights.</p><p>
136The access group name “<span class="quote">administrators</span>” is a reserved group.
137All accounts in the <code class="literal">administrators</code> group automatically
138receive all rights to all accessible folders.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>
139This option may be specified multiple times to specify that the account
140belongs to multiple account groups.</p></div></dd><dt><span class="term"><code class="literal">sharedgroup=</code><em class="replaceable"><code>name</code></em></span></dt><dd><p>
141Append "name" to the name of the top level virtual shared folder
142index file. This setting restricts which virtual shared folders this
143account could possibly access (and that's on top of whatever else the
144access control lists say). See the virtual shared folder documentation
145for more information.</p><p>
146For technical reasons, group names may not include comma, tab, "/" or "|"
64ff59ba 147characters.</p></dd></dl></div></div></div><div class="refsect1" lang="en" xml:lang="en"><a id="id326282" shape="rect"> </a><h2>SEE ALSO</h2><p>
d9898ee8 148<a href="authlib.html" target="_top" shape="rect"><span class="citerefentry"><span class="refentrytitle">authlib</span>(3)</span></a>,
149
150<a href="auth_login.html" target="_top" shape="rect"><span class="citerefentry"><span class="refentrytitle">auth_login</span>(3)</span></a>,
151
152<a href="auth_getuserinfo.html" target="_top" shape="rect"><span class="citerefentry"><span class="refentrytitle">auth_getuserinfo</span>(3)</span></a>,
153
154<a href="auth_enumerate.html" target="_top" shape="rect"><span class="citerefentry"><span class="refentrytitle">auth_enumerate</span>(3)</span></a>,
155
156<a href="auth_passwd.html" target="_top" shape="rect"><span class="citerefentry"><span class="refentrytitle">auth_passwd</span>(3)</span></a>,
157
158<a href="auth_getoption.html" target="_top" shape="rect"><span class="citerefentry"><span class="refentrytitle">auth_getoption</span>(3)</span></a>.</p></div></div></body></html>