From 6836f5d0b167027908da9a08b9b219520997b563 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sun, 9 Jan 2005 08:34:05 +0000 Subject: r4616: the first phase in the addition of proper support for dcerpc_alter_context and multiple context_ids in the dcerpc client library. This stage does the following: - split "struct dcerpc_pipe" into two parts, the main part being "struct dcerpc_connection", which contains all the parts not dependent on the context, and "struct dcerpc_pipe" which has the context dependent part. This is similar to the layering in libcli_*() for SMB - disable the current dcerpc_alter code. I've used a #warning until i get the 2nd phase finished. I don't know how portable #warning is, but it won't be long before I add full alter context support anyway, so it won't last long - cleanup the allocation of dcerpc_pipe structures. The previous code was quite awkward. (This used to be commit 4004c69937be7e5dae56f9567ca607f982d395d3) --- source4/librpc/rpc/dcerpc_schannel.c | 40 +++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 19 deletions(-) (limited to 'source4/librpc/rpc/dcerpc_schannel.c') diff --git a/source4/librpc/rpc/dcerpc_schannel.c b/source4/librpc/rpc/dcerpc_schannel.c index 8632a3cf16..92e8d0ca38 100644 --- a/source4/librpc/rpc/dcerpc_schannel.c +++ b/source4/librpc/rpc/dcerpc_schannel.c @@ -339,7 +339,7 @@ static NTSTATUS dcerpc_schannel_key(struct dcerpc_pipe *p, const char *workgroup, *workstation; uint32_t negotiate_flags; - if (p->flags & DCERPC_SCHANNEL_128) { + if (p->conn->flags & DCERPC_SCHANNEL_128) { negotiate_flags = NETLOGON_NEG_AUTH2_ADS_FLAGS; } else { negotiate_flags = NETLOGON_NEG_AUTH2_FLAGS; @@ -424,46 +424,48 @@ NTSTATUS dcerpc_bind_auth_schannel_withkey(struct dcerpc_pipe *p, NTSTATUS status; struct dcerpc_schannel_state *dce_schan_state; - status = gensec_client_start(p, &p->security_state.generic_state); + status = gensec_client_start(p, &p->conn->security_state.generic_state); if (!NT_STATUS_IS_OK(status)) { return status; } - status = gensec_set_username(p->security_state.generic_state, username); + status = gensec_set_username(p->conn->security_state.generic_state, username); if (!NT_STATUS_IS_OK(status)) { DEBUG(1, ("Failed to set schannel username to %s: %s\n", username, nt_errstr(status))); - talloc_free(p->security_state.generic_state); - p->security_state.generic_state = NULL; + talloc_free(p->conn->security_state.generic_state); + p->conn->security_state.generic_state = NULL; return status; } - status = gensec_set_domain(p->security_state.generic_state, domain); + status = gensec_set_domain(p->conn->security_state.generic_state, domain); if (!NT_STATUS_IS_OK(status)) { DEBUG(1, ("Failed to set schannel domain to %s: %s\n", domain, nt_errstr(status))); - talloc_free(p->security_state.generic_state); - p->security_state.generic_state = NULL; + talloc_free(p->conn->security_state.generic_state); + p->conn->security_state.generic_state = NULL; return status; } - status = gensec_start_mech_by_authtype(p->security_state.generic_state, DCERPC_AUTH_TYPE_SCHANNEL, dcerpc_auth_level(p)); + status = gensec_start_mech_by_authtype(p->conn->security_state.generic_state, + DCERPC_AUTH_TYPE_SCHANNEL, + dcerpc_auth_level(p->conn)); if (!NT_STATUS_IS_OK(status)) { DEBUG(1, ("Failed to start SCHANNEL GENSEC backend: %s\n", nt_errstr(status))); - talloc_free(p->security_state.generic_state); - p->security_state.generic_state = NULL; + talloc_free(p->conn->security_state.generic_state); + p->conn->security_state.generic_state = NULL; return status; } - dce_schan_state = p->security_state.generic_state->private_data; + dce_schan_state = p->conn->security_state.generic_state->private_data; dce_schan_state->creds = talloc_reference(dce_schan_state, creds); - status = dcerpc_bind_auth3(p, DCERPC_AUTH_TYPE_SCHANNEL, dcerpc_auth_level(p), - uuid, version); + status = dcerpc_bind_auth3(p, DCERPC_AUTH_TYPE_SCHANNEL, dcerpc_auth_level(p->conn), + uuid, version); if (!NT_STATUS_IS_OK(status)) { DEBUG(1, ("Failed to bind to pipe with SCHANNEL: %s\n", nt_errstr(status))); - talloc_free(p->security_state.generic_state); - p->security_state.generic_state = NULL; + talloc_free(p->conn->security_state.generic_state); + p->conn->security_state.generic_state = NULL; return status; } @@ -484,11 +486,11 @@ NTSTATUS dcerpc_bind_auth_schannel(struct dcerpc_pipe *p, return NT_STATUS_NO_MEMORY; } - if (p->flags & DCERPC_SCHANNEL_BDC) { + if (p->conn->flags & DCERPC_SCHANNEL_BDC) { chan_type = SEC_CHAN_BDC; - } else if (p->flags & DCERPC_SCHANNEL_WORKSTATION) { + } else if (p->conn->flags & DCERPC_SCHANNEL_WORKSTATION) { chan_type = SEC_CHAN_WKSTA; - } else if (p->flags & DCERPC_SCHANNEL_DOMAIN) { + } else if (p->conn->flags & DCERPC_SCHANNEL_DOMAIN) { chan_type = SEC_CHAN_DOMAIN; } -- cgit