/usr/include/courierauth.h is in courier-authlib-dev 0.68.0-4build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 | #ifndef courierauth_h
#define courierauth_h
/*
** Copyright 2004 Double Precision, Inc. See COPYING for
** distribution information.
*/
#include "courier_auth_config.h"
#include <sys/types.h>
#ifdef __cplusplus
extern "C" {
#endif
#if 0
}
#endif
/*
Callback authentication 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; /* For authldap */
const char *options;
} ;
/*
Either sysusername or sysuserid may be NULL, but not both of them.
They, and sysgroupid, specify the authenticated user's system
userid and groupid. homedir points to the authenticated user's
home directory. address, fullname, and maildir, are obvious.
quota is populated with any maildir quota (see
maildir/README.maildirquota).
'options' is an optional string that contains per-user custom settings.
See "OPTIONS" above.
After populating this tructure, the lookup function calls the
callback function that's specified in its second argument. The
callback function receives a pointer to the authinfo structure.
The callback function also receives a context pointer, which is
the third argument to the lookup function.
The lookup function should return a negative value if he userid
does not exist, a positive value if there was a temporary error
looking up the userid, or whatever is the return code from the
callback function, if the user exists.
*/
#define AUTHTYPE_LOGIN "login" /* authdata is userid\npassword\n */
#define AUTHTYPE_CRAMMD5 "cram-md5" /* authdata is challenge\nresponse\n */
#define AUTHTYPE_CRAMSHA1 "cram-sha1" /* authdata is challenge\nresponse\n */
#define AUTHTYPE_CRAMSHA256 "cram-sha256" /* authdata is challenge\nresponse\n */
/* auth_generic: INTERNAL */
int auth_generic(const char *service,
const char *authtype,
char *authdata,
int (*callback_func)(struct authinfo *, void *),
void *callback_arg);
/* Login request: */
int auth_login(const char *service,
const char *userid,
const char *passwd,
int (*callback_func)(struct authinfo *, void *),
void *callback_arg);
/* Return account info: */
int auth_getuserinfo(const char *service, const char *uid,
int (*callback)(struct authinfo *, void *),
void *arg);
/* Enumerate accounts */
void auth_enumerate( void(*cb_func)(const char *name,
uid_t uid,
gid_t gid,
const char *homedir,
const char *maildir,
const char *options,
void *void_arg),
void *void_arg);
/* Change the password */
int auth_passwd(const char *service,
const char *uid,
const char *opwd,
const char *npwd);
/* Utility function: parse OPTIONS string for a particular keyword */
extern int auth_getoptionenvint(const char *keyword);
extern char *auth_getoptionenv(const char *keyword);
extern char *auth_getoption(const char *options, const char *keyword);
/*
** Utility function: typical action in a callback for auth_generic
** or auth_login. Does the following:
**
** Drops root, takes uid/gid in ainfo.
**
** Changes current directory to the home directory.
**
** Returns: <0 - fatal error before dropping root.
** >0 - fatal error after dropping root.
** =0 - all's OK.
*/
int auth_callback_default(struct authinfo *ainfo);
/*
** If the AUTH_MKHOMEDIR_SKEL environment variable is set, and the
** authenticated account's home directory does not exist, the home directory
** gets created, with its initial contents copied from AUTH_MKHOMEDIR_SKEL
** which must be a directory, typically /etc/skel.
*/
int auth_mkhomedir(struct authinfo *info);
/*
** Like auth_callback_default, but calls auth_mkhomedir().
*/
int auth_callback_default_autocreate(struct authinfo *ainfo);
/* Utility function: escape LDAP special characters */
char *courier_auth_ldap_escape(const char *str);
struct cram_callback_info {
struct hmac_hashinfo *h;
char *user;
char *challenge;
char *response;
int (*callback_func)(struct authinfo *, void *);
void *callback_arg;
};
extern int auth_cram_callback(struct authinfo *a, void *vp);
/*
** auth_get_cram parses out an authentication request. It checks whether
** we have the requisite hash function installed, and, if so, base64decodes
** the challenge and the response.
*/
struct hmac_hashinfo;
int auth_get_cram(const char *authtype, /* authtype */
char *authdata, /* authdata */
struct cram_callback_info *craminfo);
/* Initializes craminfo */
/* auth_get_cram_silent() is auth_get_cram(), but without logging */
int auth_get_cram_silent(const char *authtype, char *authdata,
struct cram_callback_info *craminfo);
/*
** auth_verify_cram attempts to verify the secret cookie.
*/
int auth_verify_cram(struct hmac_hashinfo *, /* The hash function */
const char *, /* The challenge */
const char *, /* The response */
const char *); /* Hashed secret, in hex */
#if 0
{
#endif
#ifdef __cplusplus
}
#endif
#endif
|