From: Pierangelo Masarati Date: Fri, 7 Feb 2003 15:19:58 +0000 (+0000) Subject: add 'add-rdn-values {on|off}' (default off) switch X-Git-Tag: NO_SLAP_OP_BLOCKS~419 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=7a97f37bd47d632fac1b6206065926b1fa9c6dbb;p=openldap add 'add-rdn-values {on|off}' (default off) switch --- diff --git a/servers/slapd/add.c b/servers/slapd/add.c index cb93cee577..ff1e305550 100644 --- a/servers/slapd/add.c +++ b/servers/slapd/add.c @@ -246,8 +246,7 @@ do_add( Connection *conn, Operation *op ) } if (mod == NULL) { -#define BAILOUT -#ifdef BAILOUT + if ( !global_add_rdn_values ) { /* bail out */ send_ldap_result( conn, op, rc = LDAP_NO_SUCH_ATTRIBUTE, @@ -256,7 +255,7 @@ do_add( Connection *conn, Operation *op ) NULL, NULL ); goto done; -#else /* ! BAILOUT */ + } else { struct berval bv; /* add attribute type and value to modlist */ @@ -276,7 +275,7 @@ do_add( Connection *conn, Operation *op ) *modtail = mod; modtail = &mod->sml_next; continue; -#endif /* ! BAILOUT */ + } } mr = desc->ad_type->sat_equality; @@ -311,7 +310,7 @@ do_add( Connection *conn, Operation *op ) /* not found? */ if (mod->sml_bvalues[ i ].bv_val == NULL) { -#ifdef BAILOUT + if ( !global_add_rdn_values ) { /* bailout */ send_ldap_result( conn, op, rc = LDAP_NO_SUCH_ATTRIBUTE, @@ -320,14 +319,14 @@ do_add( Connection *conn, Operation *op ) NULL, NULL ); goto done; -#else /* ! BAILOUT */ + } else { struct berval bv; /* add attribute type and value to modlist */ ber_dupbv( &bv, &rdn[ 0 ][ cnt ]->la_value ); ber_bvarray_add( &mod->sml_bvalues, &bv ); continue; -#endif /* ! BAILOUT */ + } } } diff --git a/servers/slapd/config.c b/servers/slapd/config.c index 052cf3e896..4c8135d1de 100644 --- a/servers/slapd/config.c +++ b/servers/slapd/config.c @@ -1727,6 +1727,36 @@ read_config( const char *fname, int depth ) global_schemacheck = 1; } + /* turn on/off rdn value add */ + } else if ( strcasecmp( cargv[0], "add-rdn-values" ) == 0 ) { + if ( cargc < 2 ) { +#ifdef NEW_LOGGING + LDAP_LOG( CONFIG, CRIT, + "%s: line %d: missing on|off in \"add-rdn-values \"" + " line.\n", fname, lineno , 0 ); +#else + Debug( LDAP_DEBUG_ANY, + "%s: line %d: missing on|off in \"add-rdn-values \" line\n", + fname, lineno, 0 ); +#endif + + return( 1 ); + } + if ( strcasecmp( cargv[1], "on" ) == 0 ) { +#ifdef NEW_LOGGING + LDAP_LOG( CONFIG, CRIT, + "%s: line %d: add-rdn-values enabled! your mileage may vary!\n", + fname, lineno , 0 ); +#else + Debug( LDAP_DEBUG_ANY, + "%s: line %d: add-rdn-values enabled! your mileage may vary!\n", + fname, lineno, 0 ); +#endif + global_add_rdn_values = 1; + } else { + global_add_rdn_values = 0; + } + /* specify access control info */ } else if ( strcasecmp( cargv[0], "access" ) == 0 ) { parse_acl( be, fname, lineno, cargc, cargv ); diff --git a/servers/slapd/proto-slap.h b/servers/slapd/proto-slap.h index 4b26475dfc..857611a6b8 100644 --- a/servers/slapd/proto-slap.h +++ b/servers/slapd/proto-slap.h @@ -1107,6 +1107,7 @@ LDAP_SLAPD_V (slap_access_t) global_default_access; LDAP_SLAPD_V (int) global_gentlehup; LDAP_SLAPD_V (int) global_idletimeout; LDAP_SLAPD_V (int) global_schemacheck; +LDAP_SLAPD_V (int) global_add_rdn_values; LDAP_SLAPD_V (char *) global_host; LDAP_SLAPD_V (char *) global_realm; LDAP_SLAPD_V (char *) default_passwd_hash; diff --git a/servers/slapd/schemaparse.c b/servers/slapd/schemaparse.c index fbfd93a59b..6a621937f3 100644 --- a/servers/slapd/schemaparse.c +++ b/servers/slapd/schemaparse.c @@ -17,6 +17,7 @@ #include "ldap_schema.h" int global_schemacheck = 1; /* schemacheck ON is default */ +int global_add_rdn_values = 0; /* bail out if rdn values do not match entry values is default */ static void oc_usage(void); static void at_usage(void);