mirror of
https://github.com/samba-team/samba.git
synced 2025-02-25 17:57:42 +03:00
s3/rpc_server: track the number of policy handles with a talloc destructor
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
This commit is contained in:
parent
39db53a139
commit
45a33b25c4
@ -1 +0,0 @@
|
|||||||
^samba3.blackbox.deadtime.deadtime.*
|
|
@ -103,18 +103,36 @@ size_t num_pipe_handles(void)
|
|||||||
data_ptr is TALLOC_FREE()'ed
|
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,
|
bool create_policy_hnd(struct pipes_struct *p,
|
||||||
struct policy_handle *hnd,
|
struct policy_handle *hnd,
|
||||||
uint8_t handle_type,
|
uint8_t handle_type,
|
||||||
void *data_ptr)
|
void *data_ptr)
|
||||||
{
|
{
|
||||||
struct dcesrv_handle *rpc_hnd = NULL;
|
struct dcesrv_handle *rpc_hnd = NULL;
|
||||||
|
struct hnd_cnt *cnt = NULL;
|
||||||
|
|
||||||
rpc_hnd = dcesrv_handle_create(p->dce_call, handle_type);
|
rpc_hnd = dcesrv_handle_create(p->dce_call, handle_type);
|
||||||
if (rpc_hnd == NULL) {
|
if (rpc_hnd == NULL) {
|
||||||
return false;
|
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) {
|
if (data_ptr != NULL) {
|
||||||
rpc_hnd->data = talloc_move(rpc_hnd, &data_ptr);
|
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);
|
TALLOC_FREE(rpc_hnd);
|
||||||
|
|
||||||
num_handles--;
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user