From 810831434a03b68064476124828e607bd367d98d Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sat, 8 May 2004 02:48:24 +0000 Subject: r582: added the LMSessKey in SamInfo and SamInfo2, thanks to work by abartlet added test code for SamLogon validation level 2 and 3, so we test both SamInfo and SamInfo2 (This used to be commit 321dbb61cc0743379ceb6b8fff6a0ca37f308bc2) --- source4/librpc/idl/netlogon.idl | 14 +++++++++++--- source4/torture/rpc/netlogon.c | 32 ++++++++++++++++++-------------- 2 files changed, 29 insertions(+), 17 deletions(-) diff --git a/source4/librpc/idl/netlogon.idl b/source4/librpc/idl/netlogon.idl index c9ac7972f2..399bd6c543 100644 --- a/source4/librpc/idl/netlogon.idl +++ b/source4/librpc/idl/netlogon.idl @@ -148,9 +148,13 @@ interface netlogon } netr_GroupMembership; typedef [flag(NDR_PAHEX)] struct { - uint8 user_session_key[16]; + uint8 key[16]; } netr_UserSessionKey; + typedef [flag(NDR_PAHEX)] struct { + uint8 key[8]; + } netr_LMSessionKey; + typedef struct { NTTIME logon_time; NTTIME logoff_time; @@ -175,7 +179,9 @@ interface netlogon netr_String logon_server; netr_String domain; dom_sid2 *domain_sid; - uint32 expansionroom[10]; + netr_LMSessionKey LMSessKey; + uint32 AccountControl; + uint32 expansionroom[7]; } netr_SamInfo; typedef struct { @@ -207,7 +213,9 @@ interface netlogon netr_String logon_server; netr_String domain; dom_sid2 *domain_sid; - uint32 expansionroom[10]; + netr_LMSessionKey LMSessKey; + uint32 AccountControl; + uint32 expansionroom[7]; uint32 sidcount; [size_is(sidcount)] netr_SidAttr *sids; } netr_SamInfo2; diff --git a/source4/torture/rpc/netlogon.c b/source4/torture/rpc/netlogon.c index 26889e58c8..e06613a3d9 100644 --- a/source4/torture/rpc/netlogon.c +++ b/source4/torture/rpc/netlogon.c @@ -346,6 +346,8 @@ static BOOL test_SamLogon(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx) const char *username = lp_parm_string(-1, "torture", "username"); const char *password = lp_parm_string(-1, "torture", "password"); struct netr_CredentialState creds; + int i; + BOOL ret = True; if (!test_SetupCredentials2(p, mem_ctx, &creds)) { return False; @@ -366,31 +368,33 @@ static BOOL test_SamLogon(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx) ninfo.lm.data = talloc(mem_ctx, 24); SMBencrypt(password, ninfo.challenge, ninfo.lm.data); - ZERO_STRUCT(auth2); - - creds_client_authenticator(&creds, &auth); - r.in.server_name = talloc_asprintf(mem_ctx, "\\\\%s", dcerpc_server_name(p)); r.in.workstation = TEST_MACHINE_NAME; r.in.credential = &auth; r.in.authenticator = &auth2; r.in.logon_level = 2; r.in.logon.network = &ninfo; - r.in.validation_level = 2; - printf("Testing SamLogon\n"); + for (i=2;i<=3;i++) { + ZERO_STRUCT(auth2); + creds_client_authenticator(&creds, &auth); - status = dcerpc_netr_LogonSamLogon(p, mem_ctx, &r); - if (!NT_STATUS_IS_OK(status)) { - printf("LogonSamLogon - %s\n", nt_errstr(status)); - return False; - } + r.in.validation_level = i; - if (!creds_client_check(&creds, &r.out.authenticator->cred)) { - printf("Credential chaining failed\n"); + printf("Testing SamLogon with validation level %d\n", i); + + status = dcerpc_netr_LogonSamLogon(p, mem_ctx, &r); + if (!NT_STATUS_IS_OK(status)) { + printf("LogonSamLogon - %s\n", nt_errstr(status)); + ret = False; + } + + if (!creds_client_check(&creds, &r.out.authenticator->cred)) { + printf("Credential chaining failed\n"); + } } - return True; + return ret; } -- cgit