]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/bind.c
Fixup bdb_entry_release now that entry_decode uses two memory blocks
[openldap] / servers / slapd / bind.c
index 05b95eae828b343f9580a0ccbc101e336b56cffa..6378d78ddf0ddfca8d1e42439ca356336953ff03 100644 (file)
@@ -280,10 +280,18 @@ do_bind(
                        conn->c_authmech = conn->c_sasl_bind_mech;
                        conn->c_sasl_bind_mech = NULL;
                        conn->c_sasl_bind_in_progress = 0;
+
                        conn->c_sasl_ssf = ssf;
                        if( ssf > conn->c_ssf ) {
                                conn->c_ssf = ssf;
                        }
+
+                       if( conn->c_dn != NULL ) {
+                               ber_len_t max = sockbuf_max_incoming;
+                               ber_sockbuf_ctrl( conn->c_sb,
+                                       LBER_SB_OPT_SET_MAX_INCOMING, &max );
+                       }
+
                } else if ( rc == LDAP_SASL_BIND_IN_PROGRESS ) {
                        conn->c_sasl_bind_in_progress = 1;
 
@@ -404,11 +412,11 @@ do_bind(
                        NULL, text, NULL, NULL );
 #ifdef NEW_LOGGING
                LDAP_LOG(( "operation", LDAP_LEVEL_INFO,
-                          "do_bind: conn %d  v%d unknown authentication method (%d)\n",
+                          "do_bind: conn %ld  v%d unknown authentication method (%ld)\n",
                           conn->c_connid, version, method ));
 #else
                Debug( LDAP_DEBUG_TRACE,
-                       "do_bind: v%d unknown authentication method (%d)\n",
+                       "do_bind: v%d unknown authentication method (%ld)\n",
                        version, method, 0 );
 #endif
                goto cleanup;
@@ -422,8 +430,13 @@ do_bind(
 
        if ( (be = select_backend( ndn, 0 )) == NULL ) {
                if ( default_referral ) {
+                       struct berval **ref = referral_rewrite( default_referral,
+                               NULL, dn, LDAP_SCOPE_DEFAULT );
+
                        send_ldap_result( conn, op, rc = LDAP_REFERRAL,
-                               NULL, NULL, default_referral, NULL );
+                               NULL, NULL, ref ? ref : default_referral, NULL );
+
+                       ber_bvecfree( ref );
 
                } else {
                        /* noSuchObject is not allowed to be returned by bind */
@@ -468,6 +481,12 @@ do_bind(
                                ndn = NULL;
                        }
 
+                       if( conn->c_dn != NULL ) {
+                               ber_len_t max = sockbuf_max_incoming;
+                               ber_sockbuf_ctrl( conn->c_sb,
+                                       LBER_SB_OPT_SET_MAX_INCOMING, &max );
+                       }
+
 #ifdef NEW_LOGGING
                        LDAP_LOG(( "operation", LDAP_LEVEL_DETAIL1,
                                   "do_bind: conn %d  v%d bind: \"%s\" to \"%s\" \n",