mirror of
https://github.com/samba-team/samba.git
synced 2025-02-25 17:57:42 +03:00
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 <metze@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
parent
403bceef91
commit
ac392c35e4
@ -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;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
|
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user