From: Pierangelo Masarati Date: Tue, 22 Feb 2005 21:29:42 +0000 (+0000) Subject: improve previous commit; now attribute values are rewritten either if they were DN... X-Git-Tag: OPENLDAP_REL_ENG_2_3_BP~134 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=4e8256f6ab5b3bdb073c830fc9b28a5daaf028a6;p=openldap improve previous commit; now attribute values are rewritten either if they were DN-valued before or after being remapped --- diff --git a/servers/slapd/overlays/rwm.c b/servers/slapd/overlays/rwm.c index 92231c371b..b696e37942 100644 --- a/servers/slapd/overlays/rwm.c +++ b/servers/slapd/overlays/rwm.c @@ -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; } diff --git a/servers/slapd/overlays/rwmmap.c b/servers/slapd/overlays/rwmmap.c index e551f3568a..e8a630cce6 100644 --- a/servers/slapd/overlays/rwmmap.c +++ b/servers/slapd/overlays/rwmmap.c @@ -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;