]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/bind.c
further clarify size limit related issues in sync replication (ITS#5243)
[openldap] / servers / slapd / bind.c
index 1c1d4db1f198dbea9ba4a11c6218df8972b223f9..47602fa1811b6eb8413a6e6d3a0d8c5773a40dbe 100644 (file)
@@ -2,7 +2,7 @@
 /* $OpenLDAP$ */
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *
- * Copyright 1998-2005 The OpenLDAP Foundation.
+ * Copyright 1998-2007 The OpenLDAP Foundation.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -223,6 +223,7 @@ int
 fe_op_bind( Operation *op, SlapReply *rs )
 {
        struct berval   mech = op->orb_tmp_mech;
+       BackendDB       *bd = op->o_bd;
 
        /* check for inappropriate controls */
        if( get_manageDSAit( op ) == SLAP_CONTROL_CRITICAL ) {
@@ -232,9 +233,6 @@ fe_op_bind( Operation *op, SlapReply *rs )
                goto cleanup;
        }
 
-       /* Set the bindop for the benefit of in-directory SASL lookups */
-       op->o_conn->c_sasl_bindop = op;
-
        if ( op->orb_method == LDAP_AUTH_SASL ) {
                if ( op->o_protocol < LDAP_VERSION3 ) {
                        Debug( LDAP_DEBUG_ANY, "do_bind: sasl with LDAPv%ld\n",
@@ -269,6 +267,10 @@ fe_op_bind( Operation *op, SlapReply *rs )
                } else {
                        ber_dupbv(&op->o_conn->c_sasl_bind_mech, &mech);
                }
+       
+               /* Set the bindop for the benefit of in-directory SASL lookups */
+               op->o_conn->c_sasl_bindop = op;
+
                ldap_pvt_thread_mutex_unlock( &op->o_conn->c_mutex );
 
                rs->sr_err = slap_sasl_bind( op, rs );
@@ -379,17 +381,15 @@ fe_op_bind( Operation *op, SlapReply *rs )
 
        /*
         * We could be serving multiple database backends.  Select the
-        * appropriate one, or send a referral to our "referral server"
-        * if we don't hold it.
+        * appropriate one.  If none, return invalid cred, not a referral.
         */
 
        if ( (op->o_bd = select_backend( &op->o_req_ndn, 0, 0 )) == NULL ) {
                /* don't return referral for bind requests */
                /* noSuchObject is not allowed to be returned by bind */
                rs->sr_err = LDAP_INVALID_CREDENTIALS;
-               op->o_bd = frontendDB;
+               op->o_bd = bd;
                send_ldap_result( op, rs );
-               op->o_bd = NULL;
                goto cleanup;
        }
 
@@ -452,6 +452,7 @@ fe_op_bind( Operation *op, SlapReply *rs )
        }
 
 cleanup:;
+       op->o_bd = bd;
        return rs->sr_err;
 }