From 32e368502d80517dd7b00c1c3bc8b042887d9db0 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Thu, 11 Nov 2004 05:29:58 +0000 Subject: r3680: Move the multiple runs of this test into a loop. Also check that no flags individually have an impact (above what we already expect). Andrew Bartlett (This used to be commit 68dd173dc0539f290f40ee90f398591409765932) --- source4/torture/rpc/samlogon.c | 98 ++++++++++++++++-------------------------- 1 file changed, 36 insertions(+), 62 deletions(-) diff --git a/source4/torture/rpc/samlogon.c b/source4/torture/rpc/samlogon.c index 6f58af3134..54d6dd85f8 100644 --- a/source4/torture/rpc/samlogon.c +++ b/source4/torture/rpc/samlogon.c @@ -976,7 +976,7 @@ static BOOL test_InteractiveLogon(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, creds_des_encrypt(creds, &pinfo.ntpassword); } - printf("Testing netr_LogonSamLogonWithFlags\n"); + printf("Testing netr_LogonSamLogonWithFlags (Interactive Logon)\n"); status = dcerpc_netr_LogonSamLogonWithFlags(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { @@ -1002,6 +1002,14 @@ BOOL torture_rpc_samlogon(void) BOOL ret = True; void *join_ctx; const char *machine_pass; + int i; + + unsigned int credential_flags[] = { + 0, + NETLOGON_NEG_AUTH2_FLAGS, + NETLOGON_NEG_ARCFOUR, + NETLOGON_NEG_ARCFOUR | NETLOGON_NEG_128BIT, + NETLOGON_NEG_AUTH2_ADS_FLAGS}; struct creds_CredentialState creds; @@ -1035,69 +1043,35 @@ BOOL torture_rpc_samlogon(void) ret = False; } - if (!test_SetupCredentials2(p, mem_ctx, NETLOGON_NEG_AUTH2_FLAGS, - TEST_MACHINE_NAME, machine_pass, &creds)) { - return False; - } - - if (!test_InteractiveLogon(p, mem_ctx, &creds)) { - ret = False; - } - - if (!test_SamLogon(p, mem_ctx, &creds)) { - ret = False; - } - - if (!test_SetupCredentials2(p, mem_ctx, NETLOGON_NEG_ARCFOUR, - TEST_MACHINE_NAME, machine_pass, &creds)) { - return False; - } - - if (!test_InteractiveLogon(p, mem_ctx, &creds)) { - ret = False; - } - - if (!test_SamLogon(p, mem_ctx, &creds)) { - ret = False; - } - - if (!test_SetupCredentials2(p, mem_ctx, NETLOGON_NEG_ARCFOUR | NETLOGON_NEG_128BIT, - TEST_MACHINE_NAME, machine_pass, &creds)) { - return False; - } - - if (!test_InteractiveLogon(p, mem_ctx, &creds)) { - ret = False; - } - - if (!test_SamLogon(p, mem_ctx, &creds)) { - ret = False; - } - - if (!test_SetupCredentials3(p, mem_ctx, NETLOGON_NEG_AUTH2_FLAGS, - TEST_MACHINE_NAME, machine_pass, &creds)) { - return False; - } - - if (!test_InteractiveLogon(p, mem_ctx, &creds)) { - ret = False; - } - - if (!test_SamLogon(p, mem_ctx, &creds)) { - ret = False; - } - - if (!test_SetupCredentials3(p, mem_ctx, NETLOGON_NEG_AUTH2_ADS_FLAGS, - TEST_MACHINE_NAME, machine_pass, &creds)) { - return False; - } - - if (!test_InteractiveLogon(p, mem_ctx, &creds)) { - ret = False; + for (i=0; i < ARRAY_SIZE(credential_flags); i++) { + + if (!test_SetupCredentials2(p, mem_ctx, credential_flags[i], + TEST_MACHINE_NAME, machine_pass, &creds)) { + return False; + } + + if (!test_InteractiveLogon(p, mem_ctx, &creds)) { + ret = False; + } + + if (!test_SamLogon(p, mem_ctx, &creds)) { + ret = False; + } } - if (!test_SamLogon(p, mem_ctx, &creds)) { - ret = False; + for (i=0; i < 32; i++) { + if (!test_SetupCredentials2(p, mem_ctx, 1 << i, + TEST_MACHINE_NAME, machine_pass, &creds)) { + return False; + } + + if (!test_InteractiveLogon(p, mem_ctx, &creds)) { + ret = False; + } + + if (!test_SamLogon(p, mem_ctx, &creds)) { + ret = False; + } } talloc_destroy(mem_ctx); -- cgit