RPC_HDR hdr; /* Incoming RPC header. */
RPC_HDR_REQ hdr_req; /* Incoming request header. */
- /* This context is used for pipe state storage and is freed when the pipe is closed. */
- TALLOC_CTX *pipe_state_mem_ctx;
-
struct pipe_auth_data auth;
struct dcinfo *dc; /* Keeps the creds data from netlogon. */
struct netr_ServerReqChallenge *r)
{
if (!p->dc) {
- p->dc = TALLOC_ZERO_P(p->pipe_state_mem_ctx, struct dcinfo);
+ p->dc = TALLOC_ZERO_P(p, struct dcinfo);
if (!p->dc) {
return NT_STATUS_NO_MEMORY;
}
if (!p->dc) {
/* Restore the saved state of the netlogon creds. */
become_root();
- ret = secrets_restore_schannel_session_info(p->pipe_state_mem_ctx,
- remote_machine,
- &p->dc);
+ ret = secrets_restore_schannel_session_info(p, remote_machine,
+ &p->dc);
unbecome_root();
if (!ret) {
return NT_STATUS_INVALID_HANDLE;
}
become_root();
- secrets_store_schannel_session_info(p->pipe_state_mem_ctx,
- remote_machine,
- p->dc);
+ secrets_store_schannel_session_info(p, remote_machine, p->dc);
ret = pdb_getsampwnam(sampass, p->dc->mach_acct);
unbecome_root();
bool ret;
become_root();
- ret = secrets_restore_schannel_session_info(p->pipe_state_mem_ctx,
- r->in.computer_name,
- &p->dc);
+ ret = secrets_restore_schannel_session_info(
+ p, r->in.computer_name, &p->dc);
unbecome_root();
if (!ret) {
return NT_STATUS_INVALID_HANDLE;
/* We must store the creds state after an update. */
become_root();
- secrets_store_schannel_session_info(p->pipe_state_mem_ctx,
- r->in.computer_name,
- p->dc);
+ secrets_store_schannel_session_info(p, r->in.computer_name, p->dc);
unbecome_root();
return NT_STATUS_OK;
bool ret;
become_root();
- ret = secrets_restore_schannel_session_info(p->pipe_state_mem_ctx,
- remote_machine,
- &p->dc);
+ ret = secrets_restore_schannel_session_info(
+ p, remote_machine, &p->dc);
unbecome_root();
if (!ret) {
return NT_STATUS_INVALID_HANDLE;
/* We must store the creds state after an update. */
become_root();
- secrets_store_schannel_session_info(p->pipe_state_mem_ctx,
- remote_machine,
- p->dc);
+ secrets_store_schannel_session_info(p, remote_machine, p->dc);
unbecome_root();
}
return False;
}
- p->auth.a_u.schannel_auth = TALLOC_P(p->pipe_state_mem_ctx, struct schannel_auth_struct);
+ p->auth.a_u.schannel_auth = talloc(p, struct schannel_auth_struct);
if (!p->auth.a_u.schannel_auth) {
TALLOC_FREE(pdcinfo);
return False;
return NULL;
}
- p = SMB_MALLOC_P(pipes_struct);
+ p = TALLOC_ZERO_P(NULL, pipes_struct);
if (!p) {
DEBUG(0,("ERROR! no memory for pipes_struct!\n"));
return NULL;
}
- ZERO_STRUCTP(p);
-
if ((p->mem_ctx = talloc_init("pipe %s %p", pipe_name, p)) == NULL) {
DEBUG(0,("open_rpc_pipe_p: talloc_init failed.\n"));
- SAFE_FREE(p);
- return NULL;
- }
-
- if ((p->pipe_state_mem_ctx = talloc_init("pipe_state %s %p", pipe_name, p)) == NULL) {
- DEBUG(0,("open_rpc_pipe_p: talloc_init failed.\n"));
- talloc_destroy(p->mem_ctx);
- SAFE_FREE(p);
+ TALLOC_FREE(p);
return NULL;
}
if (!init_pipe_handle_list(p, pipe_name)) {
DEBUG(0,("open_rpc_pipe_p: init_pipe_handles failed.\n"));
talloc_destroy(p->mem_ctx);
- talloc_destroy(p->pipe_state_mem_ctx);
- SAFE_FREE(p);
+ TALLOC_FREE(p);
return NULL;
}
if(!prs_init(&p->in_data.data, RPC_MAX_PDU_FRAG_LEN, p->mem_ctx, MARSHALL)) {
DEBUG(0,("open_rpc_pipe_p: malloc fail for in_data struct.\n"));
talloc_destroy(p->mem_ctx);
- talloc_destroy(p->pipe_state_mem_ctx);
close_policy_by_pipe(p);
- SAFE_FREE(p);
+ TALLOC_FREE(p);
return NULL;
}
talloc_destroy(p->mem_ctx);
}
- if (p->pipe_state_mem_ctx) {
- talloc_destroy(p->pipe_state_mem_ctx);
- }
-
free_pipe_rpc_context( p->contexts );
/* Free the handles database. */
ZERO_STRUCTP(p);
- SAFE_FREE(p);
+ TALLOC_FREE(p);
return True;
}