1
0
mirror of https://github.com/samba-team/samba.git synced 2025-08-03 04:22:09 +03:00

s4-ldap_server Allow multiple binds on LDAP server

Autobuild-User: Andrew Bartlett <abartlet@samba.org>
Autobuild-Date: Fri Jan  7 00:02:23 CET 2011 on sn-devel-104
This commit is contained in:
Andrew Bartlett
2011-01-06 15:25:29 +11:00
parent fa1fd85eea
commit a7bdb49188

View File

@ -243,12 +243,26 @@ static NTSTATUS ldapsrv_BindSASL(struct ldapsrv_call *call)
req->creds.SASL.mechanism); req->creds.SASL.mechanism);
} }
if (context && conn->sockets.sasl) {
TALLOC_FREE(context);
status = NT_STATUS_NOT_SUPPORTED;
result = LDAP_UNWILLING_TO_PERFORM;
errstr = talloc_asprintf(reply,
"SASL:[%s]: Sign or Seal are not allowed if SASL encryption has already been set up",
req->creds.SASL.mechanism);
}
if (context) { if (context) {
context->conn = conn; context->conn = conn;
status = gensec_create_tstream(context, status = gensec_create_tstream(context,
context->conn->gensec, context->conn->gensec,
context->conn->sockets.raw, context->conn->sockets.raw,
&context->sasl); &context->sasl);
if (NT_STATUS_IS_OK(status)) {
if (!talloc_reference(context->sasl, conn->gensec)) {
status = NT_STATUS_NO_MEMORY;
}
}
} }
if (result != LDAP_SUCCESS) { if (result != LDAP_SUCCESS) {
@ -294,12 +308,16 @@ static NTSTATUS ldapsrv_BindSASL(struct ldapsrv_call *call)
call->postprocess_recv = ldapsrv_sasl_postprocess_recv; call->postprocess_recv = ldapsrv_sasl_postprocess_recv;
call->postprocess_private = context; call->postprocess_private = context;
} }
talloc_unlink(conn, conn->gensec);
conn->gensec = NULL;
} else { } else {
status = auth_nt_status_squash(status); status = auth_nt_status_squash(status);
if (result == 0) { if (result == 0) {
result = LDAP_INVALID_CREDENTIALS; result = LDAP_INVALID_CREDENTIALS;
errstr = talloc_asprintf(reply, "SASL:[%s]: %s", req->creds.SASL.mechanism, nt_errstr(status)); errstr = talloc_asprintf(reply, "SASL:[%s]: %s", req->creds.SASL.mechanism, nt_errstr(status));
} }
talloc_unlink(conn, conn->gensec);
conn->gensec = NULL;
} }
resp->response.resultcode = result; resp->response.resultcode = result;