From 2a91b00b9217b9fe0caf4c848a433eff1d81d75c Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Mon, 24 May 2010 11:03:42 -0700 Subject: Add in support for the NTLMSSP version reply. Jeremy. --- source4/auth/ntlmssp/ntlmssp_server.c | 33 ++++++++++++++++++++++++++++++--- source4/auth/ntlmssp/wscript_build | 2 +- 2 files changed, 31 insertions(+), 4 deletions(-) (limited to 'source4/auth/ntlmssp') diff --git a/source4/auth/ntlmssp/ntlmssp_server.c b/source4/auth/ntlmssp/ntlmssp_server.c index 8a8c579c68..e7e92695f5 100644 --- a/source4/auth/ntlmssp/ntlmssp_server.c +++ b/source4/auth/ntlmssp/ntlmssp_server.c @@ -25,6 +25,7 @@ #include "system/network.h" #include "lib/tsocket/tsocket.h" #include "auth/ntlmssp/ntlmssp.h" +#include "../librpc/gen_ndr/ndr_ntlmssp.h" #include "../libcli/auth/libcli_auth.h" #include "../lib/crypto/crypto.h" #include "auth/gensec/gensec.h" @@ -199,10 +200,33 @@ NTSTATUS ntlmssp_server_negotiate(struct gensec_security *gensec_security, { /* Marshal the packet in the right format, be it unicode or ASCII */ const char *gen_string; + DATA_BLOB version_blob = data_blob_null; + + if (chal_flags & NTLMSSP_NEGOTIATE_VERSION) { + enum ndr_err_code err; + struct VERSION vers; + + /* "What Windows returns" as a version number. */ + ZERO_STRUCT(vers); + vers.ProductMajorVersion = NTLMSSP_WINDOWS_MAJOR_VERSION_6; + vers.ProductMinorVersion = NTLMSSP_WINDOWS_MINOR_VERSION_1; + vers.ProductBuild = 0; + vers.NTLMRevisionCurrent = NTLMSSP_REVISION_W2K3; + + err = ndr_push_struct_blob(&version_blob, + out_mem_ctx, + &vers, + (ndr_push_flags_fn_t)ndr_push_VERSION); + + if (!NDR_ERR_CODE_IS_SUCCESS(err)) { + return NT_STATUS_NO_MEMORY; + } + } + if (ntlmssp_state->unicode) { - gen_string = "CdUdbddB"; + gen_string = "CdUdbddBb"; } else { - gen_string = "CdAdbddB"; + gen_string = "CdAdbddBb"; } msrpc_gen(out_mem_ctx, @@ -213,7 +237,10 @@ NTSTATUS ntlmssp_server_negotiate(struct gensec_security *gensec_security, chal_flags, cryptkey, 8, 0, 0, - struct_blob.data, struct_blob.length); + struct_blob.data, struct_blob.length, + version_blob.data, version_blob.length); + + data_blob_free(&version_blob); } ntlmssp_state->expected_state = NTLMSSP_AUTH; diff --git a/source4/auth/ntlmssp/wscript_build b/source4/auth/ntlmssp/wscript_build index ef4a95ab79..a47bb6cd73 100644 --- a/source4/auth/ntlmssp/wscript_build +++ b/source4/auth/ntlmssp/wscript_build @@ -5,7 +5,7 @@ bld.SAMBA_MODULE('gensec_ntlmssp', autoproto='proto.h', subsystem='gensec', init_function='gensec_ntlmssp_init', - deps='MSRPC_PARSE CREDENTIALS', + deps='MSRPC_PARSE CREDENTIALS NDR_NTLMSSP', internal_module=True ) -- cgit