summaryrefslogtreecommitdiff
path: root/source4/torture/auth/ntlmssp.c
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2006-10-16 13:06:41 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:21:12 -0500
commit8773e743c518578584d07d35ffdafdd598af88b0 (patch)
tree89726232dd6ae9eca1c219e21729a9b2336ddaa9 /source4/torture/auth/ntlmssp.c
parent0f2347e417dec4a50f95d64353b260cd53a44a2b (diff)
downloadsamba-8773e743c518578584d07d35ffdafdd598af88b0.tar.gz
samba-8773e743c518578584d07d35ffdafdd598af88b0.tar.bz2
samba-8773e743c518578584d07d35ffdafdd598af88b0.zip
r19339: Merge my 4.0-unittest branch. This adds an API for more fine-grained
output in the testsuite rather than just True or False for a set of tests. The aim is to use this for: * known failure lists (run all tests and detect tests that started working or started failing). This would allow us to get rid of the RPC-SAMBA3-* tests * nicer torture output * simplification of the testsuite system * compatibility with other unit testing systems * easier usage of smbtorture (being able to run one test and automatically set up the environment for that) This is still a work-in-progress; expect more updates over the next couple of days. (This used to be commit 0eb6097305776325c75081356309115f445a7218)
Diffstat (limited to 'source4/torture/auth/ntlmssp.c')
-rw-r--r--source4/torture/auth/ntlmssp.c46
1 files changed, 18 insertions, 28 deletions
diff --git a/source4/torture/auth/ntlmssp.c b/source4/torture/auth/ntlmssp.c
index 978610ec51..ff111faf85 100644
--- a/source4/torture/auth/ntlmssp.c
+++ b/source4/torture/auth/ntlmssp.c
@@ -24,16 +24,16 @@
#include "lib/cmdline/popt_common.h"
#include "torture/torture.h"
-static BOOL torture_ntlmssp_self_check(struct torture_context *test,
- const void *_data)
+static bool torture_ntlmssp_self_check(struct torture_context *tctx)
{
struct gensec_security *gensec_security;
struct gensec_ntlmssp_state *gensec_ntlmssp_state;
DATA_BLOB data;
DATA_BLOB sig, expected_sig;
+ TALLOC_CTX *mem_ctx = tctx;
- torture_assert_ntstatus_ok(test,
- gensec_client_start(test, &gensec_security, NULL),
+ torture_assert_ntstatus_ok(tctx,
+ gensec_client_start(mem_ctx, &gensec_security, NULL),
"gensec client start");
gensec_set_credentials(gensec_security, cmdline_credentials);
@@ -41,7 +41,7 @@ static BOOL torture_ntlmssp_self_check(struct torture_context *test,
gensec_want_feature(gensec_security, GENSEC_FEATURE_SIGN);
gensec_want_feature(gensec_security, GENSEC_FEATURE_SEAL);
- torture_assert_ntstatus_ok(test,
+ torture_assert_ntstatus_ok(tctx,
gensec_start_mech_by_oid(gensec_security, GENSEC_OID_NTLMSSP),
"Failed to start GENSEC for NTLMSSP");
@@ -54,7 +54,7 @@ static BOOL torture_ntlmssp_self_check(struct torture_context *test,
gensec_ntlmssp_state->neg_flags = NTLMSSP_NEGOTIATE_SIGN | NTLMSSP_NEGOTIATE_UNICODE | NTLMSSP_NEGOTIATE_128 | NTLMSSP_NEGOTIATE_KEY_EXCH | NTLMSSP_NEGOTIATE_NTLM2;
- torture_assert_ntstatus_ok(test,
+ torture_assert_ntstatus_ok(tctx,
ntlmssp_sign_init(gensec_ntlmssp_state),
"Failed to sign_init");
@@ -67,19 +67,15 @@ static BOOL torture_ntlmssp_self_check(struct torture_context *test,
dump_data_pw("NTLMSSP calc sig: ", sig.data, sig.length);
dump_data_pw("NTLMSSP expected sig: ", expected_sig.data, expected_sig.length);
- if (sig.length != expected_sig.length) {
- torture_fail(test, "Wrong sig length: %d != %d",
- (int)sig.length, (int)expected_sig.length);
- return False;
- }
+ torture_assert_int_equal(tctx, sig.length, expected_sig.length, "Wrong sig length");
- torture_assert(test, 0 == memcmp(sig.data, expected_sig.data, sig.length),
+ torture_assert(tctx, 0 == memcmp(sig.data, expected_sig.data, sig.length),
"data mismatch");
talloc_free(gensec_security);
- torture_assert_ntstatus_ok(test,
- gensec_client_start(test, &gensec_security, NULL),
+ torture_assert_ntstatus_ok(tctx,
+ gensec_client_start(mem_ctx, &gensec_security, NULL),
"Failed to start GENSEC for NTLMSSP");
gensec_set_credentials(gensec_security, cmdline_credentials);
@@ -87,7 +83,7 @@ static BOOL torture_ntlmssp_self_check(struct torture_context *test,
gensec_want_feature(gensec_security, GENSEC_FEATURE_SIGN);
gensec_want_feature(gensec_security, GENSEC_FEATURE_SEAL);
- torture_assert_ntstatus_ok(test,
+ torture_assert_ntstatus_ok(tctx,
gensec_start_mech_by_oid(gensec_security, GENSEC_OID_NTLMSSP),
"GENSEC start mech by oid");
@@ -100,7 +96,7 @@ static BOOL torture_ntlmssp_self_check(struct torture_context *test,
gensec_ntlmssp_state->neg_flags = NTLMSSP_NEGOTIATE_SIGN | NTLMSSP_NEGOTIATE_UNICODE | NTLMSSP_NEGOTIATE_KEY_EXCH;
- torture_assert_ntstatus_ok(test,
+ torture_assert_ntstatus_ok(tctx,
ntlmssp_sign_init(gensec_ntlmssp_state),
"Failed to sign_init");
@@ -113,28 +109,22 @@ static BOOL torture_ntlmssp_self_check(struct torture_context *test,
dump_data_pw("NTLMSSP calc sig: ", sig.data, sig.length);
dump_data_pw("NTLMSSP expected sig: ", expected_sig.data, expected_sig.length);
- if (sig.length != expected_sig.length) {
- torture_fail(test, "Wrong sig length: %d != %d",
- (int)sig.length, (int)expected_sig.length);
- return False;
- }
+ torture_assert_int_equal(tctx, sig.length, expected_sig.length, "Wrong sig length");
- torture_assert(test,
- 0 == memcmp(sig.data+8, expected_sig.data+8, sig.length-8),
+ torture_assert(tctx, 0 == memcmp(sig.data+8, expected_sig.data+8, sig.length-8),
"data mismatch");
talloc_free(gensec_security);
-
- return True;
+ return true;
}
struct torture_suite *torture_ntlmssp(TALLOC_CTX *mem_ctx)
{
struct torture_suite *suite = torture_suite_create(mem_ctx,
- "LOCAL-NTLMSSP");
+ "NTLMSSP");
- torture_suite_add_simple_tcase(suite, "NTLMSSP self check",
- torture_ntlmssp_self_check, NULL);
+ torture_suite_add_simple_test(suite, "NTLMSSP self check",
+ torture_ntlmssp_self_check);
return suite;
}