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

librpc/rpc: add dcesrv_async_reply() helper that disconnects as needed

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
Stefan Metzmacher 2023-08-14 12:58:14 +02:00 committed by Andrew Bartlett
parent 5a6978205e
commit b8eae78225
2 changed files with 24 additions and 0 deletions

View File

@ -514,7 +514,16 @@ void dcesrv_context_set_callbacks(
struct dcesrv_context *dce_ctx,
struct dcesrv_context_callbacks *cb);
/*
* Use dcesrv_async_reply() in async code
*/
NTSTATUS dcesrv_reply(struct dcesrv_call_state *call);
void _dcesrv_async_reply(struct dcesrv_call_state *call,
const char *func,
const char *location);
#define dcesrv_async_reply(__call) \
_dcesrv_async_reply(__call, __func__, __location__)
struct dcesrv_handle *dcesrv_handle_create(struct dcesrv_call_state *call,
uint8_t handle_type);

View File

@ -267,3 +267,18 @@ _PUBLIC_ NTSTATUS dcesrv_reply(struct dcesrv_call_state *call)
return NT_STATUS_OK;
}
_PUBLIC_ void _dcesrv_async_reply(struct dcesrv_call_state *call,
const char *func,
const char *location)
{
struct dcesrv_connection *conn = call->conn;
NTSTATUS status;
status = dcesrv_reply(call);
if (!NT_STATUS_IS_OK(status)) {
D_ERR("%s: %s: dcesrv_async_reply() failed - %s\n",
func, location, nt_errstr(status));
dcesrv_terminate_connection(conn, nt_errstr(status));
}
}