Node:Data Types, Next:, Up:libmuauth



Data Types

mu_auth_fp Data Type

This is a pointer to authentication or authorization data. It is defined as follows:

typedef int (*mu_auth_fp) (void *return_data,
                           void *key,
                           void *func_data,
                           void *call_data);

Its arguments are:

return_data
1. 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 by mu_get_auth_by_name() and uid_t * if it is called by mu_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 a mu_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.

mu_auth_data Data Type

The mu_auth_data is used to return the information about the user. It is similar to system struct 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? */
};

mu_auth_module Data Type

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 */
};


Footnotes

  1. Actually it shoud have been struct mu_auth_data** return_data. This will be fixed in the next release