From: Stefan Metzmacher Date: Fri, 12 May 2017 10:26:12 +0000 (+0200) Subject: s4:ldap_server: make the gensec_create_tstream() error checking more clear X-Git-Tag: ldb-1.1.31~38 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a2803671774fc4c02dfb42ea2527dc89964b4731;p=thirdparty%2Fsamba.git s4:ldap_server: make the gensec_create_tstream() error checking more clear Check with 'git show -w'. Signed-off-by: Stefan Metzmacher Reviewed-by: Andrew Bartlett --- diff --git a/source4/ldap_server/ldap_bind.c b/source4/ldap_server/ldap_bind.c index 352e67da1a7..cd6b7e43f96 100644 --- a/source4/ldap_server/ldap_bind.c +++ b/source4/ldap_server/ldap_bind.c @@ -499,21 +499,20 @@ static NTSTATUS ldapsrv_BindSASL(struct ldapsrv_call *call) context->conn->gensec, context->conn->sockets.raw, &context->sasl); - if (NT_STATUS_IS_OK(status)) { - if (!talloc_reference(context->sasl, conn->gensec)) { - return NT_STATUS_NO_MEMORY; - } - } - } - - if (!NT_STATUS_IS_OK(status)) { - result = LDAP_OPERATIONS_ERROR; - errstr = talloc_asprintf(reply, + if (!NT_STATUS_IS_OK(status)) { + result = LDAP_OPERATIONS_ERROR; + errstr = talloc_asprintf(reply, "SASL:[%s]: Failed to setup SASL socket: %s", req->creds.SASL.mechanism, nt_errstr(status)); - goto do_reply; - } else { + goto do_reply; + } + if (!talloc_reference(context->sasl, conn->gensec)) { + return NT_STATUS_NO_MEMORY; + } + } + + { status = gensec_session_info(conn->gensec, call, &session_info); if (!NT_STATUS_IS_OK(status)) { result = LDAP_OPERATIONS_ERROR;