diff options
Diffstat (limited to 'source4/librpc/rpc')
-rw-r--r-- | source4/librpc/rpc/dcerpc.c | 2 | ||||
-rw-r--r-- | source4/librpc/rpc/dcerpc_util.c | 26 |
2 files changed, 15 insertions, 13 deletions
diff --git a/source4/librpc/rpc/dcerpc.c b/source4/librpc/rpc/dcerpc.c index e80e168c89..82b6fa9a4e 100644 --- a/source4/librpc/rpc/dcerpc.c +++ b/source4/librpc/rpc/dcerpc.c @@ -45,9 +45,11 @@ struct dcerpc_pipe *dcerpc_pipe_init(void) ZERO_STRUCT(p->security_state.user); p->security_state.private_data = NULL; p->security_state.ops = NULL; + p->binding_string = NULL; p->flags = 0; p->srv_max_xmit_frag = 0; p->srv_max_recv_frag = 0; + p->last_fault_code = 0; return p; } diff --git a/source4/librpc/rpc/dcerpc_util.c b/source4/librpc/rpc/dcerpc_util.c index 59233295a3..e62404b92a 100644 --- a/source4/librpc/rpc/dcerpc_util.c +++ b/source4/librpc/rpc/dcerpc_util.c @@ -488,10 +488,13 @@ static NTSTATUS dcerpc_pipe_connect_ncacn_np(struct dcerpc_pipe **p, (*p)->flags = binding->flags; - if (binding->flags & DCERPC_SCHANNEL_ANY) { + /* remember the binding string for possible secondary connections */ + (*p)->binding_string = dcerpc_binding_string((*p)->mem_ctx, binding); + + if (username && username[0] && (binding->flags & DCERPC_SCHANNEL_ANY)) { status = dcerpc_bind_auth_schannel(*p, pipe_uuid, pipe_version, domain, username, password); - } else if (binding->flags & (DCERPC_SIGN | DCERPC_SEAL)) { + } else if (username && username[0] && (binding->flags & (DCERPC_SIGN | DCERPC_SEAL))) { status = dcerpc_bind_auth_ntlm(*p, pipe_uuid, pipe_version, domain, username, password); } else { status = dcerpc_bind_auth_none(*p, pipe_uuid, pipe_version); @@ -544,20 +547,22 @@ static NTSTATUS dcerpc_pipe_connect_ncacn_ip_tcp(struct dcerpc_pipe **p, /* it doesn't seem to work to do a null NTLMSSP session without either sign or seal, so force signing if we are doing ntlmssp */ - if (username[0] && !(binding->flags & (DCERPC_SIGN|DCERPC_SEAL))) { + if (username && username[0] && !(binding->flags & (DCERPC_SIGN|DCERPC_SEAL))) { binding->flags |= DCERPC_SIGN; } (*p)->flags = binding->flags; - if (binding->flags & DCERPC_SCHANNEL_ANY) { + /* remember the binding string for possible secondary connections */ + (*p)->binding_string = dcerpc_binding_string((*p)->mem_ctx, binding); + + if (username && username[0] && (binding->flags & DCERPC_SCHANNEL_ANY)) { status = dcerpc_bind_auth_schannel(*p, pipe_uuid, pipe_version, domain, username, password); - } else if (!(binding->flags & (DCERPC_SIGN|DCERPC_SEAL)) && !username[0]) { + } else if (username && username[0] && (binding->flags & (DCERPC_SIGN | DCERPC_SEAL))) { + status = dcerpc_bind_auth_ntlm(*p, pipe_uuid, pipe_version, domain, username, password); + } else { status = dcerpc_bind_auth_none(*p, pipe_uuid, pipe_version); - } else { - status = dcerpc_bind_auth_ntlm(*p, pipe_uuid, pipe_version, - domain, username, password); } if (!NT_STATUS_IS_OK(status)) { @@ -594,11 +599,6 @@ NTSTATUS dcerpc_pipe_connect_b(struct dcerpc_pipe **p, break; } - /* remember the binding string for possible secondary connections */ - if (NT_STATUS_IS_OK(status)) { - (*p)->binding_string = dcerpc_binding_string((*p)->mem_ctx, binding); - } - return status; } |