]> git.ipfire.org Git - thirdparty/openldap.git/commitdiff
fix ITS#3498
authorPierangelo Masarati <ando@openldap.org>
Thu, 20 Jan 2005 18:19:35 +0000 (18:19 +0000)
committerPierangelo Masarati <ando@openldap.org>
Thu, 20 Jan 2005 18:19:35 +0000 (18:19 +0000)
CHANGES
servers/slapd/back-ldap/map.c
servers/slapd/back-meta/modify.c

diff --git a/CHANGES b/CHANGES
index b5a30499929300d35464606d535043e1ef38d5b0..0be91a941ccc55971b7456239ce8e97797558eb9 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -8,6 +8,7 @@ OpenLDAP 2.2.21 Release
        Fixed back-bdb entry e_ocflags reset on objectClass modify
        Fixed back-bdb retcode on referral (ITS#3475)
        Fixed back-bdb detecting deadlock in indexer (ITS#3481)
+       Fixed back-meta DN-valued attribute delete (ITS#3498)
        Fixed back-sql access checking on search (ITS#3488)
        Build Environment
                Misc fixes for dynamic modules (ITS#3401, #3428)
index fcc7fa4852fa892aa5cfc17e4f181f6f91f23c56..45a2d81bce41af964433af38d45335e55c69d262 100644 (file)
@@ -541,6 +541,8 @@ ldap_dnattr_rewrite(
        struct berval   bv;
        int             i, last;
 
+       assert( a_vals != NULL );
+
        for ( last = 0; a_vals[last].bv_val != NULL; last++ );
        last--;
 
@@ -583,6 +585,8 @@ ldap_dnattr_result_rewrite(
        struct berval   bv;
        int             i, last;
 
+       assert( a_vals != NULL );
+
        for ( last = 0; a_vals[last].bv_val; last++ );
        last--;
 
index b83ea13c8c9c73b2cb1f1ab7da784363134c8bde..92d1b1e7f9c6462507ca3e3c8dd2d752cb484662 100644 (file)
@@ -90,17 +90,26 @@ meta_back_modify( Operation *op, SlapReply *rs )
 
        dc.ctx = "modifyAttrDN";
        for ( i = 0, ml = op->oq_modify.rs_modlist; ml; ml = ml->sml_next ) {
-               int j;
+               int     j, is_oc = 0;
 
                if ( ml->sml_desc->ad_type->sat_no_user_mod  ) {
                        continue;
                }
 
-               ldap_back_map( &li->targets[ candidate ]->rwmap.rwm_at,
-                               &ml->sml_desc->ad_cname, &mapped,
-                               BACKLDAP_MAP );
-               if ( mapped.bv_val == NULL || mapped.bv_val[0] == '\0' ) {
-                       continue;
+               if ( ml->sml_desc == slap_schema.si_ad_objectClass 
+                               || ml->sml_desc == slap_schema.si_ad_structuralObjectClass )
+               {
+                       is_oc = 1;
+                       mapped = ml->sml_desc->ad_cname;
+
+               } else {
+                       ldap_back_map(&li->targets[ candidate ]->rwmap.rwm_at,
+                                       &ml->sml_desc->ad_cname,
+                                       &mapped, BACKLDAP_MAP);
+                       if ( mapped.bv_val == NULL || mapped.bv_val[0] == '\0' )
+                       {
+                               continue;
+                       }
                }
 
                modv[ i ] = &mods[ i ];
@@ -112,18 +121,39 @@ meta_back_modify( Operation *op, SlapReply *rs )
                 * to allow their use in ACLs at the back-ldap
                 * level.
                 */
-               if ( strcmp( ml->sml_desc->ad_type->sat_syntax->ssyn_oid,
-                                       SLAPD_DN_SYNTAX ) == 0 ) {
-                       ( void )ldap_dnattr_rewrite( &dc, ml->sml_values );
-               }
-
-               if ( ml->sml_values != NULL ){
-                       for (j = 0; ml->sml_values[ j ].bv_val; j++);
-                       mods[ i ].mod_bvalues = (struct berval **)ch_malloc((j+1) *
-                               sizeof(struct berval *));
-                       for (j = 0; ml->sml_values[ j ].bv_val; j++)
-                               mods[ i ].mod_bvalues[ j ] = &ml->sml_values[j];
-                       mods[ i ].mod_bvalues[ j ] = NULL;
+               if ( ml->sml_values != NULL ) {
+                       if ( is_oc ) {
+                               for (j = 0; ml->sml_values[j].bv_val; j++);
+                               mods[i].mod_bvalues = (struct berval **)ch_malloc((j+1) *
+                                       sizeof(struct berval *));
+                               for (j = 0; ml->sml_values[j].bv_val; j++) {
+                                       ldap_back_map(&li->targets[ candidate ]->rwmap.rwm_oc,
+                                                       &ml->sml_values[j],
+                                                       &mapped, BACKLDAP_MAP);
+                                       if (mapped.bv_val == NULL || mapped.bv_val[0] == '\0') {
+                                               continue;
+                                       }
+                                       mods[i].mod_bvalues[j] = &mapped;
+                               }
+                               mods[i].mod_bvalues[j] = NULL;
+
+                       } else {
+                               if ( strcmp( ml->sml_desc->ad_type->sat_syntax->ssyn_oid,
+                                               SLAPD_DN_SYNTAX ) == 0 )
+                               {
+                                       ( void )ldap_dnattr_rewrite( &dc, ml->sml_values );
+                                       if ( ml->sml_values == NULL ) {
+                                               continue;
+                                       }
+                               }
+
+                               for (j = 0; ml->sml_values[ j ].bv_val; j++);
+                               mods[ i ].mod_bvalues = (struct berval **)ch_malloc((j+1) *
+                                       sizeof(struct berval *));
+                               for (j = 0; ml->sml_values[ j ].bv_val; j++)
+                                       mods[ i ].mod_bvalues[ j ] = &ml->sml_values[j];
+                               mods[ i ].mod_bvalues[ j ] = NULL;
+                       }
 
                } else {
                        mods[ i ].mod_bvalues = NULL;