Initial config support for back-meta

Currently just a direct replacement of slapd.conf parsing,
no dynamic features yet.
This commit is contained in:
Howard Chu 2012-08-17 14:04:48 -07:00
parent 11cf13bf9d
commit 54de37c0e1
9 changed files with 1048 additions and 1002 deletions

View File

@ -455,9 +455,9 @@ typedef struct ldap_extra_t {
int (*proxy_authz_ctrl)( Operation *op, SlapReply *rs, struct berval *bound_ndn, int (*proxy_authz_ctrl)( Operation *op, SlapReply *rs, struct berval *bound_ndn,
int version, slap_idassert_t *si, LDAPControl *ctrl ); int version, slap_idassert_t *si, LDAPControl *ctrl );
int (*controls_free)( Operation *op, SlapReply *rs, LDAPControl ***pctrls ); int (*controls_free)( Operation *op, SlapReply *rs, LDAPControl ***pctrls );
int (*idassert_authzfrom_parse_cf)( const char *fname, int lineno, const char *arg, slap_idassert_t *si ); int (*idassert_authzfrom_parse)( struct config_args_s *ca, slap_idassert_t *si );
int (*idassert_passthru_parse_cf)( const char *fname, int lineno, const char *arg, slap_idassert_t *si ); int (*idassert_passthru_parse_cf)( const char *fname, int lineno, const char *arg, slap_idassert_t *si );
int (*idassert_parse_cf)( const char *fname, int lineno, int argc, char *argv[], slap_idassert_t *si ); int (*idassert_parse)( struct config_args_s *ca, slap_idassert_t *si );
void (*retry_info_destroy)( slap_retry_info_t *ri ); void (*retry_info_destroy)( slap_retry_info_t *ri );
int (*retry_info_parse)( char *in, slap_retry_info_t *ri, char *buf, ber_len_t buflen ); int (*retry_info_parse)( char *in, slap_retry_info_t *ri, char *buf, ber_len_t buflen );
int (*retry_info_unparse)( slap_retry_info_t *ri, struct berval *bvout ); int (*retry_info_unparse)( slap_retry_info_t *ri, struct berval *bvout );

View File

@ -640,7 +640,7 @@ slap_retry_info_destroy(
ri->ri_num = NULL; ri->ri_num = NULL;
} }
static int int
slap_idassert_authzfrom_parse( ConfigArgs *c, slap_idassert_t *si ) slap_idassert_authzfrom_parse( ConfigArgs *c, slap_idassert_t *si )
{ {
struct berval bv; struct berval bv;
@ -759,7 +759,7 @@ slap_idassert_passthru_parse( ConfigArgs *c, slap_idassert_t *si )
return 0; return 0;
} }
static int int
slap_idassert_parse( ConfigArgs *c, slap_idassert_t *si ) slap_idassert_parse( ConfigArgs *c, slap_idassert_t *si )
{ {
int i; int i;
@ -931,22 +931,6 @@ slap_idassert_parse( ConfigArgs *c, slap_idassert_t *si )
} }
/* NOTE: temporary, until back-meta is ported to back-config */ /* NOTE: temporary, until back-meta is ported to back-config */
int
slap_idassert_authzfrom_parse_cf( const char *fname, int lineno, const char *arg, slap_idassert_t *si )
{
ConfigArgs c = { 0 };
char *argv[ 3 ];
snprintf( c.log, sizeof( c.log ), "%s: line %d", fname, lineno );
c.argc = 2;
c.argv = argv;
argv[ 0 ] = "idassert-authzFrom";
argv[ 1 ] = (char *)arg;
argv[ 2 ] = NULL;
return slap_idassert_authzfrom_parse( &c, si );
}
int int
slap_idassert_passthru_parse_cf( const char *fname, int lineno, const char *arg, slap_idassert_t *si ) slap_idassert_passthru_parse_cf( const char *fname, int lineno, const char *arg, slap_idassert_t *si )
{ {
@ -963,18 +947,6 @@ slap_idassert_passthru_parse_cf( const char *fname, int lineno, const char *arg,
return slap_idassert_passthru_parse( &c, si ); return slap_idassert_passthru_parse( &c, si );
} }
int
slap_idassert_parse_cf( const char *fname, int lineno, int argc, char *argv[], slap_idassert_t *si )
{
ConfigArgs c = { 0 };
snprintf( c.log, sizeof( c.log ), "%s: line %d", fname, lineno );
c.argc = argc;
c.argv = argv;
return slap_idassert_parse( &c, si );
}
static int static int
ldap_back_cf_gen( ConfigArgs *c ) ldap_back_cf_gen( ConfigArgs *c )
{ {

View File

@ -35,9 +35,9 @@
static const ldap_extra_t ldap_extra = { static const ldap_extra_t ldap_extra = {
ldap_back_proxy_authz_ctrl, ldap_back_proxy_authz_ctrl,
ldap_back_controls_free, ldap_back_controls_free,
slap_idassert_authzfrom_parse_cf, slap_idassert_authzfrom_parse,
slap_idassert_passthru_parse_cf, slap_idassert_passthru_parse_cf,
slap_idassert_parse_cf, slap_idassert_parse,
slap_retry_info_destroy, slap_retry_info_destroy,
slap_retry_info_parse, slap_retry_info_parse,
slap_retry_info_unparse, slap_retry_info_unparse,

View File

@ -101,9 +101,9 @@ extern int slap_retry_info_parse( char *in, slap_retry_info_t *ri,
char *buf, ber_len_t buflen ); char *buf, ber_len_t buflen );
extern int slap_retry_info_unparse( slap_retry_info_t *ri, struct berval *bvout ); extern int slap_retry_info_unparse( slap_retry_info_t *ri, struct berval *bvout );
extern int slap_idassert_authzfrom_parse_cf( const char *fname, int lineno, const char *arg, slap_idassert_t *si ); extern int slap_idassert_authzfrom_parse( struct config_args_s *ca, slap_idassert_t *si );
extern int slap_idassert_passthru_parse_cf( const char *fname, int lineno, const char *arg, slap_idassert_t *si ); extern int slap_idassert_passthru_parse_cf( const char *fname, int lineno, const char *arg, slap_idassert_t *si );
extern int slap_idassert_parse_cf( const char *fname, int lineno, int argc, char *argv[], slap_idassert_t *si ); extern int slap_idassert_parse( struct config_args_s *ca, slap_idassert_t *si );
extern int chain_initialize( void ); extern int chain_initialize( void );
extern int pbind_initialize( void ); extern int pbind_initialize( void );

View File

@ -124,14 +124,6 @@ ldap_back_map_attrs(
int remap, int remap,
char ***mapped_attrs ); char ***mapped_attrs );
extern int ldap_back_map_config(
struct ldapmap *oc_map,
struct ldapmap *at_map,
const char *fname,
int lineno,
int argc,
char **argv );
extern int extern int
ldap_back_filter_map_rewrite( ldap_back_filter_map_rewrite(
dncookie *dc, dncookie *dc,

File diff suppressed because it is too large Load Diff

View File

@ -64,7 +64,7 @@ meta_back_initialize(
bi->bi_destroy = 0; bi->bi_destroy = 0;
bi->bi_db_init = meta_back_db_init; bi->bi_db_init = meta_back_db_init;
bi->bi_db_config = meta_back_db_config; bi->bi_db_config = config_generic_wrapper;
bi->bi_db_open = meta_back_db_open; bi->bi_db_open = meta_back_db_open;
bi->bi_db_close = 0; bi->bi_db_close = 0;
bi->bi_db_destroy = meta_back_db_destroy; bi->bi_db_destroy = meta_back_db_destroy;
@ -86,7 +86,7 @@ meta_back_initialize(
bi->bi_connection_init = 0; bi->bi_connection_init = 0;
bi->bi_connection_destroy = meta_back_conn_destroy; bi->bi_connection_destroy = meta_back_conn_destroy;
return 0; return meta_back_init_cf( bi );
} }
int int
@ -142,6 +142,7 @@ meta_back_db_init(
mi->mi_ldap_extra = (ldap_extra_t *)bi->bi_extra; mi->mi_ldap_extra = (ldap_extra_t *)bi->bi_extra;
be->be_private = mi; be->be_private = mi;
be->be_cf_ocs = be->bd_info->bi_cf_ocs;
return 0; return 0;
} }

View File

@ -47,6 +47,8 @@ extern BI_op_abandon meta_back_abandon;
extern BI_connection_destroy meta_back_conn_destroy; extern BI_connection_destroy meta_back_conn_destroy;
int meta_back_init_cf( BackendInfo *bi );
LDAP_END_DECL LDAP_END_DECL
#endif /* PROTO_META_H */ #endif /* PROTO_META_H */

View File

@ -252,6 +252,7 @@ static OidRec OidMacros[] = {
* OLcfg{Bk|Db}{Oc|At}:10 -> back-shell * OLcfg{Bk|Db}{Oc|At}:10 -> back-shell
* OLcfg{Bk|Db}{Oc|At}:11 -> back-perl * OLcfg{Bk|Db}{Oc|At}:11 -> back-perl
* OLcfg{Bk|Db}{Oc|At}:12 -> back-mdb * OLcfg{Bk|Db}{Oc|At}:12 -> back-mdb
* OLcfg{Bk|Db}{Oc|At}:13 -> back-meta
*/ */
/* /*