add 'add-rdn-values {on|off}' (default off) switch

This commit is contained in:
Pierangelo Masarati 2003-02-07 15:19:58 +00:00
parent 982969a4ce
commit 7a97f37bd4
4 changed files with 38 additions and 7 deletions

View File

@ -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 */
}
}
}

View File

@ -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 <on|off>\""
" line.\n", fname, lineno , 0 );
#else
Debug( LDAP_DEBUG_ANY,
"%s: line %d: missing on|off in \"add-rdn-values <on|off>\" 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 );

View File

@ -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;

View File

@ -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);