30 #include <sys/types.h> 34 #include <../common/cert_st.h> 35 #include "../scconf/scconf.h" 50 char **(*entries)(X509 *x509,
void *
context);
52 char *(*finder)(X509 *x509,
void *
context,
int *match);
96 #define MAPPER_EXTERN extern 174 #define _DEFAULT_MAPPER_FIND_ENTRIES \ 175 static char ** mapper_find_entries(X509 *x509, void *context) { \ 187 #define _DEFAULT_MAPPER_FIND_USER \ 188 static char * mapper_find_user(X509 *x509,void *context,int *match) { \ 189 if ( !x509 ) return NULL; \ 204 #define _DEFAULT_MAPPER_MATCH_USER \ 205 static int mapper_match_user(X509 *x509, const char *login, void *context) { \ 207 char *username= mapper_find_user(x509,context,&match); \ 208 if (!x509) return -1; \ 209 if (!login) return -1; \ 210 if (!username) return 0; \ 211 if ( ! strcmp(login,username) ) return 1; \ 219 #define _DEFAULT_MAPPER_END \ 220 static void mapper_module_end(void *context) { \ 232 #define _DEFAULT_MAPPER_INIT \ 233 mapper_module* mapper_module_init(scconf_block *blk,const char *name) { \ 234 mapper_module *pt= malloc(sizeof (mapper_module)); \ 235 if (!pt) return NULL; \ 237 pt->context = NULL; \ 239 pt->dbg_level = get_debug_level(); \ 240 pt->entries = mapper_find_entries; \ 241 pt->finder = mapper_find_user; \ 242 pt->matcher = mapper_match_user; \ 243 pt->deinit = mapper_module_end; \ size_t length
lenght of buffer
int dbg_level
debug level to set before call entry points
char * key
key entry in current buffer
mapper_module * mapper_module_init(scconf_block *ctx, const char *mapper_name)
Initialize module and mapper_module_st structure.
char * pt
pointer to last readed entry in buffer
char * value
value assigned to key
MAPPER_EXTERN int mapfile_match(const char *file, char *key, const char *value, int ignorecase)
Try to match provided key to provided name by mean of a mapfile.
void * context
pointer to mapper local data
This struct is used in processing map files a map file is a list of "key" " -> " "value" text lines...
scconf_block * block
mapper configuration block
const char * uri
URL of mapfile.
MAPPER_EXTERN int compare_pw_entry(const char *item, struct passwd *pw, int ignorecase)
Test if provided item matches pw_name or pw_gecos of provided password structure. ...
MAPPER_EXTERN char * search_pw_entry(const char *item, int ignorecase)
find the user login that matches pw_name or pw_gecos with provided item
MAPPER_EXTERN char * mapfile_find(const char *file, char *key, int ignorecase, int *match)
Try to map "key" to provided mapfile.
void(* deinit)(void *context)
module de-initialization
MAPPER_EXTERN void end_mapent(struct mapfile *mfile)
Release a mapentry structure.
Structure to be filled on mapper module initialization.
int(* matcher)(X509 *x509, const char *login, void *context)
cert-to-login matcher
struct mapper_module_st mapper_module
Structure to be filled on mapper module initialization.
MAPPER_EXTERN int get_mapent(struct mapfile *mfile)
Retrieve next entry of given map file.
MAPPER_EXTERN struct mapfile * set_mapent(const char *uri)
Initialize a mapper entry table.
char * buffer
buffer to content of mapfile
const char * name
mapper name