]> git.sur5r.net Git - openldap/commitdiff
improve previous commit; now attribute values are rewritten either if they were DN...
authorPierangelo Masarati <ando@openldap.org>
Tue, 22 Feb 2005 21:29:42 +0000 (21:29 +0000)
committerPierangelo Masarati <ando@openldap.org>
Tue, 22 Feb 2005 21:29:42 +0000 (21:29 +0000)
servers/slapd/overlays/rwm.c
servers/slapd/overlays/rwmmap.c

index 92231c371b7cb40c6d71df64f7681feadf685088..b696e379427ac3b434ef4325fc62cb6fca642405 100644 (file)
@@ -171,8 +171,8 @@ rwm_op_add( Operation *op, SlapReply *rs )
                                }
                        }
 
-                       if ( (*ap)->a_desc->ad_type->sat_syntax
-                                       == slap_schema.si_syn_distinguishedName )
+                       if ( (*ap)->a_desc->ad_type->sat_syntax == slap_schema.si_syn_distinguishedName
+                                       || ( mapping != NULL && mapping->m_dst_ad->ad_type->sat_syntax == slap_schema.si_syn_distinguishedName ) )
                        {
                                /*
                                 * FIXME: rewrite could fail; in this case
@@ -327,7 +327,8 @@ rwm_op_compare( Operation *op, SlapReply *rs )
                        ad = mapping->m_dst_ad;
                }
 
-               if ( op->orc_ava->aa_desc->ad_type->sat_syntax == slap_schema.si_syn_distinguishedName )
+               if ( op->orc_ava->aa_desc->ad_type->sat_syntax == slap_schema.si_syn_distinguishedName
+                               || ( mapping != NULL && mapping->m_dst_ad->ad_type->sat_syntax == slap_schema.si_syn_distinguishedName ) )
                {
                        struct berval   *mapped_valsp[2];
                        
@@ -436,11 +437,11 @@ rwm_op_modify( Operation *op, SlapReply *rs )
                                last--;
 
                                for ( j = 0; !BER_BVISNULL( &(*mlp)->sml_values[ j ] ); j++ ) {
-                                       struct ldapmapping      *mapping = NULL;
-
+                                       struct ldapmapping      *oc_mapping = NULL;
+               
                                        ( void )rwm_mapping( &rwmap->rwm_oc, &(*mlp)->sml_values[ j ],
-                                                       &mapping, RWM_MAP );
-                                       if ( mapping == NULL ) {
+                                                       &oc_mapping, RWM_MAP );
+                                       if ( oc_mapping == NULL ) {
                                                if ( rwmap->rwm_at.drop_missing ) {
                                                        /* FIXME: we allow to remove objectClasses as well;
                                                         * if the resulting entry is inconsistent, that's
@@ -457,13 +458,13 @@ rwm_op_modify( Operation *op, SlapReply *rs )
        
                                        } else {
                                                ch_free( (*mlp)->sml_values[ j ].bv_val );
-                                               ber_dupbv( &(*mlp)->sml_values[ j ], &mapping->m_dst );
+                                               ber_dupbv( &(*mlp)->sml_values[ j ], &oc_mapping->m_dst );
                                        }
                                }
 
                        } else {
-                               if ( (*mlp)->sml_desc->ad_type->sat_syntax ==
-                                               slap_schema.si_syn_distinguishedName )
+                               if ( (*mlp)->sml_desc->ad_type->sat_syntax == slap_schema.si_syn_distinguishedName
+                                               || ( mapping != NULL && mapping->m_dst_ad->ad_type->sat_syntax == slap_schema.si_syn_distinguishedName ) )
                                {
 #ifdef ENABLE_REWRITE
                                        rc = rwm_dnattr_rewrite( op, rs, "modifyAttrDN",
@@ -516,7 +517,6 @@ cleanup_mod:;
                free( ml );
        }
 
-       /* TODO: rewrite attribute types, values of DN-valued attributes ... */
        return SLAP_CB_CONTINUE;
 }
 
index e551f3568a30d9cca49a96cec965b4c5893231d9..e8a630cce6c57d115d33778ccbe478bf365412c7 100644 (file)
@@ -386,7 +386,8 @@ map_attr_value(
        if ( value != NULL ) {
                assert( mapped_value != NULL );
 
-               if ( ad->ad_type->sat_syntax == slap_schema.si_syn_distinguishedName )
+               if ( ad->ad_type->sat_syntax == slap_schema.si_syn_distinguishedName
+                               || ( mapping != NULL && mapping->m_dst_ad->ad_type->sat_syntax == slap_schema.si_syn_distinguishedName ) )
                {
                        dncookie        fdc = *dc;
                        int             rc;