From: Howard Chu Date: Fri, 4 Feb 2011 17:07:35 +0000 (+0000) Subject: Backward compatibility - treat unknown directives as perlModuleConfig's X-Git-Tag: MIGRATION_CVS2GIT~106 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=6e0d483f621fa950b2ca1b204ff047e8ff50e519;p=openldap Backward compatibility - treat unknown directives as perlModuleConfig's --- diff --git a/servers/slapd/back-perl/close.c b/servers/slapd/back-perl/close.c index 893834b760..6e16a04daf 100644 --- a/servers/slapd/back-perl/close.c +++ b/servers/slapd/back-perl/close.c @@ -48,7 +48,7 @@ perl_back_db_destroy( { PerlBackend *pb = be->be_private; - ch_free( pb->pb_module_name.bv_val ); + ch_free( pb->pb_module_name ); ber_bvarray_free( pb->pb_module_path ); ber_bvarray_free( pb->pb_module_config ); diff --git a/servers/slapd/back-perl/config.c b/servers/slapd/back-perl/config.c index e8489b6869..a8b98a3943 100644 --- a/servers/slapd/back-perl/config.c +++ b/servers/slapd/back-perl/config.c @@ -34,7 +34,7 @@ static ConfigTable perlcfg[] = { "EQUALITY caseExactMatch " "SYNTAX OMsDirectoryString SINGLE-VALUE )", NULL, NULL }, { "perlModulePath", "path", 2, 2, 0, - ARG_STRING|ARG_MAGIC|PERL_PATH, perl_cf, + ARG_MAGIC|PERL_PATH, perl_cf, "( OLcfgDbAt:11.2 NAME 'olcPerlModulePath' " "DESC 'Perl module path' " "EQUALITY caseExactMatch " @@ -45,7 +45,7 @@ static ConfigTable perlcfg[] = { "DESC 'Filter search results before returning to client' " "SYNTAX OMsBoolean SINGLE-VALUE )", NULL, NULL }, { "perlModuleConfig", "args", 2, 0, 0, - ARG_STRING|ARG_MAGIC|PERL_CONFIG, perl_cf, + ARG_MAGIC|PERL_CONFIG, perl_cf, "( OLcfgDbAt:11.4 NAME 'olcPerlModuleConfig' " "DESC 'Perl module config directives' " "EQUALITY caseExactMatch " @@ -55,7 +55,7 @@ static ConfigTable perlcfg[] = { static ConfigOCs perlocs[] = { { "( OLcfgDbOc:11.1 " - "NAME 'olcPerlConfig' " + "NAME 'olcDbPerlConfig' " "DESC 'Perl DB configuration' " "SUP olcDatabaseConfig " "MUST ( olcPerlModulePath $ olcPerlModule ) " @@ -64,11 +64,48 @@ static ConfigOCs perlocs[] = { { NULL } }; +static ConfigOCs ovperlocs[] = { + { "( OLcfgDbOc:11.2 " + "NAME 'olcovPerlConfig' " + "DESC 'Perl overlay configuration' " + "SUP olcOverlayConfig " + "MUST ( olcPerlModulePath $ olcPerlModule ) " + "MAY ( olcPerlFilterSearchResults $ olcPerlModuleConfig ) )", + Cft_Overlay, perlcfg, NULL, NULL }, + { NULL } +}; + /********************************************************** * * Config * **********************************************************/ +int +perl_back_db_config( + BackendDB *be, + const char *fname, + int lineno, + int argc, + char **argv +) +{ + int rc = config_generic_wrapper( be, fname, lineno, argc, argv ); + /* backward compatibility: map unknown directives to perlModuleConfig */ + if ( rc == SLAP_CONF_UNKNOWN ) { + char **av = ch_malloc( (argc+2) * sizeof(char *)); + int i; + av[0] = "perlModuleConfig"; + av++; + for ( i=0; iop == SLAP_CONFIG_EMIT ) { switch( c-> type ) { case PERL_MODULE: - if ( bv.bv_len < 1 ) + if ( !pb->pb_module_name ) return 1; - value_add_one( &c->rvalue_vals, &pb->pb_module_name ); + c->value_string = ch_strdup( pb->pb_module_name ); break; case PERL_PATH: if ( !pb->pb_module_path ) @@ -107,8 +144,8 @@ perl_cf( */ switch( c-> type ) { case PERL_MODULE: - ch_free( pb->pb_module_name.bv_val ); - BER_BVZERO( &pb->pb_module_name ); + ch_free( pb->pb_module_name ); + pb->pb_module_name = NULL; break; case PERL_PATH: if ( c->valx < 0 ) { @@ -168,7 +205,7 @@ perl_cf( pb->pb_obj_ref = newSVsv(POPs); PUTBACK; FREETMPS; LEAVE ; - ber_str2bv( c->argv[1], 0, 1, &pb->pb_module_name ); + pb->pb_module_name = ch_strdup( c->argv[1] ); } break; diff --git a/servers/slapd/back-perl/init.c b/servers/slapd/back-perl/init.c index f4acb87e3e..bb0d16f2e4 100644 --- a/servers/slapd/back-perl/init.c +++ b/servers/slapd/back-perl/init.c @@ -45,7 +45,7 @@ perl_back_initialize( bi->bi_destroy = 0; bi->bi_db_init = perl_back_db_init; - bi->bi_db_config = 0; + bi->bi_db_config = perl_back_db_config; bi->bi_db_open = perl_back_db_open; bi->bi_db_close = 0; bi->bi_db_destroy = perl_back_db_destroy; diff --git a/servers/slapd/back-perl/perl_back.h b/servers/slapd/back-perl/perl_back.h index 538d41f901..b76c20b7a9 100644 --- a/servers/slapd/back-perl/perl_back.h +++ b/servers/slapd/back-perl/perl_back.h @@ -67,7 +67,7 @@ extern PerlInterpreter *PERL_INTERPRETER; typedef struct perl_backend_instance { - struct berval pb_module_name; + char *pb_module_name; BerVarray pb_module_path; BerVarray pb_module_config; SV *pb_obj_ref; diff --git a/servers/slapd/back-perl/proto-perl.h b/servers/slapd/back-perl/proto-perl.h index f0582d8958..0fd9f0be71 100644 --- a/servers/slapd/back-perl/proto-perl.h +++ b/servers/slapd/back-perl/proto-perl.h @@ -27,6 +27,7 @@ extern BI_close perl_back_close; extern BI_db_init perl_back_db_init; extern BI_db_open perl_back_db_open; extern BI_db_destroy perl_back_db_destroy; +extern BI_db_config perl_back_db_config; extern BI_op_bind perl_back_bind; extern BI_op_search perl_back_search;