From c254349261e0a59e4403c314ec8c17aa6b7dfc37 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sat, 14 Nov 2009 09:38:20 +0100 Subject: Introduce tevent_req_simple_finish_ntstatus --- lib/util/tevent_ntstatus.c | 15 +++++++++++++++ lib/util/tevent_ntstatus.h | 7 +++++++ 2 files changed, 22 insertions(+) (limited to 'lib') diff --git a/lib/util/tevent_ntstatus.c b/lib/util/tevent_ntstatus.c index d6cb0affd9..4be4575499 100644 --- a/lib/util/tevent_ntstatus.c +++ b/lib/util/tevent_ntstatus.c @@ -59,3 +59,18 @@ NTSTATUS tevent_req_simple_recv_ntstatus(struct tevent_req *req) } return NT_STATUS_OK; } + +void tevent_req_simple_finish_ntstatus(struct tevent_req *subreq, + NTSTATUS subreq_status) +{ + struct tevent_req *req = tevent_req_callback_data( + subreq, struct tevent_req); + + TALLOC_FREE(subreq); + + if (!NT_STATUS_IS_OK(subreq_status)) { + tevent_req_nterror(req, subreq_status); + return; + } + tevent_req_done(req); +} diff --git a/lib/util/tevent_ntstatus.h b/lib/util/tevent_ntstatus.h index 22fe9188d0..4cf593a454 100644 --- a/lib/util/tevent_ntstatus.h +++ b/lib/util/tevent_ntstatus.h @@ -29,4 +29,11 @@ bool tevent_req_nterror(struct tevent_req *req, NTSTATUS status); bool tevent_req_is_nterror(struct tevent_req *req, NTSTATUS *pstatus); NTSTATUS tevent_req_simple_recv_ntstatus(struct tevent_req *req); +/* + * Helper routine to pass the subreq_ntstatus to the req embedded in + * tevent_req_callback_data(subreq), which will be freed. + */ +void tevent_req_simple_finish_ntstatus(struct tevent_req *subreq, + NTSTATUS subreq_status); + #endif -- cgit