fname, lineno );
return 1;
}
- ber_str2bv( src, 0, 1, &mapping->src );
- ber_str2bv( dst, 0, 1, &mapping->dst );
- mapping[ 1 ].src = mapping->dst;
- mapping[ 1 ].dst = mapping->src;
+ ber_str2bv( src, 0, 1, &mapping[ 0 ].src );
+ ber_str2bv( dst, 0, 1, &mapping[ 0 ].dst );
+ mapping[ 1 ].src = mapping[ 0 ].dst;
+ mapping[ 1 ].dst = mapping[ 0 ].src;
/*
* schema check
*/
if ( is_oc ) {
if ( src[ 0 ] != '\0' ) {
- if ( oc_bvfind( &mapping->src ) == NULL ) {
+ if ( oc_bvfind( &mapping[ 0 ].src ) == NULL ) {
fprintf( stderr,
"%s: line %d: warning, source objectClass '%s' "
"should be defined in schema\n",
}
}
- if ( oc_bvfind( &mapping->dst ) == NULL ) {
+ if ( oc_bvfind( &mapping[ 0 ].dst ) == NULL ) {
fprintf( stderr,
"%s: line %d: warning, destination objectClass '%s' "
"is not defined in schema\n",
AttributeDescription *ad = NULL;
if ( src[ 0 ] != '\0' ) {
- rc = slap_bv2ad( &mapping->src, &ad, &text );
+ rc = slap_bv2ad( &mapping[ 0 ].src, &ad, &text );
if ( rc != LDAP_SUCCESS ) {
fprintf( stderr,
"%s: line %d: warning, source attributeType '%s' "
* and add it here.
*/
- rc = slap_bv2undef_ad( &mapping->src,
+ rc = slap_bv2undef_ad( &mapping[ 0 ].src,
&ad, &text, SLAP_AD_PROXIED );
if ( rc != LDAP_SUCCESS ) {
fprintf( stderr,
ad = NULL;
}
- rc = slap_bv2ad( &mapping->dst, &ad, &text );
+ rc = slap_bv2ad( &mapping[ 0 ].dst, &ad, &text );
if ( rc != LDAP_SUCCESS ) {
fprintf( stderr,
"%s: line %d: warning, destination attributeType '%s' "
* and add it here.
*/
- rc = slap_bv2undef_ad( &mapping->dst,
+ rc = slap_bv2undef_ad( &mapping[ 0 ].dst,
&ad, &text, SLAP_AD_PROXIED );
if ( rc != LDAP_SUCCESS ) {
fprintf( stderr,
}
}
- if ( (src[ 0 ] != '\0' && avl_find( map->map, (caddr_t)mapping, mapping_cmp ) != NULL)
+ if ( (src[ 0 ] != '\0' && avl_find( map->map, (caddr_t)&mapping[ 0 ], mapping_cmp ) != NULL)
|| avl_find( map->remap, (caddr_t)&mapping[ 1 ], mapping_cmp ) != NULL)
{
fprintf( stderr,
}
if ( src[ 0 ] != '\0' ) {
- avl_insert( &map->map, (caddr_t)mapping,
+ avl_insert( &map->map, (caddr_t)&mapping[ 0 ],
mapping_cmp, mapping_dup );
}
avl_insert( &map->remap, (caddr_t)&mapping[ 1 ],
error_return:;
if ( mapping ) {
- ch_free( mapping->src.bv_val );
- ch_free( mapping->dst.bv_val );
+ ch_free( mapping[ 0 ].src.bv_val );
+ ch_free( mapping[ 0 ].dst.bv_val );
ch_free( mapping );
}
ch_free( mapping );
}
+static void
+mapping_dst_free(
+ void *v_mapping )
+{
+ struct ldapmapping *mapping = v_mapping;
+
+ if ( BER_BVISEMPTY( &mapping->dst ) ) {
+ mapping_free( &mapping[ -1 ] );
+ }
+}
+
static void
target_free(
metatarget_t *mt )
if ( mt->mt_rwmap.rwm_rw ) {
rewrite_info_delete( &mt->mt_rwmap.rwm_rw );
}
- avl_free( mt->mt_rwmap.rwm_oc.remap, NULL );
+ avl_free( mt->mt_rwmap.rwm_oc.remap, mapping_dst_free );
avl_free( mt->mt_rwmap.rwm_oc.map, mapping_free );
- avl_free( mt->mt_rwmap.rwm_at.remap, NULL );
+ avl_free( mt->mt_rwmap.rwm_at.remap, mapping_dst_free );
avl_free( mt->mt_rwmap.rwm_at.map, mapping_free );
}