]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3/rpc_server: track the number of policy handles with a talloc destructor
authorRalph Boehme <slow@samba.org>
Mon, 9 Aug 2021 13:12:31 +0000 (15:12 +0200)
committerJeremy Allison <jra@samba.org>
Tue, 10 Aug 2021 18:41:43 +0000 (18:41 +0000)
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14783
RN: smbd "deadtime" parameter doesn't work anymore

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Tue Aug 10 18:41:43 UTC 2021 on sn-devel-184

selftest/knownfail.d/samba3.blackbox.deadtime [deleted file]
source3/rpc_server/rpc_handles.c

diff --git a/selftest/knownfail.d/samba3.blackbox.deadtime b/selftest/knownfail.d/samba3.blackbox.deadtime
deleted file mode 100644 (file)
index 99d00fd..0000000
+++ /dev/null
@@ -1 +0,0 @@
-^samba3.blackbox.deadtime.deadtime.*
index 9ef93231466c6b99a692dd988cdb0e68bc0c4b86..745ea4dd6ef58583c4c027978eeb09451d45733c 100644 (file)
@@ -103,18 +103,36 @@ size_t num_pipe_handles(void)
   data_ptr is TALLOC_FREE()'ed
 ****************************************************************************/
 
+struct hnd_cnt {
+       bool _dummy;
+};
+
+static int hnd_cnt_destructor(struct hnd_cnt *cnt)
+{
+       num_handles--;
+       return 0;
+}
+
 bool 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;
        }
 
+       cnt = talloc_zero(rpc_hnd, struct hnd_cnt);
+       if (cnt == NULL) {
+               TALLOC_FREE(rpc_hnd);
+               return false;
+       }
+       talloc_set_destructor(cnt, hnd_cnt_destructor);
+
        if (data_ptr != NULL) {
                rpc_hnd->data = talloc_move(rpc_hnd, &data_ptr);
        }
@@ -205,8 +223,6 @@ bool close_policy_hnd(struct pipes_struct *p,
 
        TALLOC_FREE(rpc_hnd);
 
-       num_handles--;
-
        return true;
 }