]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3:rpc_server: let create_policy_hnd() return a pointer
authorStefan Metzmacher <metze@samba.org>
Sun, 13 Aug 2023 11:34:30 +0000 (13:34 +0200)
committerAndrew Bartlett <abartlet@samba.org>
Tue, 17 Oct 2023 19:20:38 +0000 (19:20 +0000)
This allows a TALLOC_FREE() on it to unregister and destroy the
handle easily.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
source3/rpc_server/rpc_handles.c
source3/rpc_server/rpc_pipes.h

index 60ee11df45715a9eb56119d464e1dd564119e1f7..928b10ec7f7284831df75a11a12b71bb109903b3 100644 (file)
@@ -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;
 }
 
 /****************************************************************************
index ef45191ffa4ae2f078a898cc5b1b5237d521a4dd..17922b07bbe33de51e28887eac2c86b558e7f348 100644 (file)
@@ -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);