summaryrefslogtreecommitdiffstats
path: root/source4/torture/auth
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2005-04-25 03:37:37 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:11:38 -0500
commit53079da638e6e45e9e0a352f532e05073e60d3fb (patch)
tree77cc17ad65d85464d35d53f686c804ec387fbedb /source4/torture/auth
parenta2abd01cca389f6d48fefde5cd1a19aaffdb97a3 (diff)
downloadsamba-53079da638e6e45e9e0a352f532e05073e60d3fb.tar.gz
samba-53079da638e6e45e9e0a352f532e05073e60d3fb.tar.xz
samba-53079da638e6e45e9e0a352f532e05073e60d3fb.zip
r6454: Start to migrate NTLMSSP away from it's own API to just use GENSEC.
The aim here is to remove the extra layer of abstraction, and to then use the credentials code directly in the NTLMSSP layer. Andrew Bartlett (This used to be commit b14c530dfd3e56975dea7e30aa8d62d4f2827700)
Diffstat (limited to 'source4/torture/auth')
-rw-r--r--source4/torture/auth/ntlmssp.c45
1 files changed, 38 insertions, 7 deletions
diff --git a/source4/torture/auth/ntlmssp.c b/source4/torture/auth/ntlmssp.c
index 5d8db9030d..6fb07914dd 100644
--- a/source4/torture/auth/ntlmssp.c
+++ b/source4/torture/auth/ntlmssp.c
@@ -1,6 +1,6 @@
/*
Unix SMB/CIFS implementation.
- basic raw test suite for change notify
+ Small self-tests for the NTLMSSP code
Copyright (C) Andrew Bartlett <abartlet@samba.org> 2004
This program is free software; you can redistribute it and/or modify
@@ -20,18 +20,34 @@
#include "includes.h"
#include "auth/auth.h"
+#include "lib/cmdline/popt_common.h"
BOOL torture_ntlmssp_self_check(void)
{
+ struct gensec_security *gensec_security;
struct ntlmssp_state *ntlmssp_state;
+ struct gensec_ntlmssp_state *gensec_ntlmssp_state;
DATA_BLOB data;
DATA_BLOB sig, expected_sig;
NTSTATUS status;
- if (!NT_STATUS_IS_OK(ntlmssp_client_start(NULL, &ntlmssp_state))) {
+ status = gensec_client_start(NULL, &gensec_security);
+
+ if (!NT_STATUS_IS_OK(status)) {
+ return False;
+ }
+
+ gensec_set_credentials(gensec_security, cmdline_credentials);
+
+ status = gensec_start_mech_by_oid(gensec_security, GENSEC_OID_NTLMSSP);
+
+ if (!NT_STATUS_IS_OK(status)) {
return False;
}
+ gensec_ntlmssp_state = gensec_security->private_data;
+ ntlmssp_state = gensec_ntlmssp_state->ntlmssp_state;
+
ntlmssp_state->session_key = strhex_to_data_blob("0102030405060708090a0b0c0d0e0f00");
dump_data_pw("NTLMSSP session key: \n",
ntlmssp_state->session_key.data,
@@ -46,8 +62,8 @@ BOOL torture_ntlmssp_self_check(void)
}
data = strhex_to_data_blob("6a43494653");
- ntlmssp_sign_packet(ntlmssp_state, ntlmssp_state,
- data.data, data.length, data.data, data.length, &sig);
+ gensec_ntlmssp_sign_packet(gensec_security, gensec_security,
+ data.data, data.length, data.data, data.length, &sig);
expected_sig = strhex_to_data_blob("01000000e37f97f2544f4d7e00000000");
@@ -63,12 +79,25 @@ BOOL torture_ntlmssp_self_check(void)
return False;
}
- ntlmssp_end(&ntlmssp_state);
+ talloc_free(gensec_security);
- if (!NT_STATUS_IS_OK(ntlmssp_client_start(NULL, &ntlmssp_state))) {
+ status = gensec_client_start(NULL, &gensec_security);
+
+ if (!NT_STATUS_IS_OK(status)) {
+ return False;
+ }
+
+ gensec_set_credentials(gensec_security, cmdline_credentials);
+
+ status = gensec_start_mech_by_oid(gensec_security, GENSEC_OID_NTLMSSP);
+
+ if (!NT_STATUS_IS_OK(status)) {
return False;
}
+ gensec_ntlmssp_state = gensec_security->private_data;
+ ntlmssp_state = gensec_ntlmssp_state->ntlmssp_state;
+
ntlmssp_state->session_key = strhex_to_data_blob("0102030405e538b0");
dump_data_pw("NTLMSSP session key: \n",
ntlmssp_state->session_key.data,
@@ -83,7 +112,7 @@ BOOL torture_ntlmssp_self_check(void)
}
data = strhex_to_data_blob("6a43494653");
- ntlmssp_sign_packet(ntlmssp_state, ntlmssp_state,
+ gensec_ntlmssp_sign_packet(gensec_security, gensec_security,
data.data, data.length, data.data, data.length, &sig);
expected_sig = strhex_to_data_blob("0100000078010900397420fe0e5a0f89");
@@ -100,5 +129,7 @@ BOOL torture_ntlmssp_self_check(void)
return False;
}
+ talloc_free(gensec_security);
+
return True;
}