]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/back-meta/conn.c
silence warning
[openldap] / servers / slapd / back-meta / conn.c
index 7cb947ec6c9be49fa7110f263d9fdddf6598436a..f13352e7bbd654911bb9dd80a4b7683b52b6ef21 100644 (file)
@@ -221,13 +221,14 @@ metaconn_free(
  */
 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
@@ -239,9 +240,9 @@ init_one_conn(
        /*
         * 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 );
        }
 
        /*
@@ -256,57 +257,22 @@ init_one_conn(
        /*
         * 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 = &lt->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;
                }