]> git.sur5r.net Git - openldap/commitdiff
add 'add-rdn-values {on|off}' (default off) switch
authorPierangelo Masarati <ando@openldap.org>
Fri, 7 Feb 2003 15:19:58 +0000 (15:19 +0000)
committerPierangelo Masarati <ando@openldap.org>
Fri, 7 Feb 2003 15:19:58 +0000 (15:19 +0000)
servers/slapd/add.c
servers/slapd/config.c
servers/slapd/proto-slap.h
servers/slapd/schemaparse.c

index cb93cee577f6705dc40491e3569a1fe96cf4beac..ff1e30555061411c3ada3db5529a88ca30aa8505 100644 (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 */
+                       }
                }
        }
 
index 052cf3e8967ac26d3d3b50940bed4bb95d565d1d..4c8135d1de739b378113c083249620687fc52ce7 100644 (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 );
index 4b26475dfc5f3655f659b80c992a35a0c13dee93..857611a6b8073073056e239b4ec6ceafcf3cd9aa 100644 (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;
index fbfd93a59bd49d527b0772c356e630b73aacbf47..6a621937f3eca4d02e3c977e255b190e0195bed4 100644 (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);