SMB_ASSERT(rpccli_is_pipe_idx(cli, PI_NETLOGON));
- dc = cli->dc;
- if (!dc) {
- return NT_STATUS_INVALID_PARAMETER;
+ TALLOC_FREE(cli->dc);
+ cli->dc = talloc_zero(cli, struct dcinfo);
+ if (cli->dc == NULL) {
+ return NT_STATUS_NO_MEMORY;
}
-
- /* Ensure we don't reuse any of this state. */
- ZERO_STRUCTP(dc);
+ dc = cli->dc;
/* Store the machine account password we're going to use. */
memcpy(dc->mach_pw, machine_pwd, 16);
struct sockaddr_un addr;
NTSTATUS status;
- result = talloc(mem_ctx, struct rpc_pipe_client);
+ result = talloc_zero(mem_ctx, struct rpc_pipe_client);
if (result == NULL) {
return NT_STATUS_NO_MEMORY;
}
talloc_set_destructor(result, rpc_pipe_sock_destructor);
- result->dc = TALLOC_ZERO_P(result, struct dcinfo);
- if (result->dc == NULL) {
- status = NT_STATUS_NO_MEMORY;
- goto fail;
- }
-
ZERO_STRUCT(addr);
addr.sun_family = AF_UNIX;
strncpy(addr.sun_path, socket_path, sizeof(addr.sun_path));
return NULL;
}
- if (pipe_idx == PI_NETLOGON) {
- /* Set up a netlogon credential chain for a netlogon pipe. */
- result->dc = TALLOC_ZERO_P(result, struct dcinfo);
- if (result->dc == NULL) {
- *perr = NT_STATUS_NO_MEMORY;
- TALLOC_FREE(result);
- return NULL;
- }
- }
-
fnum = cli_nt_create(cli, result->trans.np.pipe_name,
DESIRED_ACCESS_PIPE);
if (fnum == -1) {
return NULL;
}
- /* The credentials on a new netlogon pipe are the ones we are passed in - copy them over. */
- if (result->dc) {
- *result->dc = *pdc;
+ /*
+ * The credentials on a new netlogon pipe are the ones we are passed
+ * in - copy them over.
+ */
+ result->dc = (struct dcinfo *)talloc_memdup(result, pdc, sizeof(*pdc));
+ if (result->dc == NULL) {
+ DEBUG(0, ("talloc failed\n"));
+ TALLOC_FREE(result);
+ return NULL;
}
DEBUG(10,("cli_rpc_pipe_open_schannel_with_key: opened pipe %s to machine %s "