AUTH_GENERIC_META(3) | Double Precision, Inc. | AUTH_GENERIC_META(3) |
auth_generic_meta, auth_generic - Generic authentication request
#include <courierauth.h>
int rc=auth_generic_meta(struct auth_meta *meta, const char *service, const char *authtype, const char *authdata, int (*callback_func) (struct authinfo *, void *), void *callback_arg);
int rc=auth_generic(const char *service, const char *authtype, const char *authdata, int (*callback_func) (struct authinfo *, void *), void *callback_arg);
auth_generic_meta processes a generic authentication request. You do not want to use this function by itself. You really want to use auth_login_meta(3)[1]. service specifies which so-called "service" is being authenticated; like “imap” or “pop3”. service may or may not be used by the Courier authentication library's configured back-end module.
authtype specifies the format of the authentication request. Three authentication formats are defined in courierauth.h:
AUTHTYPE_LOGIN
AUTHTYPE_CRAMMD5 or AUTHTYPE_CRAMSHA1
A NULL meta is equivalent to using the default auth_meta returned by auth_meta_init_default(3)[2].
auth_generic_meta() should not be used by itself, but only together with auth_sasl_ex(3)[3].
auth_generic() is deprecated and should not be used in new code.
callback_func will be invoked if auth_generic_meta succeeds, and callback_func's return value becomes the return value from auth_generic_meta (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_meta. 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:
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
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 a NULL value. Otherwise it will be a comma-separated list of “option=value” settings.
The application is responsible for actually implementing the options. For example, sn 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.
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:
disableimap=n
disablepop3=n
disableinsecureimap=n
disableinsecurepop3=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.
sharedgroup=name
For technical reasons, group names may not include comma, tab, "/" or "|" characters.
authlib(3)[4], auth_meta(3)[2], auth_login_meta(3)[1], auth_getuserinfo_meta(3)[5], auth_enumerate(3)[6], auth_passwd(3)[7], auth_getoption(3)[8].
10/28/2020 | Double Precision, Inc. |