]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/bind.c
Fix last commit.
[openldap] / servers / slapd / bind.c
index 81898e3ea083dd5c6bf159d522581e6e789db920..9d8f6ba159786fa900a97ebddd1d28411befb35f 100644 (file)
@@ -45,7 +45,7 @@ do_bind(
        int     rc = LDAP_SUCCESS;
        const char *text;
        struct berval cred = { 0, NULL };
-       Backend *be;
+       Backend *be = NULL;
 
 #ifdef NEW_LOGGING
        LDAP_LOG( OPERATION, ENTRY, "do_bind: conn %d\n", conn->c_connid, 0, 0 );
@@ -231,6 +231,10 @@ do_bind(
                goto cleanup;
        }
 
+       /* Set the bindop for the benefit of in-directory SASL lookups */
+       ldap_pvt_thread_mutex_lock( &conn->c_sasl_bindmutex );
+       conn->c_sasl_bindop = op;
+
        if ( method == LDAP_AUTH_SASL ) {
                slap_ssf_t ssf = 0;
 
@@ -312,6 +316,16 @@ do_bind(
                                        LBER_SB_OPT_SET_MAX_INCOMING, &max );
                        }
 
+#ifdef NEW_LOGGING
+                       LDAP_LOG( OPERATION, DETAIL1, 
+                               "do_bind: SASL/%s bind: dn=\"%s\" ssf=%d\n",
+                               conn->c_authmech.bv_val, conn->c_dn.bv_val, ssf );
+#else
+                       Debug( LDAP_DEBUG_TRACE,
+                               "do_bind: SASL/%s bind: dn=\"%s\" ssf=%d\n",
+                               conn->c_authmech.bv_val, conn->c_dn.bv_val, ssf );
+#endif
+
                } else if ( rc == LDAP_SASL_BIND_IN_PROGRESS ) {
                        conn->c_sasl_bind_in_progress = 1;
 
@@ -560,6 +574,11 @@ do_bind(
        }
 
 cleanup:
+       if( conn->c_sasl_bindop != NULL ) {
+               conn->c_sasl_bindop = NULL;
+               ldap_pvt_thread_mutex_unlock( &conn->c_sasl_bindmutex );
+       }
+
        if( pdn.bv_val != NULL ) {
                free( pdn.bv_val );
        }