mirror of
https://github.com/samba-team/samba.git
synced 2024-12-22 13:34:15 +03:00
r3677: Seperate the SamLogon tests from the main RPC-NETLOGON test into a
RPC-SAMLOGON of their own.
I have expanded the tests to validate the use of various flags, which
change some of the crypto behaviour.
Andrew Bartlett
(This used to be commit 3a140a3691
)
This commit is contained in:
parent
5afda90c95
commit
a8db4dcf03
@ -46,7 +46,6 @@ struct samr_CryptPassword;
|
||||
struct samr_CryptPasswordEx;
|
||||
struct samr_LogonHours;
|
||||
|
||||
struct netr_SamInfo3;
|
||||
struct netr_Authenticator;
|
||||
union netr_Validation;
|
||||
|
||||
@ -111,3 +110,9 @@ struct net_context;
|
||||
struct file_info;
|
||||
|
||||
struct xattr_DosEAs;
|
||||
|
||||
struct test_join;
|
||||
|
||||
struct test_join_ads_dc;
|
||||
|
||||
struct netr_LMSessionKey;
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include "system/time.h"
|
||||
#include "auth/auth.h"
|
||||
#include "lib/crypto/crypto.h"
|
||||
#include "librpc/gen_ndr/ndr_netlogon.h"
|
||||
|
||||
/*
|
||||
initialise the credentials state for old-style 64 bit session keys
|
||||
@ -128,6 +129,26 @@ static void creds_step(struct creds_CredentialState *creds)
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
DES encrypt a 8 byte LMSessionKey buffer using the Netlogon session key
|
||||
*/
|
||||
void creds_des_encrypt_LMKey(struct creds_CredentialState *creds, struct netr_LMSessionKey *key)
|
||||
{
|
||||
struct netr_LMSessionKey tmp;
|
||||
des_crypt56(tmp.key, key->key, creds->session_key, 1);
|
||||
*key = tmp;
|
||||
}
|
||||
|
||||
/*
|
||||
DES decrypt a 8 byte LMSessionKey buffer using the Netlogon session key
|
||||
*/
|
||||
void creds_des_decrypt_LMKey(struct creds_CredentialState *creds, struct netr_LMSessionKey *key)
|
||||
{
|
||||
struct netr_LMSessionKey tmp;
|
||||
des_crypt56(tmp.key, key->key, creds->session_key, 0);
|
||||
*key = tmp;
|
||||
}
|
||||
|
||||
/*
|
||||
DES encrypt a 16 byte password buffer using the session key
|
||||
*/
|
||||
|
@ -89,6 +89,7 @@ ADD_OBJ_FILES = \
|
||||
torture/rpc/xplogin.o \
|
||||
torture/rpc/schannel.o \
|
||||
torture/rpc/netlogon.o \
|
||||
torture/rpc/samlogon.o \
|
||||
torture/rpc/bind.o
|
||||
REQUIRED_SUBSYSTEMS = \
|
||||
LIBSMB
|
||||
|
File diff suppressed because it is too large
Load Diff
1085
source4/torture/rpc/samlogon.c
Normal file
1085
source4/torture/rpc/samlogon.c
Normal file
File diff suppressed because it is too large
Load Diff
@ -22,6 +22,7 @@
|
||||
|
||||
#include "includes.h"
|
||||
#include "librpc/gen_ndr/ndr_samr.h"
|
||||
#include "librpc/gen_ndr/ndr_netlogon.h"
|
||||
|
||||
#define TEST_MACHINE_NAME "schanneltest"
|
||||
|
||||
@ -98,6 +99,23 @@ static BOOL test_schannel(TALLOC_CTX *mem_ctx,
|
||||
goto failed;
|
||||
}
|
||||
|
||||
status = dcerpc_pipe_connect_b(&p, &b,
|
||||
DCERPC_NETLOGON_UUID,
|
||||
DCERPC_NETLOGON_VERSION,
|
||||
lp_workgroup(),
|
||||
TEST_MACHINE_NAME,
|
||||
machine_password);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
printf("Failed to connect with schannel\n");
|
||||
goto failed;
|
||||
}
|
||||
|
||||
#if 0
|
||||
if (!test_netlogon_ops(p, mem_ctx)) {
|
||||
printf("Failed to process schannel secured ops\n");
|
||||
goto failed;
|
||||
}
|
||||
#endif
|
||||
|
||||
torture_leave_domain(join_ctx);
|
||||
dcerpc_pipe_close(p);
|
||||
|
@ -85,10 +85,10 @@ static NTSTATUS DeleteUser_byname(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
|
||||
an opaque pointer is returned. Pass it to torture_leave_domain()
|
||||
when finished
|
||||
*/
|
||||
void *torture_join_domain(const char *machine_name,
|
||||
const char *domain,
|
||||
uint16 acct_flags,
|
||||
const char **machine_password)
|
||||
struct test_join *torture_join_domain(const char *machine_name,
|
||||
const char *domain,
|
||||
uint16 acct_flags,
|
||||
const char **machine_password)
|
||||
{
|
||||
NTSTATUS status;
|
||||
struct samr_Connect c;
|
||||
@ -209,7 +209,7 @@ again:
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
printf("SetUserInfo level %u - no session key - %s\n",
|
||||
s.in.level, nt_errstr(status));
|
||||
torture_leave_domain(&join);
|
||||
torture_leave_domain(join);
|
||||
goto failed;
|
||||
}
|
||||
|
||||
@ -235,8 +235,9 @@ again:
|
||||
goto failed;
|
||||
}
|
||||
|
||||
*machine_password = join->machine_password;
|
||||
|
||||
if (machine_password) {
|
||||
*machine_password = join->machine_password;
|
||||
}
|
||||
return join;
|
||||
|
||||
failed:
|
||||
@ -248,9 +249,8 @@ failed:
|
||||
/*
|
||||
leave the domain, deleting the machine acct
|
||||
*/
|
||||
void torture_leave_domain(void *join_ctx)
|
||||
void torture_leave_domain(struct test_join *join)
|
||||
{
|
||||
struct test_join *join = join_ctx;
|
||||
struct samr_DeleteUser d;
|
||||
NTSTATUS status;
|
||||
|
||||
@ -276,9 +276,9 @@ struct test_join_ads_dc {
|
||||
struct test_join *join;
|
||||
};
|
||||
|
||||
void *torture_join_domain_ads_dc(const char *machine_name,
|
||||
const char *domain,
|
||||
const char **machine_password)
|
||||
struct test_join_ads_dc *torture_join_domain_ads_dc(const char *machine_name,
|
||||
const char *domain,
|
||||
const char **machine_password)
|
||||
{
|
||||
struct test_join_ads_dc *join;
|
||||
|
||||
@ -354,9 +354,8 @@ void *torture_join_domain_ads_dc(const char *machine_name,
|
||||
return join;
|
||||
}
|
||||
|
||||
void torture_leave_domain_ads_dc(void *join_ctx)
|
||||
void torture_leave_domain_ads_dc(struct test_join_ads_dc *join)
|
||||
{
|
||||
struct test_join_ads_dc *join = join_ctx;
|
||||
|
||||
if (join->join) {
|
||||
torture_leave_domain(join->join);
|
||||
|
@ -2438,6 +2438,7 @@ static struct {
|
||||
{"RPC-SPOOLSS", torture_rpc_spoolss, 0},
|
||||
{"RPC-SAMR", torture_rpc_samr, 0},
|
||||
{"RPC-NETLOGON", torture_rpc_netlogon, 0},
|
||||
{"RPC-SAMLOGON", torture_rpc_samlogon, 0},
|
||||
{"RPC-SCHANNEL", torture_rpc_schannel, 0},
|
||||
{"RPC-WKSSVC", torture_rpc_wkssvc, 0},
|
||||
{"RPC-SRVSVC", torture_rpc_srvsvc, 0},
|
||||
|
Loading…
Reference in New Issue
Block a user