From: Stefan Metzmacher Date: Sun, 13 Aug 2023 11:34:30 +0000 (+0200) Subject: s3:rpc_server: let create_policy_hnd() return a pointer X-Git-Tag: talloc-2.4.2~1245 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=ac392c35e4993e1f4bd25519c607a00508e57de4;p=thirdparty%2Fsamba.git s3:rpc_server: let create_policy_hnd() return a pointer This allows a TALLOC_FREE() on it to unregister and destroy the handle easily. Signed-off-by: Stefan Metzmacher Reviewed-by: Andrew Bartlett --- diff --git a/source3/rpc_server/rpc_handles.c b/source3/rpc_server/rpc_handles.c index 60ee11df457..928b10ec7f7 100644 --- a/source3/rpc_server/rpc_handles.c +++ b/source3/rpc_server/rpc_handles.c @@ -67,23 +67,23 @@ static int hnd_cnt_destructor(struct hnd_cnt *cnt) return 0; } -bool create_policy_hnd(struct pipes_struct *p, - struct policy_handle *hnd, - uint8_t handle_type, - void *data_ptr) +void *create_policy_hnd(struct pipes_struct *p, + struct policy_handle *hnd, + uint8_t handle_type, + void *data_ptr) { struct dcesrv_handle *rpc_hnd = NULL; struct hnd_cnt *cnt = NULL; rpc_hnd = dcesrv_handle_create(p->dce_call, handle_type); if (rpc_hnd == NULL) { - return false; + return NULL; } cnt = talloc_zero(rpc_hnd, struct hnd_cnt); if (cnt == NULL) { TALLOC_FREE(rpc_hnd); - return false; + return NULL; } talloc_set_destructor(cnt, hnd_cnt_destructor); @@ -95,7 +95,7 @@ bool create_policy_hnd(struct pipes_struct *p, num_handles++; - return true; + return rpc_hnd; } /**************************************************************************** diff --git a/source3/rpc_server/rpc_pipes.h b/source3/rpc_server/rpc_pipes.h index ef45191ffa4..17922b07bbe 100644 --- a/source3/rpc_server/rpc_pipes.h +++ b/source3/rpc_server/rpc_pipes.h @@ -55,7 +55,7 @@ struct pipes_struct { bool check_open_pipes(void); size_t num_pipe_handles(void); -bool create_policy_hnd(struct pipes_struct *p, +void *create_policy_hnd(struct pipes_struct *p, struct policy_handle *hnd, uint8_t handle_type, void *data_ptr);