From 50f5c4bea75124ca7bbc5c7e2cf9944a5715edde Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Kuzn=C3=ADk?= Date: Fri, 14 Apr 2017 09:40:44 +0100 Subject: [PATCH] Report initial bind errors to client --- servers/lloadd/bind.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/servers/lloadd/bind.c b/servers/lloadd/bind.c index 76cd45e365..a658fa0682 100644 --- a/servers/lloadd/bind.c +++ b/servers/lloadd/bind.c @@ -122,6 +122,8 @@ request_bind_as_vc( Operation *op ) Connection *client = op->o_client, *upstream = op->o_upstream; BerElement *ber, *request, *copy = NULL; BerValue binddn, auth, mech; + char *msg = "internal error"; + int result = LDAP_OTHER; ber_int_t version; ber_tag_t tag; ber_len_t len; @@ -133,6 +135,8 @@ request_bind_as_vc( Operation *op ) tag = ber_scanf( request, "im", &version, &binddn ); if ( tag == LBER_ERROR || version != LDAP_VERSION3 ) { + result = LDAP_PROTOCOL_ERROR; + msg = "version not recognised"; goto fail; } @@ -143,6 +147,8 @@ request_bind_as_vc( Operation *op ) tag = ber_skip_element( request, &auth ); if ( tag == LBER_ERROR ) { + result = LDAP_PROTOCOL_ERROR; + msg = "malformed bind request"; goto fail; } @@ -204,6 +210,8 @@ request_bind_as_vc( Operation *op ) ldap_pvt_thread_mutex_unlock( &client->c_mutex ); break; default: + result = LDAP_PROTOCOL_ERROR; + msg = "malformed bind request"; goto fail; } @@ -225,6 +233,7 @@ fail: ber_free( copy, 0 ); } ldap_pvt_thread_mutex_unlock( &upstream->c_io_mutex ); + operation_send_reject( op, result, msg, 1 ); ldap_pvt_thread_mutex_lock( &client->c_mutex ); client_destroy( client ); return 1;