Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Contact Us
Online Help
Domain Status
Man Pages

Virtual Servers

Topology Map

Server Agreement
Year 2038

USA Flag



Man Pages

Manual Reference Pages  -  AUTH_GENERIC (3)

--> --> .ds Aq ’


auth_generic - Generic authentication request



#include <courierauth.h>

int rc=auth_generic(const char *service, const char *authtype, const char *authdata, int (*callback_func) (struct authinfo *, void *), void *callback_arg);


auth_generic processes a generic authentication request. You do not want to use this function. You really want to use \m[blue]auth_login(3)\m[][1]. service specifies which so-called "service" is being authenticated; like \(lqimap\(rq or \(lqpop3\(rq. service may or may not be used by the Courier authentication librarys configured back-end module.

authtype specifies the format of the authentication request. Three authentication formats are defined in courierauth.h:


authdata contains the following string: \(lquserid\npassword\n\(rq. That is, the userid being authenticated, an ASCII newline character, the password, and a second newline character.


This format is used with CRAM-MD5 or CRAM-SHA1. authdata contains the following string: \(lqchallenge\nresponse\n\(rq. challenge is the base64-encoded challenge, which is followed by an ASCII newline character. response is a base64-encoded string thats 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.


callback_func will be invoked if auth_generic succeeds, and callback_funcs return value becomes the return value from auth_generic (which should be 0, by convention). callback_func will not be invoked if an error occurs, which is reported by a non-zero return value from auth_generic. 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.

The second argument to callback_func will be callback_arg, which is not interpreted by this function in any way. The first argument will be a pointer to the following structure:

Example 1. struct authinfo

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;

        } ;

Description of the above fields:


The authenticated login ID.


The authenticated accounts 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.


sysuserid may be NULL if sysusername is initialized, otherwise its a pointer to the accounts numeric userid.


Accounts numeric groupid. sysgroupid is only used when sysusername is NULL.


This is the accounts full name. This field is optional, it may be NULL.


The accounts home directory. This field cannot be NULL.


The pathname to the accounts mailbox. This field is optional, it can be NULL in which case the default location is assumed.


Optional maildir quota on the accounts mailbox (and NULL if no quota is set).


The accounts 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:


o A traditional triple-DES crypted password, or a MD5+salt-hashed password, as used in Linux.


o \(lq{MD5}\(rq followed by a base64-encoded MD5 hash of the password.


o \(lq{SHA}\(rq followed by a base64-encoded SHA1 hash of the password.


The accounts cleartext password, if available. If the account has an encrypted password defined, this field can be set to NULL.


A comma-separated list of miscellaneous account options. See below for more information.

    Account options

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 a NULL value. Otherwise it will be a comma-separated list of \(lqoption=value\(rq settings.


The application is responsible for actually implementing the options. For example, sn authentication request for service \(lqimap\(rq, for example, will succeed provided that the userid and the password are valid, even if \(lqdisableimap=1\(rq is set. The applications callback_func should check for this condition, and return a negative return code.


The following list of account options is a combined list of implemented options supported 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.

The following options are recognized by the various Courier packages:


If "n" is 1, IMAP access to this account should be disabled.


If "n" is 1, POP3 access to this account should be disabled.


If "n" is 1, unencrypted IMAP access to this account should be disabled.


If "n" is 1, unencrypted POP3 access to this account should be disabled.


If "n" is 1, webmail access to this account should be disabled.


If "n" is 1, this account should not have access to shared folders or be able to share its own folders with other people.


This option is used by Courier-IMAP in calculating access control lists. This option places the account as a member of access group name. Instead of granting access rights on individual mail folders to individual accounts, the access rights can be granted to an access group \(lqname\(rq, and all members of this group get the specified access rights.

The access group name \(lqadministrators\(rq is a reserved group. All accounts in the administrators group automatically receive all rights to all accessible folders.

This option may be specified multiple times to specify that the account belongs to multiple account groups.


Another option used by Courier-IMAP. 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 thats 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.


\m[blue]authlib(3)\m[][2], \m[blue]auth_login(3)\m[][1], \m[blue]auth_getuserinfo(3)\m[][3], \m[blue]auth_enumerate(3)\m[][4], \m[blue]auth_passwd(3)\m[][5], \m[blue]auth_getoption(3)\m[][6].


1. auth_login(3)
2. authlib(3)
3. auth_getuserinfo(3)
4. auth_enumerate(3)
5. auth_passwd(3)
6. auth_getoption(3)
Search for    or go to Top of page |  Section 3 |  Main Index

Double Precision, Inc. AUTH_GENERIC (3) 06/20/2015

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.