summaryrefslogtreecommitdiff
path: root/source4/torture
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2004-04-23 05:40:18 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:51:33 -0500
commitb394a4c2ff4502a0bf2bf05a6c7036f708fdb090 (patch)
tree5ef7e34990e5987e6b095490bf58ecec29f18dd9 /source4/torture
parent493a37ba663686b7bee3f7093d6650a24250f101 (diff)
downloadsamba-b394a4c2ff4502a0bf2bf05a6c7036f708fdb090.tar.gz
samba-b394a4c2ff4502a0bf2bf05a6c7036f708fdb090.tar.bz2
samba-b394a4c2ff4502a0bf2bf05a6c7036f708fdb090.zip
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 84de0b7e58c69e0817b9d475de0895a54cc95927)
Diffstat (limited to 'source4/torture')
-rw-r--r--source4/torture/raw/setfileinfo.c5
-rw-r--r--source4/torture/rpc/autoidl.c2
-rw-r--r--source4/torture/rpc/samr.c72
-rw-r--r--source4/torture/torture.c7
4 files changed, 80 insertions, 6 deletions
diff --git a/source4/torture/raw/setfileinfo.c b/source4/torture/raw/setfileinfo.c
index 247e54a4b0..3a49c8baff 100644
--- a/source4/torture/raw/setfileinfo.c
+++ b/source4/torture/raw/setfileinfo.c
@@ -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;
}
diff --git a/source4/torture/rpc/autoidl.c b/source4/torture/rpc/autoidl.c
index 6021f10c49..1c164af333 100644
--- a/source4/torture/rpc/autoidl.c
+++ b/source4/torture/rpc/autoidl.c
@@ -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)
diff --git a/source4/torture/rpc/samr.c b/source4/torture/rpc/samr.c
index 7433627743..3e8ff53771 100644
--- a/source4/torture/rpc/samr.c
+++ b/source4/torture/rpc/samr.c
@@ -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;
}
diff --git a/source4/torture/torture.c b/source4/torture/torture.c
index 5c1ede6919..17aba4fb79 100644
--- a/source4/torture/torture.c
+++ b/source4/torture/torture.c
@@ -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();