*/
static int
init_one_conn(
- Operation *op,
- SlapReply *rs,
+ Operation *op,
+ SlapReply *rs,
struct metatarget *lt,
struct metasingleconn *lsc
)
{
- int err, vers;
+ int vers;
+ dncookie dc;
/*
* Already init'ed
/*
* Attempts to initialize the connection to the target ds
*/
- err = ldap_initialize( &lsc->ld, lt->uri );
- if ( err != LDAP_SUCCESS ) {
- return ldap_back_map_result( err );
+ rs->sr_err = ldap_initialize( &lsc->ld, lt->uri );
+ if ( rs->sr_err != LDAP_SUCCESS ) {
+ return ldap_back_map_result( rs );
}
/*
/*
* Sets a cookie for the rewrite session
*/
- ( void )rewrite_session_init( lt->rwinfo, op->o_conn );
+ ( void )rewrite_session_init( lt->rwmap.rwm_rw, op->o_conn );
/*
* If the connection dn is not null, an attempt to rewrite it is made
*/
if ( op->o_conn->c_dn.bv_len != 0 ) {
+ dc.rwmap = <->rwmap;
+ dc.conn = op->o_conn;
+ dc.rs = rs;
+ dc.ctx = "bindDn";
/*
* Rewrite the bind dn if needed
*/
- lsc->bound_dn.bv_val = NULL;
- switch ( rewrite_session( lt->rwinfo, "bindDn",
- op->o_conn->c_dn.bv_val, op->o_conn,
- &lsc->bound_dn.bv_val ) ) {
- case REWRITE_REGEXEC_OK:
- if ( lsc->bound_dn.bv_val == NULL ) {
- ber_dupbv( &lsc->bound_dn, &op->o_conn->c_dn );
- }
-#ifdef NEW_LOGGING
- LDAP_LOG( BACK_META, DETAIL1,
- "[rw] bindDn: \"%s\" -> \"%s\"\n",
- op->o_conn->c_dn.bv_val,
- lsc->bound_dn.bv_val, 0 );
-#else /* !NEW_LOGGING */
- Debug( LDAP_DEBUG_ARGS,
- "rw> bindDn: \"%s\" -> \"%s\"\n",
- op->o_conn->c_dn.bv_val,
- lsc->bound_dn.bv_val, 0 );
-#endif /* !NEW_LOGGING */
- break;
-
- case REWRITE_REGEXEC_UNWILLING:
- rs->sr_err = LDAP_UNWILLING_TO_PERFORM;
- rs->sr_text = "Operation not allowed";
-#if 0
- send_ldap_result( conn, op,
- LDAP_UNWILLING_TO_PERFORM,
- NULL, "Operation not allowed",
- NULL, NULL );
-#endif
- return rs->sr_err;
-
- case REWRITE_REGEXEC_ERR:
- rs->sr_err = LDAP_OTHER;
- rs->sr_text = "Rewrite error";
-#if 0
- send_ldap_result( conn, op,
- LDAP_OTHER,
- NULL, "Rewrite error",
- NULL, NULL );
-#endif
+ if ( ldap_back_dn_massage( &dc, &op->o_conn->c_dn, &lsc->bound_dn) ) {
+ send_ldap_result( op, rs );
return rs->sr_err;
}