#include <courierauth.h>
callback_func will be invoked if userid exists, and callback_func's return value becomes the return value from auth_getuserinfo (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_getuserinfo. 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 userid does not exist.
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:
address
sysusername
sysuserid
sysuserid may be NULL if sysusername is initialized, otherwise it's a pointer to the account's numeric userid.
sysgroupid
fullname
homedir
maildir
quota
passwd
clearpasswd
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 NULL. Otherwise it will be a comma-separated list of "option=value" settings.
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.
The following options are recognized by the various Courier packages:
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 callback_func should check for this condition, and return a negative return code.
disableimap=n
disablepop3=n
disablewebmail=n
disableshared=n
group=name
The access group name "administrators" is a reserved group. All accounts in the administrators group automatically receive all rights to all accessible folders.
Note
This option may be specified multiple times to specify that the account belongs to multiple account groups.
sharedgroup=name
For technical reasons, group names may not include comma, tab, "/" or "|" characters.
authlib(3)[1], auth_generic(3)[2], auth_login(3)[3], auth_enumerate(3)[4], auth_passwd(3)[5], auth_getoption(3)[6].