1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-03 13:47:25 +03:00

r1077: fix segfault in schannel over ncacn_ip_tcp

metze
This commit is contained in:
Stefan Metzmacher 2004-06-07 21:30:17 +00:00 committed by Gerald (Jerry) Carter
parent 798cbed5a3
commit 9e9a52692e
2 changed files with 15 additions and 13 deletions

View File

@ -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;
}

View File

@ -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;
}