mirror of
https://github.com/samba-team/samba.git
synced 2024-12-24 21:34:56 +03:00
r336: added a -X command line option to smbtorture to enable dangerous or
possibly destructive tests. Use with care!
Added IDL and test code for samr_Shutdown() and samr_SetDsrmPassword()
(This used to be commit 84de0b7e58
)
This commit is contained in:
parent
493a37ba66
commit
b394a4c2ff
@ -1133,11 +1133,22 @@
|
||||
|
||||
/************************/
|
||||
/* Function 0x42 */
|
||||
NTSTATUS samr_SET_DSRM_PASSWORD();
|
||||
|
||||
/*
|
||||
this should set the DSRM password for the server, which is used
|
||||
when booting into Directory Services Recovery Mode on a DC. Win2003
|
||||
gives me NT_STATUS_NOT_SUPPORTED
|
||||
*/
|
||||
|
||||
NTSTATUS samr_SetDsrmPassword(
|
||||
[in] samr_Name *name,
|
||||
[in] uint32 unknown,
|
||||
[in] samr_Hash *hash
|
||||
);
|
||||
|
||||
|
||||
/************************/
|
||||
/* Function 0x43 */
|
||||
|
||||
/*
|
||||
I haven't been able to work out the format of this one yet.
|
||||
Seems to start with a switch level for a union?
|
||||
|
@ -525,6 +525,11 @@ BOOL torture_raw_sfileinfo_bug(int dummy)
|
||||
NTSTATUS status;
|
||||
int fnum;
|
||||
|
||||
if (lp_parm_int(-1, "torture", "dangerous") != 1) {
|
||||
printf("torture_raw_sfileinfo_bug disabled - enable dangerous tests to use\n");
|
||||
return True;
|
||||
}
|
||||
|
||||
if (!torture_open_connection(&cli)) {
|
||||
return False;
|
||||
}
|
||||
|
@ -227,7 +227,7 @@ static void test_scan_call(TALLOC_CTX *mem_ctx, const struct dcerpc_interface_ta
|
||||
|
||||
static void test_auto_scan(TALLOC_CTX *mem_ctx, const struct dcerpc_interface_table *iface)
|
||||
{
|
||||
test_scan_call(mem_ctx, iface, 0x26);
|
||||
test_scan_call(mem_ctx, iface, 0x42);
|
||||
}
|
||||
|
||||
BOOL torture_rpc_autoidl(int dummy)
|
||||
|
@ -61,6 +61,62 @@ static BOOL test_Close(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
|
||||
return True;
|
||||
}
|
||||
|
||||
static BOOL test_Shutdown(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
|
||||
struct policy_handle *handle)
|
||||
{
|
||||
NTSTATUS status;
|
||||
struct samr_Shutdown r;
|
||||
|
||||
if (lp_parm_int(-1, "torture", "dangerous") != 1) {
|
||||
printf("samr_Shutdown disabled - enable dangerous tests to use\n");
|
||||
return True;
|
||||
}
|
||||
|
||||
r.in.handle = handle;
|
||||
|
||||
printf("testing samr_Shutdown\n");
|
||||
|
||||
status = dcerpc_samr_Shutdown(p, mem_ctx, &r);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
printf("samr_Shutdown failed - %s\n", nt_errstr(status));
|
||||
return False;
|
||||
}
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
static BOOL test_SetDsrmPassword(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
|
||||
struct policy_handle *handle)
|
||||
{
|
||||
NTSTATUS status;
|
||||
struct samr_SetDsrmPassword r;
|
||||
struct samr_Name name;
|
||||
struct samr_Hash hash;
|
||||
|
||||
if (lp_parm_int(-1, "torture", "dangerous") != 1) {
|
||||
printf("samr_SetDsrmPassword disabled - enable dangerous tests to use\n");
|
||||
return True;
|
||||
}
|
||||
|
||||
E_md4hash("TeSTDSRM123", hash.hash);
|
||||
|
||||
init_samr_Name(&name, "Administrator");
|
||||
|
||||
r.in.name = &name;
|
||||
r.in.unknown = 0;
|
||||
r.in.hash = &hash;
|
||||
|
||||
printf("testing samr_SetDsrmPassword\n");
|
||||
|
||||
status = dcerpc_samr_SetDsrmPassword(p, mem_ctx, &r);
|
||||
if (!NT_STATUS_EQUAL(status, NT_STATUS_NOT_SUPPORTED)) {
|
||||
printf("samr_SetDsrmPassword failed - %s\n", nt_errstr(status));
|
||||
return False;
|
||||
}
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
|
||||
static BOOL test_QuerySecurity(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
|
||||
struct policy_handle *handle)
|
||||
@ -241,10 +297,10 @@ static BOOL test_SetUserInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
|
||||
TEST_USERINFO_INT(2, code_page, 21, code_page, __LINE__, 0);
|
||||
TEST_USERINFO_INT(21, code_page, 21, code_page, __LINE__, 0x00800000);
|
||||
|
||||
TEST_USERINFO_INT(4, logon_hours.bitmap[3], 3, logon_hours.bitmap[3], __LINE__, 0);
|
||||
TEST_USERINFO_INT(4, logon_hours.bitmap[3], 5, logon_hours.bitmap[3], __LINE__, 0);
|
||||
TEST_USERINFO_INT(4, logon_hours.bitmap[3], 21, logon_hours.bitmap[3], __LINE__, 0);
|
||||
TEST_USERINFO_INT(21, logon_hours.bitmap[3], 21, logon_hours.bitmap[3], __LINE__, 0x00002000);
|
||||
TEST_USERINFO_INT(4, logon_hours.bitmap[3], 3, logon_hours.bitmap[3], 1, 0);
|
||||
TEST_USERINFO_INT(4, logon_hours.bitmap[3], 5, logon_hours.bitmap[3], 2, 0);
|
||||
TEST_USERINFO_INT(4, logon_hours.bitmap[3], 21, logon_hours.bitmap[3], 3, 0);
|
||||
TEST_USERINFO_INT(21, logon_hours.bitmap[3], 21, logon_hours.bitmap[3], 4, 0x00002000);
|
||||
|
||||
#if 0
|
||||
/* these fail with win2003 - it appears you can't set the primary gid?
|
||||
@ -2637,6 +2693,14 @@ BOOL torture_rpc_samr(int dummy)
|
||||
ret = False;
|
||||
}
|
||||
|
||||
if (!test_SetDsrmPassword(p, mem_ctx, &handle)) {
|
||||
ret = False;
|
||||
}
|
||||
|
||||
if (!test_Shutdown(p, mem_ctx, &handle)) {
|
||||
ret = False;
|
||||
}
|
||||
|
||||
if (!test_Close(p, mem_ctx, &handle)) {
|
||||
ret = False;
|
||||
}
|
||||
|
@ -4070,6 +4070,7 @@ static void usage(void)
|
||||
printf("\t-s seed\n");
|
||||
printf("\t-f max failures\n");
|
||||
printf("\t-b bypass I/O (NBENCH)\n");
|
||||
printf("\t-X enable dangerous tests\n");
|
||||
printf("\n\n");
|
||||
|
||||
printf("tests are:");
|
||||
@ -4139,7 +4140,7 @@ static void usage(void)
|
||||
|
||||
srandom(time(NULL));
|
||||
|
||||
while ((opt = getopt(argc, argv, "p:hW:U:n:N:O:o:e:m:Ld:Ac:ks:f:s:t:C:")) != EOF) {
|
||||
while ((opt = getopt(argc, argv, "p:hW:U:n:N:O:o:e:m:Ld:Ac:ks:f:s:t:C:X")) != EOF) {
|
||||
switch (opt) {
|
||||
case 'p':
|
||||
lp_set_cmdline("smb ports", optarg);
|
||||
@ -4202,6 +4203,10 @@ static void usage(void)
|
||||
torture_failures = atoi(optarg);
|
||||
break;
|
||||
|
||||
case 'X':
|
||||
lp_set_cmdline("torture:dangerous", "1");
|
||||
break;
|
||||
|
||||
default:
|
||||
printf("Unknown option %c (%d)\n", (char)opt, opt);
|
||||
usage();
|
||||
|
Loading…
Reference in New Issue
Block a user