diff options
author | Jeremy Allison <jra@samba.org> | 2011-03-28 13:26:27 -0700 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2011-03-28 23:12:07 +0200 |
commit | 52602e4f5ad0f7c3cdb4a50dfe32d0b8ad49b6e4 (patch) | |
tree | 69911fe6eca738368d497107032f3a3b084058b6 /source4/auth/ntlmssp | |
parent | fbe19ba39843d0c70758fc8d775b085a67224a94 (diff) | |
download | samba-52602e4f5ad0f7c3cdb4a50dfe32d0b8ad49b6e4.tar.gz samba-52602e4f5ad0f7c3cdb4a50dfe32d0b8ad49b6e4.tar.bz2 samba-52602e4f5ad0f7c3cdb4a50dfe32d0b8ad49b6e4.zip |
Fix inspired by work done by David Disseldorp for bug #8040 - smbclient segfaults when a Cyrillic netbios name or workgroup is configured.
Change msrpc_gen to return NTSTATUS and ensure everywhere this is
used it is correctly checked to return that status.
Jeremy.
Diffstat (limited to 'source4/auth/ntlmssp')
-rw-r--r-- | source4/auth/ntlmssp/ntlmssp_client.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/source4/auth/ntlmssp/ntlmssp_client.c b/source4/auth/ntlmssp/ntlmssp_client.c index 13827e9c96..53bd7a4d23 100644 --- a/source4/auth/ntlmssp/ntlmssp_client.c +++ b/source4/auth/ntlmssp/ntlmssp_client.c @@ -54,6 +54,7 @@ NTSTATUS ntlmssp_client_initial(struct gensec_security *gensec_security, struct ntlmssp_state *ntlmssp_state = gensec_ntlmssp->ntlmssp_state; const char *domain = ntlmssp_state->domain; const char *workstation = cli_credentials_get_workstation(gensec_security->credentials); + NTSTATUS status; /* These don't really matter in the initial packet, so don't panic if they are not set */ if (!domain) { @@ -75,7 +76,7 @@ NTSTATUS ntlmssp_client_initial(struct gensec_security *gensec_security, } /* generate the ntlmssp negotiate packet */ - msrpc_gen(out_mem_ctx, + status = msrpc_gen(out_mem_ctx, out, "CddAA", "NTLMSSP", NTLMSSP_NEGOTIATE, @@ -83,6 +84,10 @@ NTSTATUS ntlmssp_client_initial(struct gensec_security *gensec_security, domain, workstation); + if (!NT_STATUS_IS_OK(status)) { + return status; + } + ntlmssp_state->expected_state = NTLMSSP_CHALLENGE; return NT_STATUS_MORE_PROCESSING_REQUIRED; @@ -269,7 +274,7 @@ NTSTATUS ntlmssp_client_challenge(struct gensec_security *gensec_security, debug_ntlmssp_flags(ntlmssp_state->neg_flags); /* this generates the actual auth packet */ - if (!msrpc_gen(mem_ctx, + nt_status = msrpc_gen(mem_ctx, out, auth_gen_string, "NTLMSSP", NTLMSSP_AUTH, @@ -279,9 +284,10 @@ NTSTATUS ntlmssp_client_challenge(struct gensec_security *gensec_security, user, cli_credentials_get_workstation(gensec_security->credentials), encrypted_session_key.data, encrypted_session_key.length, - ntlmssp_state->neg_flags)) { + ntlmssp_state->neg_flags); + if (!NT_STATUS_IS_OK(nt_status)) { talloc_free(mem_ctx); - return NT_STATUS_NO_MEMORY; + return nt_status; } ntlmssp_state->session_key = session_key; |