summaryrefslogtreecommitdiff
path: root/source4/librpc/rpc/dcerpc_util.c
diff options
context:
space:
mode:
Diffstat (limited to 'source4/librpc/rpc/dcerpc_util.c')
-rw-r--r--source4/librpc/rpc/dcerpc_util.c26
1 files changed, 13 insertions, 13 deletions
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;
}