diff options
author | Stefan Metzmacher <metze@samba.org> | 2004-06-07 21:30:17 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 12:56:37 -0500 |
commit | fb1cc0fc0d0dec3384886b42e9377b531defe352 (patch) | |
tree | 6f6cf268e83481a492782d8abb5323e8e4e5097d /source4/librpc/rpc | |
parent | 6e14c2cc00d6ac206d7e8cd025e961d88d4a9e47 (diff) | |
download | samba-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')
-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; } |