Next: Initializing libmuauth, Up: libmuauth
This is a pointer to authentication or authorization data. It is defined as follows:
typedef int (*mu_auth_fp) (struct mu_auth_data **return_data, void *key, void *func_data, void *call_data);Its arguments are:
- return_data
- Upon successful return authorization handler leaves in this memory location a pointer to the filled
mu_auth_data
structure with the user's information.For authentication handlers this argument is always
NULL
and should be ignored.- key
- The search key value. Its actual type depends upon type of the handler.
For authorization handlers it is
const char*
if the handler is called bymu_get_auth_by_name()
anduid_t *
if it is called bymu_get_auth_by_uid()
.For authentication handlers it is always
struct mu_auth_data*
representing the user's data obtained by a previous call to amu_get_auth_by_...
function.- func_data
- Any data associated with this handler.
- call_data
- Any call specific data. This argument is not used at the moment.
The
mu_auth_data
is used to return the information about the user. It is similar to systemstruct passwd
, except that it is more mailutils-specific. Its definition is:struct mu_auth_data { /* These are from struct passwd */ char *name; /* user name */ char *passwd; /* user password */ uid_t uid; /* user id */ gid_t gid; /* group id */ char *gecos; /* real name */ char *dir; /* home directory */ char *shell; /* shell program */ /* */ char *mailbox; /* Path to the user's system mailbox */ int change_uid; /* Should the uid be changed? */ };
The
mu_auth_module
structure contains full information about a libmuauth module. It is declared as follows:struct mu_auth_module { char *name; /* Module name */ struct argp *argp; /* Corresponding argp structure */ mu_auth_fp authenticate; /* Authentication function ... */ void *authenticate_data; /* ... and its specific data */ mu_auth_fp auth_by_name; /* Get user info by user name */ void *auth_by_name_data; /* ... and its specific data */ mu_auth_fp auth_by_uid; /* Get user info by user id */ void *auth_by_uid_data; /* ... and its specific data */ };