From 5c876f85e609b55dea00c6eed1fa31bf7f08cd49 Mon Sep 17 00:00:00 2001 From: Kurt Zeilenga Date: Fri, 24 Sep 1999 02:19:31 +0000 Subject: [PATCH] bind should not return noSuchObject --- servers/slapd/back-bdb2/bind.c | 24 ++++++++++++++++++------ servers/slapd/back-ldbm/bind.c | 22 ++++++++++++++++++---- 2 files changed, 36 insertions(+), 10 deletions(-) diff --git a/servers/slapd/back-bdb2/bind.c b/servers/slapd/back-bdb2/bind.c index 40652e5579..7455b1fc8c 100644 --- a/servers/slapd/back-bdb2/bind.c +++ b/servers/slapd/back-bdb2/bind.c @@ -113,9 +113,13 @@ bdb2i_back_bind_internal( *edn = ch_strdup( be_root_dn( be ) ); rc = 0; - } else { + } else if ( refs != NULL ) { send_ldap_result( conn, op, LDAP_REFERRAL, matched_dn, NULL, refs, NULL ); + + } else { + send_ldap_result( conn, op, LDAP_INVALID_CREDENTIALS, + NULL, NULL, NULL, NULL ); } } else if ( method == LDAP_AUTH_SASL ) { @@ -129,10 +133,13 @@ bdb2i_back_bind_internal( NULL, NULL, NULL, NULL ); } - } else { + } else if ( refs != NULL ) { send_ldap_result( conn, op, LDAP_REFERRAL, matched_dn, NULL, refs, NULL ); - rc = 1; + + } else { + send_ldap_result( conn, op, LDAP_INVALID_CREDENTIALS, + NULL, NULL, NULL, NULL ); } if ( matched != NULL ) { @@ -157,7 +164,7 @@ bdb2i_back_bind_internal( if ( is_entry_alias( e ) ) { /* entry is a alias, don't allow bind */ - Debug( LDAP_DEBUG_TRACE, "entry is referral\n", 0, + Debug( LDAP_DEBUG_TRACE, "entry is alias\n", 0, 0, 0 ); send_ldap_result( conn, op, LDAP_ALIAS_PROBLEM, @@ -176,8 +183,13 @@ bdb2i_back_bind_internal( Debug( LDAP_DEBUG_TRACE, "entry is referral\n", 0, 0, 0 ); - send_ldap_result( conn, op, LDAP_REFERRAL, - e->e_dn, NULL, refs, NULL ); + if( refs != NULL ) { + send_ldap_result( conn, op, LDAP_REFERRAL, + e->e_dn, NULL, refs, NULL ); + } else { + send_ldap_result( conn, op, LDAP_INVALID_CREDENTIALS, + NULL, NULL, NULL, NULL ); + } ber_bvecfree( refs ); diff --git a/servers/slapd/back-ldbm/bind.c b/servers/slapd/back-ldbm/bind.c index aa60133725..52234e336a 100644 --- a/servers/slapd/back-ldbm/bind.c +++ b/servers/slapd/back-ldbm/bind.c @@ -120,9 +120,13 @@ ldbm_back_bind( *edn = ch_strdup( be_root_dn( be ) ); rc = 0; /* front end will send result */ - } else { + } else if ( refs != NULL ) { send_ldap_result( conn, op, LDAP_REFERRAL, matched_dn, NULL, refs, NULL ); + + } else { + send_ldap_result( conn, op, LDAP_INVALID_CREDENTIALS, + NULL, NULL, NULL, NULL ); } } else if ( method == LDAP_AUTH_SASL ) { @@ -136,9 +140,13 @@ ldbm_back_bind( NULL, NULL, NULL, NULL ); } - } else { + } else if ( refs != NULL ) { send_ldap_result( conn, op, LDAP_REFERRAL, matched_dn, NULL, refs, NULL ); + + } else { + send_ldap_result( conn, op, LDAP_INVALID_CREDENTIALS, + NULL, NULL, NULL, NULL ); } if ( matched != NULL ) { @@ -181,8 +189,14 @@ ldbm_back_bind( Debug( LDAP_DEBUG_TRACE, "entry is referral\n", 0, 0, 0 ); - send_ldap_result( conn, op, LDAP_REFERRAL, - e->e_dn, NULL, refs, NULL ); + if( refs != NULL ) { + send_ldap_result( conn, op, LDAP_REFERRAL, + e->e_dn, NULL, refs, NULL ); + + } else { + send_ldap_result( conn, op, LDAP_INVALID_CREDENTIALS, + NULL, NULL, NULL, NULL ); + } ber_bvecfree( refs ); -- 2.39.5