summaryrefslogtreecommitdiff
path: root/source4/librpc/rpc/dcerpc_util.c
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2004-06-07 21:30:17 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:56:37 -0500
commitfb1cc0fc0d0dec3384886b42e9377b531defe352 (patch)
tree6f6cf268e83481a492782d8abb5323e8e4e5097d /source4/librpc/rpc/dcerpc_util.c
parent6e14c2cc00d6ac206d7e8cd025e961d88d4a9e47 (diff)
downloadsamba-fb1cc0fc0d0dec3384886b42e9377b531defe352.tar.gz
samba-fb1cc0fc0d0dec3384886b42e9377b531defe352.tar.bz2
samba-fb1cc0fc0d0dec3384886b42e9377b531defe352.zip
r1077: fix segfault in schannel over ncacn_ip_tcp
metze (This used to be commit 9e9a52692ebe9d47f1a08740ea1dcb8f46041211)
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;
}