#include <sys/types.h>
#include <stdlib.h>
#include <string.h>
#include <pwd.h>
#include <openssl/x509.h>
#include "../scconf/scconf.h"
Go to the source code of this file.
Defines | |
#define | MAPPER_EXTERN extern |
#define | _DEFAULT_MAPPER_FIND_ENTRIES |
Default macro for locate certificate entry. | |
#define | _DEFAULT_MAPPER_FIND_USER |
Default macro for locating user. | |
#define | _DEFAULT_MAPPER_MATCH_USER |
Macro for match mapper function. | |
#define | _DEFAULT_MAPPER_END |
Macro for de-initialization routine. | |
#define | _DEFAULT_MAPPER_INIT |
Macro for default init function. | |
Typedefs | |
typedef mapper_module_st | mapper_module |
Structure to be filled on mapper module initialization. | |
Functions | |
mapper_module * | mapper_module_init (scconf_block *ctx, const char *mapper_name) |
Initialize module and mapper_module_st structure. | |
MAPPER_EXTERN struct mapfile * | set_mapent (const char *uri) |
Initialize a mapper entry table. | |
MAPPER_EXTERN int | get_mapent (struct mapfile *mfile) |
Retrieve next entry of given map file. | |
MAPPER_EXTERN void | end_mapent (struct mapfile *mfile) |
Release a mapentry structure. | |
MAPPER_EXTERN char * | mapfile_find (const char *file, char *key, int ignorecase) |
Try to map "key" to provided mapfile. | |
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_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. |
|
Value: static void mapper_module_end(void *context) { \ free(context); \ return; \ } \
|
|
Value: static char ** mapper_find_entries(X509 *x509, void *context) { \ return NULL; \ } Provided as sample for debugging, not for real user
|
|
Value: static char * mapper_find_user(X509 *x509,void *context) { \ if ( !x509 ) return NULL; \ return "nobody"; \ } Should not be used except for debugging, as allways returns "nobody"
|
|
Value: mapper_module* mapper_module_init(scconf_block *blk,const char *name) { \ mapper_module *pt= malloc(sizeof (mapper_module)); \ if (!pt) return NULL; \ pt->name = name; \ pt->context = NULL; \ pt->block = blk; \ pt->dbg_level = get_debug_level(); \ pt->entries = mapper_find_entries; \ pt->finder = mapper_find_user; \ pt->matcher = mapper_match_user; \ pt->deinit = mapper_module_end; \ return pt; \ } \
|
|
Value: static int mapper_match_user(X509 *x509, const char *login, void *context) { \ char *username= mapper_find_user(x509,context); \ if (!x509) return -1; \ if (!login) return -1; \ if (!username) return 0; /*user not found*/ \ if ( ! strcmp(login,username) ) return 1; /* match user */ \ return 0; /* no match */ \ }
|
|
|
|
Structure to be filled on mapper module initialization.
|
|
Test if provided item matches pw_name or pw_gecos of provided password structure.
|
|
Release a mapentry structure.
|
|
Retrieve next entry of given map file.
|
|
Try to map "key" to provided mapfile.
|
|
Try to match provided key to provided name by mean of a mapfile.
|
|
Initialize module and mapper_module_st structure. EVERY mapper module MUST provide and export this function if dinamycally linked
|
|
find the user login that matches pw_name or pw_gecos with provided item
|
|
Initialize a mapper entry table.
|