00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00046 #ifndef __PAM_KMUX_OPTIONS_H
00047 #define __PAM_KMUX_OPTIONS_H
00048
00049 #include <security/pam_appl.h>
00050
00051
00052 #define PAM_OPT_DEBUG 0x01
00053 #define PAM_OPT_NO_WARN 0x02
00054 #define PAM_OPT_USE_FIRST_PASS 0x04
00055 #define PAM_OPT_TRY_FIRST_PASS 0x08
00056 #define PAM_OPT_USE_MAPPED_PASS 0x10
00057 #define PAM_OPT_ECHO_PASS 0x20
00058 #define PAM_OPT_TRY_OLDAUTH 0x40
00059 #define PAM_OPT_USE_OLDAUTH 0x80
00060
00062 #define PAM_KMUX_CONFFILE_OPT "conffile"
00063
00064 #define PAM_KMUX_DEBUG_OPT "debug"
00065
00067 #define PAM_KMUX_DEFAULT_CONFFILE "/etc/pam_kmux.conf"
00068
00069 #define PAM_KMUX_DEFAULT_DEBUG LG_INFO
00070
00071
00078 typedef enum {
00079 DB_FIREBIRD = 0,
00080 DB_MYSQL,
00081 DB_POSTGRES,
00082 DB_TYPES,
00083 DB_UNDEFINED
00084 } db_type;
00085
00091 typedef enum {
00092 LG_INIT = 0,
00093 LG_DEBUG,
00094 LG_INFO,
00095 LG_ERR
00096 } log_type;
00097
00103 typedef enum {
00104 PW_CLEAR = 0,
00105 PW_MD5,
00106 PW_CRYPT,
00107 PW_CRYPT_MD5,
00108 PW_SHA1,
00109 PW_T9,
00110 PW_T9_MD5,
00111 PW_SCHEMES
00112 } pw_scheme;
00113
00118 typedef struct modopt_s {
00119 char *connstr;
00120 char *host;
00121 char *db;
00122 char *table;
00123 char *timeout;
00124 db_type type;
00125 char *port;
00126 char *user;
00127 char *passwd;
00128 char *sslmode;
00129 char *column_user;
00130 char *column_pwd;
00131 char *query_pwd;
00132 char *query_auth;
00133 pw_scheme pw_type;
00134 } modopt_t;
00135
00140 typedef struct modopts_s {
00141 int len;
00142 int std_flags;
00143 modopt_t **modopt_list;
00144 } modopts_t;
00145
00155 typedef void* (*f_db_connect)(const modopt_t *options);
00156
00164 typedef void (*f_db_disconnect)(void* vconn);
00165
00183 typedef int (*f_expand_query)(char **command, const char** values, const char *query, const char *service, const char *user, const char *passwd, const char *rhost, const char *raddr, const modopt_t *options);
00184
00201 typedef int (*f_exec_param)(void *vconn, void **vres, const char *query, const char *service, const char *user, const char *passwd, const char *rhost, const modopt_t *options);
00202
00218 typedef int (*f_backend_authenticate)(const char *service, const char *user, const char *passwd, const char *rhost, const modopt_t *options);
00219
00225 typedef struct backfunc_s {
00226 f_db_connect db_connect;
00227 f_db_disconnect db_disconnect;
00228 f_expand_query expand_query;
00229 f_exec_param exec_param;
00230 f_backend_authenticate backend_authenticate;
00231 } backfunc_t;
00232
00240 typedef const char* (*f_hashfunc)(const char *pass,...);
00241
00246 typedef struct pam_modopt_s {
00247 log_type debug;
00248 char *conffile;
00249 backfunc_t backfuncs[(int)DB_TYPES];
00250 f_hashfunc pwhashfuncs[(int)PW_SCHEMES];
00251 const char *e2str_db_type[(int)DB_TYPES];
00252 const char *e2str_pw_scheme[(int)PW_SCHEMES];
00253 pam_handle_t *pamh;
00254 } pam_modopt_t;
00255
00262 void log_options_container(const modopts_t *options_container);
00263
00270 void log_options(const modopt_t *options);
00271
00278 modopt_t * get_modopt(void);
00279
00286 modopts_t * get_modopts(void);
00287
00294 void free_modopt(modopt_t *options);
00295
00302 void free_modopts(modopts_t *options_container);
00303
00310 void init_pamod_options(void);
00311
00317 void free_pamod_options(void);
00318
00324 void set_pamod_defaults(void);
00325
00332 char* getstr_option(const modopt_t *options);
00333 #endif
00334