1
0
mirror of https://github.com/samba-team/samba.git synced 2025-03-12 20:58:37 +03:00

tldap: Make sure all requests are cancelled on rundown

Put messages into the ld->pending array before sending them out, not
after they have been sent.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=14465

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
This commit is contained in:
Volker Lendecke 2020-08-11 17:44:42 +02:00
parent f745f5b125
commit 2a2a6b27cc

View File

@ -29,6 +29,7 @@
#include "../lib/util/tevent_unix.h"
static TLDAPRC tldap_simple_recv(struct tevent_req *req);
static bool tldap_msg_set_pending(struct tevent_req *req);
#define TEVENT_TLDAP_RC_MAGIC (0x87bcd26e)
@ -521,6 +522,11 @@ static struct tevent_req *tldap_msg_send(TALLOC_CTX *mem_ctx,
return tevent_req_post(req, ev);
}
if (!tldap_msg_set_pending(req)) {
tevent_req_oom(req);
return tevent_req_post(req, ev);;
}
state->iov.iov_base = (void *)blob.data;
state->iov.iov_len = blob.length;
@ -633,12 +639,6 @@ static void tldap_msg_sent(struct tevent_req *subreq)
TALLOC_FREE(subreq);
if (nwritten == -1) {
tldap_context_disconnect(state->ld, TLDAP_SERVER_DOWN);
tevent_req_ldap_error(req, TLDAP_SERVER_DOWN);
return;
}
if (!tldap_msg_set_pending(req)) {
tevent_req_oom(req);
return;
}
}