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                                    \ 
  175static char ** mapper_find_entries(X509 *x509, void *context) {         \ 
  187#define _DEFAULT_MAPPER_FIND_USER                                       \ 
  188static char * mapper_find_user(X509 *x509,void *context,int *match) {           \ 
  189        if ( !x509 ) return NULL;                                       \ 
  204#define _DEFAULT_MAPPER_MATCH_USER                                      \ 
  205static 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                                             \ 
  220static void mapper_module_end(void *context) {                          \ 
  232#define _DEFAULT_MAPPER_INIT                                            \ 
  233mapper_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;                        \ 
MAPPER_EXTERN int get_mapent(struct mapfile *mfile)
Retrieve next entry of given map file.
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 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 struct mapfile * set_mapent(const char *uri)
Initialize a mapper entry table.
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.
mapper_module * mapper_module_init(scconf_block *ctx, const char *mapper_name)
Initialize module and mapper_module_st structure.
struct mapper_module_st mapper_module
Structure to be filled on mapper module initialization.
MAPPER_EXTERN void end_mapent(struct mapfile *mfile)
Release a mapentry structure.
MAPPER_EXTERN char * mapfile_find(const char *file, char *key, int ignorecase, int *match)
Try to map "key" to provided mapfile.
This struct is used in processing map files a map file is a list of "key" " -> " "value" text lines.
char * value
value assigned to key
char * key
key entry in current buffer
const char * uri
URL of mapfile.
char * pt
pointer to last readed entry in buffer
size_t length
lenght of buffer
char * buffer
buffer to content of mapfile
Structure to be filled on mapper module initialization.
void(* deinit)(void *context)
module de-initialization
int(* matcher)(X509 *x509, const char *login, void *context)
cert-to-login matcher
const char * name
mapper name
int dbg_level
debug level to set before call entry points
scconf_block * block
mapper configuration block
void * context
pointer to mapper local data