dncookie dc;
lc = meta_back_getconn( op, rs, META_OP_REQUIRE_SINGLE,
- &op->o_req_ndn, &candidate );
- if ( !lc ) {
- rc = -1;
- goto cleanup;
+ &op->o_req_ndn, &candidate, LDAP_BACK_SENDERR );
+ if ( !lc || !meta_back_dobind( lc, op, LDAP_BACK_SENDERR ) ) {
+ return rs->sr_err;
}
- if ( !meta_back_dobind( lc, op ) ) {
- rs->sr_err = LDAP_UNAVAILABLE;
-
- } else if ( !meta_back_is_valid( lc, candidate ) ) {
+ if ( !meta_back_is_valid( lc, candidate ) ) {
rs->sr_err = LDAP_OTHER;
- }
-
- if ( rs->sr_err != LDAP_SUCCESS ) {
- rc = -1;
- goto cleanup;
+ send_ldap_result( op, rs );
+ return rs->sr_err;
}
/*
mods[ i ].mod_bvalues =
(struct berval **)ch_malloc( ( j + 1 ) *
sizeof( struct berval * ) );
- for ( j = 0; !BER_BVISNULL( &ml->sml_values[ j ] ); j++ ) {
- ldap_back_map( &li->targets[ candidate ]->mt_rwmap.rwm_oc,
- &ml->sml_values[ j ],
- &mapped, BACKLDAP_MAP );
- if ( BER_BVISNULL( &mapped ) || BER_BVISEMPTY( &mapped ) )
- {
- continue;
+ for ( j = 0; !BER_BVISNULL( &ml->sml_values[ j ] ); ) {
+ struct ldapmapping *mapping;
+
+ ldap_back_mapping( &li->targets[ candidate ]->mt_rwmap.rwm_oc,
+ &ml->sml_values[ j ], &mapping, BACKLDAP_MAP );
+
+ if ( mapping == NULL ) {
+ if ( li->targets[ candidate ]->mt_rwmap.rwm_oc.drop_missing ) {
+ continue;
+ }
+ mods[ i ].mod_bvalues[ j ] = &ml->sml_values[ j ];
+
+ } else {
+ mods[ i ].mod_bvalues[ j ] = &mapping->dst;
}
- mods[ i ].mod_bvalues[ j ] = &mapped;
+ j++;
}
mods[ i ].mod_bvalues[ j ] = NULL;
modv[ i ] = 0;
rs->sr_err = ldap_modify_ext_s( lc->mc_conns[ candidate ].msc_ld, mdn.bv_val,
- modv, NULL, NULL );
+ modv, op->o_ctrls, NULL );
cleanup:;
if ( mdn.bv_val != op->o_req_dn.bv_val ) {