From: Volker Lendecke Date: Thu, 24 Oct 2024 11:59:42 +0000 (+0200) Subject: cldap: Save a few lines in cldap_netlogon X-Git-Tag: tdb-1.4.13~844 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=0e08e63ae8bf4507779d6109e7f55da9d716053f;p=thirdparty%2Fsamba.git cldap: Save a few lines in cldap_netlogon Follow recent convention to write sync wrappers Signed-off-by: Volker Lendecke Reviewed-by: Ralph Boehme Autobuild-User(master): Ralph Böhme Autobuild-Date(master): Fri Oct 25 09:04:11 UTC 2024 on atb-devel-224 --- diff --git a/libcli/cldap/cldap.c b/libcli/cldap/cldap.c index cf8d020c5e3..022bb2bfa21 100644 --- a/libcli/cldap/cldap.c +++ b/libcli/cldap/cldap.c @@ -1069,7 +1069,7 @@ NTSTATUS cldap_netlogon(struct cldap_socket *cldap, TALLOC_CTX *frame; struct tevent_req *req; struct tevent_context *ev; - NTSTATUS status; + NTSTATUS status = NT_STATUS_NO_MEMORY; if (cldap->searches.list) { return NT_STATUS_PIPE_BUSY; @@ -1083,29 +1083,22 @@ NTSTATUS cldap_netlogon(struct cldap_socket *cldap, ev = samba_tevent_context_init(frame); if (ev == NULL) { - TALLOC_FREE(frame); - return NT_STATUS_NO_MEMORY; + goto done; } - req = cldap_netlogon_send(mem_ctx, ev, cldap, io); if (req == NULL) { - TALLOC_FREE(frame); - return NT_STATUS_NO_MEMORY; + goto done; } - if (!tevent_req_poll_ntstatus(req, ev, &status)) { - TALLOC_FREE(frame); - return status; + goto done; } - status = cldap_netlogon_recv(req, mem_ctx, io); if (!NT_STATUS_IS_OK(status)) { - TALLOC_FREE(frame); - return status; + goto done; } - +done: TALLOC_FREE(frame); - return NT_STATUS_OK; + return status; }