From: Stefan Metzmacher Date: Mon, 16 Apr 2018 14:08:29 +0000 (+0200) Subject: netlogon_creds_cli: add netlogon_creds_cli_SendToSam_recv() and don't ignore result X-Git-Tag: ldb-2.5.0~385 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8a607e7577a259ae8a786f436241b41b6cc6c884;p=thirdparty%2Fsamba.git netlogon_creds_cli: add netlogon_creds_cli_SendToSam_recv() and don't ignore result This is a low level function that should not ignore results. If the caller doesn't care it's his choice. Signed-off-by: Stefan Metzmacher Reviewed-by: Jeremy Allison Autobuild-User(master): Jeremy Allison Autobuild-Date(master): Tue Oct 19 20:20:00 UTC 2021 on sn-devel-184 --- diff --git a/libcli/auth/netlogon_creds_cli.c b/libcli/auth/netlogon_creds_cli.c index e78bc173968..beab2fae53a 100644 --- a/libcli/auth/netlogon_creds_cli.c +++ b/libcli/auth/netlogon_creds_cli.c @@ -3820,6 +3820,20 @@ static void netlogon_creds_cli_SendToSam_done(struct tevent_req *subreq) tevent_req_done(req); } +NTSTATUS netlogon_creds_cli_SendToSam_recv(struct tevent_req *req) +{ + NTSTATUS status; + + if (tevent_req_is_nterror(req, &status)) { + netlogon_creds_cli_SendToSam_cleanup(req, status); + tevent_req_received(req); + return status; + } + + tevent_req_received(req); + return NT_STATUS_OK; +} + NTSTATUS netlogon_creds_cli_SendToSam(struct netlogon_creds_cli_context *context, struct dcerpc_binding_handle *b, struct netr_SendToSamBase *message) @@ -3827,7 +3841,7 @@ NTSTATUS netlogon_creds_cli_SendToSam(struct netlogon_creds_cli_context *context TALLOC_CTX *frame = talloc_stackframe(); struct tevent_context *ev; struct tevent_req *req; - NTSTATUS status = NT_STATUS_OK; + NTSTATUS status = NT_STATUS_NO_MEMORY; ev = samba_tevent_context_init(frame); if (ev == NULL) { @@ -3840,8 +3854,7 @@ NTSTATUS netlogon_creds_cli_SendToSam(struct netlogon_creds_cli_context *context if (!tevent_req_poll_ntstatus(req, ev, &status)) { goto fail; } - - /* Ignore the result */ + status = netlogon_creds_cli_SendToSam_recv(req); fail: TALLOC_FREE(frame); return status; diff --git a/libcli/auth/netlogon_creds_cli.h b/libcli/auth/netlogon_creds_cli.h index 7fb41872c36..6f40a46aa0a 100644 --- a/libcli/auth/netlogon_creds_cli.h +++ b/libcli/auth/netlogon_creds_cli.h @@ -208,7 +208,7 @@ struct tevent_req *netlogon_creds_cli_SendToSam_send(TALLOC_CTX *mem_ctx, struct netlogon_creds_cli_context *context, struct dcerpc_binding_handle *b, struct netr_SendToSamBase *message); - +NTSTATUS netlogon_creds_cli_SendToSam_recv(struct tevent_req *req); NTSTATUS netlogon_creds_cli_SendToSam( struct netlogon_creds_cli_context *context, struct dcerpc_binding_handle *b,