summaryrefslogtreecommitdiff
path: root/source4/auth/ntlmssp/ntlmssp_client.c
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2011-12-27 19:16:14 +1100
committerStefan Metzmacher <metze@samba.org>2012-01-06 13:18:40 +0100
commit60c66118b3a076aee59e581a263c045a205e5ed5 (patch)
treede622042dec25546ce1a4c7781ef270d81420f2c /source4/auth/ntlmssp/ntlmssp_client.c
parentaf19532d4dbbf4cd0cf7142b9469d04bd5c722a8 (diff)
downloadsamba-60c66118b3a076aee59e581a263c045a205e5ed5.tar.gz
samba-60c66118b3a076aee59e581a263c045a205e5ed5.tar.bz2
samba-60c66118b3a076aee59e581a263c045a205e5ed5.zip
ntlmssp: merge initial packet implementations
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Diffstat (limited to 'source4/auth/ntlmssp/ntlmssp_client.c')
-rw-r--r--source4/auth/ntlmssp/ntlmssp_client.c31
1 files changed, 25 insertions, 6 deletions
diff --git a/source4/auth/ntlmssp/ntlmssp_client.c b/source4/auth/ntlmssp/ntlmssp_client.c
index d5ece11e6a..6e372dc8f8 100644
--- a/source4/auth/ntlmssp/ntlmssp_client.c
+++ b/source4/auth/ntlmssp/ntlmssp_client.c
@@ -32,6 +32,8 @@ struct auth_session_info;
#include "auth/gensec/gensec.h"
#include "param/param.h"
#include "auth/ntlmssp/ntlmssp_private.h"
+#include "../librpc/gen_ndr/ndr_ntlmssp.h"
+#include "../auth/ntlmssp/ntlmssp_ndr.h"
/*********************************************************************
Client side NTLMSSP
@@ -55,8 +57,8 @@ NTSTATUS ntlmssp_client_initial(struct gensec_security *gensec_security,
talloc_get_type_abort(gensec_security->private_data,
struct gensec_ntlmssp_context);
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);
+ const char *domain = ntlmssp_state->client.netbios_domain;
+ const char *workstation = ntlmssp_state->client.netbios_name;
NTSTATUS status;
/* These don't really matter in the initial packet, so don't panic if they are not set */
@@ -73,24 +75,40 @@ NTSTATUS ntlmssp_client_initial(struct gensec_security *gensec_security,
} else {
ntlmssp_state->neg_flags |= NTLMSSP_NEGOTIATE_OEM;
}
-
+
if (ntlmssp_state->use_ntlmv2) {
ntlmssp_state->neg_flags |= NTLMSSP_NEGOTIATE_NTLM2;
}
/* generate the ntlmssp negotiate packet */
- status = msrpc_gen(out_mem_ctx,
+ status = msrpc_gen(out_mem_ctx,
out, "CddAA",
"NTLMSSP",
NTLMSSP_NEGOTIATE,
ntlmssp_state->neg_flags,
- domain,
+ domain,
workstation);
if (!NT_STATUS_IS_OK(status)) {
+ DEBUG(0, ("ntlmssp_client_initial: failed to generate "
+ "ntlmssp negotiate packet\n"));
return status;
}
+ if (DEBUGLEVEL >= 10) {
+ struct NEGOTIATE_MESSAGE *negotiate = talloc(
+ talloc_tos(), struct NEGOTIATE_MESSAGE);
+ if (negotiate != NULL) {
+ status = ntlmssp_pull_NEGOTIATE_MESSAGE(
+ out, negotiate, negotiate);
+ if (NT_STATUS_IS_OK(status)) {
+ NDR_PRINT_DEBUG(NEGOTIATE_MESSAGE,
+ negotiate);
+ }
+ TALLOC_FREE(negotiate);
+ }
+ }
+
ntlmssp_state->expected_state = NTLMSSP_CHALLENGE;
return NT_STATUS_MORE_PROCESSING_REQUIRED;
@@ -349,7 +367,8 @@ NTSTATUS gensec_ntlmssp_client_start(struct gensec_security *gensec_security)
ntlmssp_state->role = NTLMSSP_CLIENT;
- ntlmssp_state->domain = lpcfg_workgroup(gensec_security->settings->lp_ctx);
+ ntlmssp_state->client.netbios_domain = lpcfg_workgroup(gensec_security->settings->lp_ctx);
+ ntlmssp_state->client.netbios_name = cli_credentials_get_workstation(gensec_security->credentials);
ntlmssp_state->unicode = gensec_setting_bool(gensec_security->settings, "ntlmssp_client", "unicode", true);