From 8b30b0071cb7668f49b2ea5951d1180bf90371e3 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 1 Dec 2003 22:13:11 +0000 Subject: * another small API change in the credentials code * don't use static variables in the smbdes code (This used to be commit e6e09064646c347169852fa162c72fc0542c6d5c) --- source4/torture/rpc/netlogon.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'source4/torture/rpc/netlogon.c') diff --git a/source4/torture/rpc/netlogon.c b/source4/torture/rpc/netlogon.c index d0bffcc0e9..50b72dfec1 100644 --- a/source4/torture/rpc/netlogon.c +++ b/source4/torture/rpc/netlogon.c @@ -71,6 +71,7 @@ static BOOL test_SamLogon(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx) struct netr_ServerReqChallenge r; struct netr_ServerAuthenticate a; struct netr_LogonSamLogon l; + struct netr_LogonSamLogoff lo; const char *plain_pass; uint8 mach_pwd[16]; struct netr_Authenticator auth, auth2; @@ -83,8 +84,7 @@ static BOOL test_SamLogon(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx) r.in.server_name = NULL; r.in.computer_name = lp_netbios_name(); - r.in.credentials.low = 1; - r.in.credentials.high = 2; + generate_random_buffer(r.in.credentials.data, sizeof(r.in.credentials.data), False); status = dcerpc_netr_ServerReqChallenge(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { @@ -100,13 +100,13 @@ static BOOL test_SamLogon(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx) E_md4hash(plain_pass, mach_pwd); - creds_init(&creds, &r.in.credentials, &r.out.credentials, mach_pwd); + creds_init(&creds, &r.in.credentials, &r.out.credentials, mach_pwd, + &a.in.credentials); a.in.server_name = NULL; a.in.username = talloc_asprintf(mem_ctx, "%s$", lp_netbios_name()); a.in.secure_challenge_type = 2; a.in.computer_name = lp_netbios_name(); - a.in.credentials = creds.client_cred; printf("Testing ServerAuthenticate\n"); @@ -116,13 +116,11 @@ static BOOL test_SamLogon(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx) return False; } - if (!creds_next(&creds, &a.out.credentials)) { + if (!creds_check(&creds, &a.out.credentials)) { printf("Credential chaining failed\n"); + return False; } - auth.timestamp = 0; - auth.cred = creds.client_cred; - ninfo.logon_info.domain_name.string = lp_workgroup(); ninfo.logon_info.parameter_control = 0; ninfo.logon_info.logon_id_low = 0; @@ -140,6 +138,8 @@ static BOOL test_SamLogon(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx) ZERO_STRUCT(auth2); + creds_authenticator(&creds, &auth); + l.in.server_name = talloc_asprintf(mem_ctx, "\\\\%s", dcerpc_server_name(p)); l.in.workstation = lp_netbios_name(); l.in.credential = &auth; @@ -156,7 +156,7 @@ static BOOL test_SamLogon(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx) return False; } - if (!creds_next(&creds, &l.out.authenticator->cred)) { + if (!creds_check(&creds, &l.out.authenticator->cred)) { printf("Credential chaining failed\n"); } -- cgit