summaryrefslogtreecommitdiff
path: root/source4/torture
diff options
context:
space:
mode:
Diffstat (limited to 'source4/torture')
-rw-r--r--source4/torture/basic/base.c4
-rw-r--r--source4/torture/basic/delaywrite.c132
-rw-r--r--source4/torture/basic/delete.c2
-rw-r--r--source4/torture/basic/disconnect.c2
-rw-r--r--source4/torture/config.mk2
-rw-r--r--source4/torture/drs/python/fsmo.py4
-rw-r--r--source4/torture/drs/unit/prefixmap_tests.c9
-rw-r--r--source4/torture/drs/unit/schemainfo_tests.c81
-rw-r--r--source4/torture/gentest.c2
-rw-r--r--source4/torture/libnetapi/config.mk3
-rw-r--r--source4/torture/libnetapi/libnetapi.c1
-rw-r--r--source4/torture/libnetapi/libnetapi_server.c76
-rw-r--r--source4/torture/libnetapi/wscript_build2
-rw-r--r--source4/torture/nbench/nbio.c4
-rw-r--r--source4/torture/nbt/winsreplication.c4
-rw-r--r--source4/torture/ndr/ndr.c1
-rw-r--r--source4/torture/ndr/ntlmssp.c119
-rw-r--r--source4/torture/ndr/winreg.c4
-rw-r--r--source4/torture/raw/notify.c8
-rw-r--r--source4/torture/rpc/handles.c6
-rw-r--r--source4/torture/rpc/lsa.c2
-rw-r--r--source4/torture/rpc/netlogon.c10
-rw-r--r--source4/torture/rpc/svcctl.c63
-rw-r--r--source4/torture/smb2/lease.c2
-rw-r--r--source4/torture/smb2/notify.c8
-rw-r--r--source4/torture/util_smb.c4
-rw-r--r--source4/torture/wscript_build2
27 files changed, 453 insertions, 104 deletions
diff --git a/source4/torture/basic/base.c b/source4/torture/basic/base.c
index c9148d1915..7b96e1c093 100644
--- a/source4/torture/basic/base.c
+++ b/source4/torture/basic/base.c
@@ -680,13 +680,13 @@ static bool run_deferopen(struct torture_context *tctx, struct smbcli_state *cli
torture_comment(tctx, "pid %u open %d\n", (unsigned)getpid(), i);
- msleep(10 * msec);
+ smb_msleep(10 * msec);
i++;
if (NT_STATUS_IS_ERR(smbcli_close(cli->tree, fnum))) {
torture_comment(tctx,"Failed to close %s, error=%s\n", fname, smbcli_errstr(cli->tree));
return false;
}
- msleep(2 * msec);
+ smb_msleep(2 * msec);
}
if (NT_STATUS_IS_ERR(smbcli_unlink(cli->tree, fname))) {
diff --git a/source4/torture/basic/delaywrite.c b/source4/torture/basic/delaywrite.c
index 0c43c29cad..f82b32fe8d 100644
--- a/source4/torture/basic/delaywrite.c
+++ b/source4/torture/basic/delaywrite.c
@@ -111,7 +111,7 @@ static bool test_delayed_write_update(struct torture_context *tctx, struct smbcl
break;
}
fflush(stdout);
- msleep(1 * msec);
+ smb_msleep(1 * msec);
}
if (finfo1.basic_info.out.write_time == finfo2.basic_info.out.write_time) {
@@ -162,7 +162,7 @@ static bool test_delayed_write_update1(struct torture_context *tctx, struct smbc
/* 3 second delay to ensure we get past any 2 second time
granularity (older systems may have that) */
- msleep(3 * msec);
+ smb_msleep(3 * msec);
finfo1.all_info.level = RAW_FILEINFO_ALL_INFO;
finfo1.all_info.in.file.fnum = fnum1;
@@ -180,7 +180,7 @@ static bool test_delayed_write_update1(struct torture_context *tctx, struct smbc
/* 3 second delay to ensure we get past any 2 second time
granularity (older systems may have that) */
- msleep(3 * msec);
+ smb_msleep(3 * msec);
/* Do a zero length SMBwrite call to truncate. */
written = smbcli_smbwrite(cli->tree, fnum1, "x", 1024, 0);
@@ -231,7 +231,7 @@ static bool test_delayed_write_update1(struct torture_context *tctx, struct smbc
break;
}
fflush(stdout);
- msleep(1 * msec);
+ smb_msleep(1 * msec);
}
if (finfo1.all_info.out.write_time == finfo2.all_info.out.write_time) {
@@ -241,7 +241,7 @@ static bool test_delayed_write_update1(struct torture_context *tctx, struct smbc
}
fflush(stdout);
- msleep(2 * msec);
+ smb_msleep(2 * msec);
/* Do a non-zero length SMBwrite and make sure it doesn't update the write time. */
written = smbcli_smbwrite(cli->tree, fnum1, "x", 0, 1);
@@ -282,7 +282,7 @@ static bool test_delayed_write_update1(struct torture_context *tctx, struct smbc
break;
}
fflush(stdout);
- msleep(1 * msec);
+ smb_msleep(1 * msec);
}
if (finfo2.all_info.out.write_time != finfo3.all_info.out.write_time) {
@@ -292,7 +292,7 @@ static bool test_delayed_write_update1(struct torture_context *tctx, struct smbc
}
fflush(stdout);
- msleep(2 * msec);
+ smb_msleep(2 * msec);
/* the close should trigger an write time update */
smbcli_close(cli->tree, fnum1);
@@ -353,7 +353,7 @@ static bool test_delayed_write_update1a(struct torture_context *tctx, struct smb
/* 3 second delay to ensure we get past any 2 second time
granularity (older systems may have that) */
- msleep(3 * msec);
+ smb_msleep(3 * msec);
finfo1.all_info.level = RAW_FILEINFO_ALL_INFO;
finfo1.all_info.in.file.fnum = fnum1;
@@ -418,7 +418,7 @@ static bool test_delayed_write_update1a(struct torture_context *tctx, struct smb
break;
}
fflush(stdout);
- msleep(1 * msec);
+ smb_msleep(1 * msec);
}
if (finfo1.all_info.out.write_time == finfo2.all_info.out.write_time) {
@@ -428,7 +428,7 @@ static bool test_delayed_write_update1a(struct torture_context *tctx, struct smb
}
fflush(stdout);
- msleep(2 * msec);
+ smb_msleep(2 * msec);
/* Do a non-zero length SMBwrite and make sure it doesn't update the write time. */
written = smbcli_smbwrite(cli->tree, fnum1, "x", 0, 1);
@@ -467,7 +467,7 @@ static bool test_delayed_write_update1a(struct torture_context *tctx, struct smb
break;
}
fflush(stdout);
- msleep(1 * msec);
+ smb_msleep(1 * msec);
}
if (finfo2.all_info.out.write_time != finfo3.all_info.out.write_time) {
@@ -535,7 +535,7 @@ static bool test_delayed_write_update1b(struct torture_context *tctx, struct smb
/* 3 second delay to ensure we get past any 2 second time
granularity (older systems may have that) */
- msleep(3 * msec);
+ smb_msleep(3 * msec);
finfo1.all_info.level = RAW_FILEINFO_ALL_INFO;
finfo1.all_info.in.file.fnum = fnum1;
@@ -596,7 +596,7 @@ static bool test_delayed_write_update1b(struct torture_context *tctx, struct smb
break;
}
fflush(stdout);
- msleep(1 * msec);
+ smb_msleep(1 * msec);
}
if (finfo1.all_info.out.write_time == finfo2.all_info.out.write_time) {
@@ -606,7 +606,7 @@ static bool test_delayed_write_update1b(struct torture_context *tctx, struct smb
}
fflush(stdout);
- msleep(2 * msec);
+ smb_msleep(2 * msec);
/* Do a non-zero length SMBwrite and make sure it doesn't update the write time. */
written = smbcli_smbwrite(cli->tree, fnum1, "x", 0, 1);
@@ -644,7 +644,7 @@ static bool test_delayed_write_update1b(struct torture_context *tctx, struct smb
break;
}
fflush(stdout);
- msleep(1 * msec);
+ smb_msleep(1 * msec);
}
if (finfo2.all_info.out.write_time != finfo3.all_info.out.write_time) {
@@ -710,7 +710,7 @@ static bool test_delayed_write_update1c(struct torture_context *tctx, struct smb
/* 3 second delay to ensure we get past any 2 second time
granularity (older systems may have that) */
- msleep(3 * msec);
+ smb_msleep(3 * msec);
finfo1.all_info.level = RAW_FILEINFO_ALL_INFO;
finfo1.all_info.in.file.fnum = fnum1;
@@ -776,7 +776,7 @@ static bool test_delayed_write_update1c(struct torture_context *tctx, struct smb
break;
}
fflush(stdout);
- msleep(1 * msec);
+ smb_msleep(1 * msec);
}
if (finfo1.all_info.out.write_time == finfo2.all_info.out.write_time) {
@@ -786,7 +786,7 @@ static bool test_delayed_write_update1c(struct torture_context *tctx, struct smb
}
fflush(stdout);
- msleep(2 * msec);
+ smb_msleep(2 * msec);
/* Do a non-zero length SMBwrite and make sure it doesn't update the write time. */
written = smbcli_smbwrite(cli->tree, fnum1, "x", 0, 1);
@@ -822,7 +822,7 @@ static bool test_delayed_write_update1c(struct torture_context *tctx, struct smb
break;
}
fflush(stdout);
- msleep(1 * msec);
+ smb_msleep(1 * msec);
}
if (finfo2.all_info.out.write_time != finfo3.all_info.out.write_time) {
@@ -900,7 +900,7 @@ static bool test_delayed_write_update2(struct torture_context *tctx, struct smbc
/* 3 second delay to ensure we get past any 2 second time
granularity (older systems may have that) */
- msleep(3 * msec);
+ smb_msleep(3 * msec);
{
/* Try using setfileinfo instead of write to update write time. */
@@ -1007,7 +1007,7 @@ static bool test_delayed_write_update2(struct torture_context *tctx, struct smbc
break;
}
fflush(stdout);
- msleep(1 * msec);
+ smb_msleep(1 * msec);
}
if (finfo1.basic_info.out.write_time == finfo2.basic_info.out.write_time) {
@@ -1015,7 +1015,7 @@ static bool test_delayed_write_update2(struct torture_context *tctx, struct smbc
}
fflush(stdout);
- msleep(2 * msec);
+ smb_msleep(2 * msec);
fnum2 = smbcli_open(cli->tree, fname, O_RDWR, DENY_NONE);
if (fnum2 == -1) {
@@ -1099,7 +1099,7 @@ static bool test_delayed_write_update2(struct torture_context *tctx, struct smbc
break;
}
fflush(stdout);
- msleep(1 * msec);
+ smb_msleep(1 * msec);
}
if (finfo1.basic_info.out.write_time == finfo2.basic_info.out.write_time) {
@@ -1131,7 +1131,7 @@ static bool test_delayed_write_update2(struct torture_context *tctx, struct smbc
torture_comment(tctx, "Second open initial write time %s\n",
nt_time_string(tctx, finfo1.basic_info.out.write_time));
- msleep(10 * msec);
+ smb_msleep(10 * msec);
torture_comment(tctx, "Doing a 10 byte write to extend the file to see if this changes the last write time.\n");
written = smbcli_write(cli->tree, fnum1, 0, "0123456789", 31, 10);
@@ -1187,7 +1187,7 @@ static bool test_delayed_write_update2(struct torture_context *tctx, struct smbc
break;
}
fflush(stdout);
- msleep(1*msec);
+ smb_msleep(1*msec);
}
if (finfo1.basic_info.out.write_time == finfo2.basic_info.out.write_time) {
@@ -1258,7 +1258,7 @@ static bool test_finfo_after_write(struct torture_context *tctx, struct smbcli_s
goto done;
}
- msleep(1 * msec);
+ smb_msleep(1 * msec);
written = smbcli_write(cli->tree, fnum1, 0, "x", 0, 1);
@@ -1573,7 +1573,7 @@ static bool test_delayed_write_update3(struct torture_context *tctx,
diff, sec);
break;
}
- msleep(0.5 * msec);
+ smb_msleep(0.5 * msec);
}
GET_INFO_BOTH(finfo1,pinfo1);
@@ -1602,7 +1602,7 @@ static bool test_delayed_write_update3(struct torture_context *tctx,
ret = false;
break;
}
- msleep(1 * msec);
+ smb_msleep(1 * msec);
}
GET_INFO_BOTH(finfo2,pinfo2);
@@ -1612,7 +1612,7 @@ static bool test_delayed_write_update3(struct torture_context *tctx,
}
/* sleep */
- msleep(5 * msec);
+ smb_msleep(5 * msec);
GET_INFO_BOTH(finfo3,pinfo3);
COMPARE_WRITE_TIME_EQUAL(finfo3, finfo2);
@@ -1699,7 +1699,7 @@ static bool test_delayed_write_update3a(struct torture_context *tctx,
* sleep some time, to demonstrate the handling of write times
* doesn't depend on the time since the open
*/
- msleep(5 * msec);
+ smb_msleep(5 * msec);
/* get the initial times */
GET_INFO_BOTH(finfo1,pinfo1);
@@ -1739,20 +1739,20 @@ static bool test_delayed_write_update3a(struct torture_context *tctx,
diff, sec);
break;
}
- msleep(0.5 * msec);
+ smb_msleep(0.5 * msec);
}
GET_INFO_BOTH(finfo1,pinfo1);
COMPARE_WRITE_TIME_GREATER(pinfo1, pinfo0);
- msleep(3 * msec);
+ smb_msleep(3 * msec);
/*
* demonstrate that a truncate write always
* updates the write time immediately
*/
for (i=0; i < 3; i++) {
- msleep(2 * msec);
+ smb_msleep(2 * msec);
/* do a write */
torture_comment(tctx, "Do a truncate SMBwrite [%d] on the file handle\n", i);
written = smbcli_smbwrite(cli->tree, fnum1, "x", 10240, 0);
@@ -1767,7 +1767,7 @@ static bool test_delayed_write_update3a(struct torture_context *tctx,
finfo1 = finfo2;
}
- msleep(3 * msec);
+ smb_msleep(3 * msec);
/* sure any further write doesn't update the write time */
start = timeval_current();
@@ -1792,7 +1792,7 @@ static bool test_delayed_write_update3a(struct torture_context *tctx,
ret = false;
break;
}
- msleep(1 * msec);
+ smb_msleep(1 * msec);
}
GET_INFO_BOTH(finfo2,pinfo2);
@@ -1802,7 +1802,7 @@ static bool test_delayed_write_update3a(struct torture_context *tctx,
}
/* sleep */
- msleep(3 * msec);
+ smb_msleep(3 * msec);
/* get the initial times */
GET_INFO_BOTH(finfo1,pinfo1);
@@ -1813,7 +1813,7 @@ static bool test_delayed_write_update3a(struct torture_context *tctx,
* updates the write time immediately
*/
for (i=0; i < 3; i++) {
- msleep(2 * msec);
+ smb_msleep(2 * msec);
/* do a write */
torture_comment(tctx, "Do a truncate SMBwrite [%d] on the file handle\n", i);
written = smbcli_smbwrite(cli->tree, fnum1, "x", 512, 0);
@@ -1829,7 +1829,7 @@ static bool test_delayed_write_update3a(struct torture_context *tctx,
}
/* sleep */
- msleep(3 * msec);
+ smb_msleep(3 * msec);
GET_INFO_BOTH(finfo3,pinfo3);
COMPARE_WRITE_TIME_EQUAL(finfo3, finfo2);
@@ -1914,7 +1914,7 @@ static bool test_delayed_write_update3b(struct torture_context *tctx,
* sleep some time, to demonstrate the handling of write times
* doesn't depend on the time since the open
*/
- msleep(5 * msec);
+ smb_msleep(5 * msec);
/* get the initial times */
GET_INFO_BOTH(finfo1,pinfo1);
@@ -1954,7 +1954,7 @@ static bool test_delayed_write_update3b(struct torture_context *tctx,
diff, sec);
break;
}
- msleep(0.5 * msec);
+ smb_msleep(0.5 * msec);
}
GET_INFO_BOTH(finfo1,pinfo1);
@@ -1983,7 +1983,7 @@ static bool test_delayed_write_update3b(struct torture_context *tctx,
ret = false;
break;
}
- msleep(1 * msec);
+ smb_msleep(1 * msec);
}
GET_INFO_BOTH(finfo2,pinfo2);
@@ -1993,7 +1993,7 @@ static bool test_delayed_write_update3b(struct torture_context *tctx,
}
/* sleep */
- msleep(5 * msec);
+ smb_msleep(5 * msec);
GET_INFO_BOTH(finfo3,pinfo3);
COMPARE_WRITE_TIME_EQUAL(finfo3, finfo2);
@@ -2082,7 +2082,7 @@ static bool test_delayed_write_update3c(struct torture_context *tctx,
* sleep some time, to demonstrate the handling of write times
* doesn't depend on the time since the open
*/
- msleep(5 * msec);
+ smb_msleep(5 * msec);
/* get the initial times */
GET_INFO_BOTH(finfo1,pinfo1);
@@ -2093,7 +2093,7 @@ static bool test_delayed_write_update3c(struct torture_context *tctx,
* updates the write time immediately
*/
for (i=0; i < 3; i++) {
- msleep(2 * msec);
+ smb_msleep(2 * msec);
/* do a write */
torture_comment(tctx, "Do a truncate SMBwrite [%d] on the file handle\n", i);
written = smbcli_smbwrite(cli->tree, fnum1, "x", 512, 0);
@@ -2130,7 +2130,7 @@ static bool test_delayed_write_update3c(struct torture_context *tctx,
ret = false;
break;
}
- msleep(1 * msec);
+ smb_msleep(1 * msec);
}
GET_INFO_BOTH(finfo2,pinfo2);
@@ -2140,7 +2140,7 @@ static bool test_delayed_write_update3c(struct torture_context *tctx,
}
/* sleep */
- msleep(5 * msec);
+ smb_msleep(5 * msec);
/* get the initial times */
GET_INFO_BOTH(finfo1,pinfo1);
@@ -2151,7 +2151,7 @@ static bool test_delayed_write_update3c(struct torture_context *tctx,
* updates the write time immediately
*/
for (i=0; i < 3; i++) {
- msleep(2 * msec);
+ smb_msleep(2 * msec);
/* do a write */
torture_comment(tctx, "Do a truncate write [%d] on the file handle\n", i);
written = smbcli_smbwrite(cli->tree, fnum1, "x", 512, 0);
@@ -2167,7 +2167,7 @@ static bool test_delayed_write_update3c(struct torture_context *tctx,
}
/* sleep */
- msleep(5 * msec);
+ smb_msleep(5 * msec);
GET_INFO_BOTH(finfo2,pinfo2);
COMPARE_WRITE_TIME_EQUAL(finfo2, finfo1);
@@ -2195,7 +2195,7 @@ static bool test_delayed_write_update3c(struct torture_context *tctx,
ret = false;
break;
}
- msleep(1 * msec);
+ smb_msleep(1 * msec);
}
GET_INFO_BOTH(finfo2,pinfo2);
@@ -2205,7 +2205,7 @@ static bool test_delayed_write_update3c(struct torture_context *tctx,
}
/* sleep */
- msleep(5 * msec);
+ smb_msleep(5 * msec);
GET_INFO_BOTH(finfo3,pinfo3);
COMPARE_WRITE_TIME_EQUAL(finfo3, finfo2);
@@ -2289,7 +2289,7 @@ static bool test_delayed_write_update4(struct torture_context *tctx,
GET_INFO_BOTH(finfo0,pinfo0);
/* sleep a bit */
- msleep(5 * msec);
+ smb_msleep(5 * msec);
/* do a write */
torture_comment(tctx, "Do a write on the file handle\n");
@@ -2329,7 +2329,7 @@ static bool test_delayed_write_update4(struct torture_context *tctx,
diff, sec);
break;
}
- msleep(0.5 * msec);
+ smb_msleep(0.5 * msec);
}
GET_INFO_BOTH(finfo1,pinfo1);
@@ -2358,7 +2358,7 @@ static bool test_delayed_write_update4(struct torture_context *tctx,
ret = false;
break;
}
- msleep(1 * msec);
+ smb_msleep(1 * msec);
}
GET_INFO_BOTH(finfo2,pinfo2);
@@ -2368,7 +2368,7 @@ static bool test_delayed_write_update4(struct torture_context *tctx,
}
/* sleep */
- msleep(5 * msec);
+ smb_msleep(5 * msec);
GET_INFO_BOTH(finfo3,pinfo3);
COMPARE_WRITE_TIME_EQUAL(finfo3, finfo2);
@@ -2489,7 +2489,7 @@ static bool test_delayed_write_update5(struct torture_context *tctx,
ret = false;
break;
}
- msleep(1 * msec);
+ smb_msleep(1 * msec);
}
GET_INFO_BOTH(finfo3,pinfo3);
@@ -2521,7 +2521,7 @@ static bool test_delayed_write_update5(struct torture_context *tctx,
ret = false;
break;
}
- msleep(1 * msec);
+ smb_msleep(1 * msec);
}
GET_INFO_BOTH(finfo4,pinfo4);
@@ -2531,7 +2531,7 @@ static bool test_delayed_write_update5(struct torture_context *tctx,
}
/* sleep */
- msleep(5 * msec);
+ smb_msleep(5 * msec);
GET_INFO_BOTH(finfo5,pinfo5);
COMPARE_WRITE_TIME_EQUAL(finfo5, finfo4);
@@ -2651,7 +2651,7 @@ static bool test_delayed_write_update5b(struct torture_context *tctx,
ret = false;
break;
}
- msleep(1 * msec);
+ smb_msleep(1 * msec);
}
GET_INFO_BOTH(finfo3,pinfo3);
@@ -2683,7 +2683,7 @@ static bool test_delayed_write_update5b(struct torture_context *tctx,
ret = false;
break;
}
- msleep(1 * msec);
+ smb_msleep(1 * msec);
}
GET_INFO_BOTH(finfo4,pinfo4);
@@ -2693,7 +2693,7 @@ static bool test_delayed_write_update5b(struct torture_context *tctx,
}
/* sleep */
- msleep(5 * msec);
+ smb_msleep(5 * msec);
GET_INFO_BOTH(finfo5,pinfo5);
COMPARE_WRITE_TIME_EQUAL(finfo5, finfo4);
@@ -2830,7 +2830,7 @@ again:
ret = false;
break;
}
- msleep(1 * msec);
+ smb_msleep(1 * msec);
}
GET_INFO_BOTH(finfo3,pinfo3);
@@ -2862,7 +2862,7 @@ again:
ret = false;
break;
}
- msleep(1 * msec);
+ smb_msleep(1 * msec);
}
GET_INFO_BOTH(finfo4,pinfo4);
@@ -2872,7 +2872,7 @@ again:
}
/* sleep */
- msleep(5 * msec);
+ smb_msleep(5 * msec);
GET_INFO_BOTH(finfo5,pinfo5);
COMPARE_WRITE_TIME_EQUAL(finfo5, finfo4);
@@ -2898,7 +2898,7 @@ again:
COMPARE_WRITE_TIME_EQUAL(finfo5, pinfo6);
/* See if we have lost the sticky write time on handle2 */
- msleep(3 * msec);
+ smb_msleep(3 * msec);
torture_comment(tctx, "Have we lost the sticky write time ?\n");
/* Make sure any further normal write doesn't update the write time */
@@ -2925,7 +2925,7 @@ again:
ret = false;
break;
}
- msleep(1 * msec);
+ smb_msleep(1 * msec);
}
/* What about a truncate write ? */
@@ -2952,7 +2952,7 @@ again:
ret = false;
break;
}
- msleep(1 * msec);
+ smb_msleep(1 * msec);
}
diff --git a/source4/torture/basic/delete.c b/source4/torture/basic/delete.c
index 22d92193b9..2b26b1e64a 100644
--- a/source4/torture/basic/delete.c
+++ b/source4/torture/basic/delete.c
@@ -1422,7 +1422,7 @@ static bool deltest21(struct torture_context *tctx)
/* On slow build farm machines it might happen that they are not fast
* enogh to delete the file for this test */
- msleep(200);
+ smb_msleep(200);
/* File should not be there. */
fnum1 = smbcli_nt_create_full(cli1->tree, fname, 0,
diff --git a/source4/torture/basic/disconnect.c b/source4/torture/basic/disconnect.c
index 7f071178f4..2cfa72048e 100644
--- a/source4/torture/basic/disconnect.c
+++ b/source4/torture/basic/disconnect.c
@@ -162,7 +162,7 @@ bool torture_disconnect(struct torture_context *torture)
* new process comes in. Try to get rid of the random
* failures in the build farm.
*/
- msleep(200);
+ smb_msleep(200);
}
}
diff --git a/source4/torture/config.mk b/source4/torture/config.mk
index 9ee2edfdd0..4e5c852df7 100644
--- a/source4/torture/config.mk
+++ b/source4/torture/config.mk
@@ -95,7 +95,7 @@ mkinclude libsmbclient/config.mk
[SUBSYSTEM::TORTURE_NDR]
PRIVATE_DEPENDENCIES = torture SERVICE_SMB
-TORTURE_NDR_OBJ_FILES = $(addprefix $(torturesrcdir)/ndr/, ndr.o winreg.o atsvc.o lsa.o epmap.o dfs.o netlogon.o drsuapi.o spoolss.o samr.o dfsblob.o drsblobs.o nbt.o)
+TORTURE_NDR_OBJ_FILES = $(addprefix $(torturesrcdir)/ndr/, ndr.o winreg.o atsvc.o lsa.o epmap.o dfs.o netlogon.o drsuapi.o spoolss.o samr.o dfsblob.o drsblobs.o nbt.o ntlmssp.o)
$(eval $(call proto_header_template,$(torturesrcdir)/ndr/proto.h,$(TORTURE_NDR_OBJ_FILES:.o=.c)))
diff --git a/source4/torture/drs/python/fsmo.py b/source4/torture/drs/python/fsmo.py
index c64a0b2987..9b13275e18 100644
--- a/source4/torture/drs/python/fsmo.py
+++ b/source4/torture/drs/python/fsmo.py
@@ -148,6 +148,10 @@ class DrsFsmoTestCase(samba.tests.TestCase):
self._role_transfer(role="rid", role_dn=self.rid_dn)
pass
+ def test_NamingMasterTransfer(self):
+ self._role_transfer(role="naming", role_dn=self.naming_dn)
+ pass
+
########################################################################################
def get_env_var(var_name):
diff --git a/source4/torture/drs/unit/prefixmap_tests.c b/source4/torture/drs/unit/prefixmap_tests.c
index a4521eb675..a954399771 100644
--- a/source4/torture/drs/unit/prefixmap_tests.c
+++ b/source4/torture/drs/unit/prefixmap_tests.c
@@ -394,8 +394,13 @@ static bool torture_drs_unit_pfm_oid_from_attid_check_attid(struct torture_conte
const char *oid;
/* Test with valid prefixMap attid */
- werr = dsdb_schema_pfm_oid_from_attid(priv->pfm_full, 0x00000000, tctx, &oid);
- torture_assert_werr_ok(tctx, werr, "Testing prefixMap type attid = 0x0000000");
+ werr = dsdb_schema_pfm_oid_from_attid(priv->pfm_full, 0x00010001, tctx, &oid);
+ torture_assert_werr_ok(tctx, werr, "Testing prefixMap type attid = 0x00010001");
+
+ /* Test with valid attid but invalid index */
+ werr = dsdb_schema_pfm_oid_from_attid(priv->pfm_full, 0x01110001, tctx, &oid);
+ torture_assert_werr_equal(tctx, werr, WERR_DS_NO_ATTRIBUTE_OR_VALUE,
+ "Testing invalid-index attid = 0x01110001");
/* Test with attid in msDS-IntId range */
werr = dsdb_schema_pfm_oid_from_attid(priv->pfm_full, 0x80000000, tctx, &oid);
diff --git a/source4/torture/drs/unit/schemainfo_tests.c b/source4/torture/drs/unit/schemainfo_tests.c
index 3958eb365b..e419ab0c49 100644
--- a/source4/torture/drs/unit/schemainfo_tests.c
+++ b/source4/torture/drs/unit/schemainfo_tests.c
@@ -297,6 +297,82 @@ static bool test_dsdb_blob_from_schema_info(struct torture_context *tctx,
return true;
}
+static bool test_dsdb_schema_info_cmp(struct torture_context *tctx,
+ struct drsut_schemainfo_data *priv)
+{
+ DATA_BLOB blob;
+ struct drsuapi_DsReplicaOIDMapping_Ctr *ctr;
+
+ ctr = talloc_zero(priv, struct drsuapi_DsReplicaOIDMapping_Ctr);
+ torture_assert(tctx, ctr, "Not enough memory!");
+
+ /* not enough elements */
+ torture_assert_werr_equal(tctx,
+ dsdb_schema_info_cmp(priv->schema, ctr),
+ WERR_INVALID_PARAMETER,
+ "dsdb_schema_info_cmp(): unexpected result");
+
+ /* an empty element for schemaInfo */
+ ctr->num_mappings = 1;
+ ctr->mappings = talloc_zero_array(ctr, struct drsuapi_DsReplicaOIDMapping, 1);
+ torture_assert(tctx, ctr->mappings, "Not enough memory!");
+ torture_assert_werr_equal(tctx,
+ dsdb_schema_info_cmp(priv->schema, ctr),
+ WERR_INVALID_PARAMETER,
+ "dsdb_schema_info_cmp(): unexpected result");
+
+ /* test with invalid schemaInfo - length != 21 */
+ blob = strhex_to_data_blob(ctr, "FF00000001FD821C07C7455143A3DB51F75A630A7F00");
+ torture_assert(tctx, blob.data, "Not enough memory!");
+ ctr->mappings[0].oid.length = blob.length;
+ ctr->mappings[0].oid.binary_oid = blob.data;
+ torture_assert_werr_equal(tctx,
+ dsdb_schema_info_cmp(priv->schema, ctr),
+ WERR_INVALID_PARAMETER,
+ "dsdb_schema_info_cmp(): unexpected result");
+
+ /* test with invalid schemaInfo - marker != 0xFF */
+ blob = strhex_to_data_blob(ctr, "AA00000001FD821C07C7455143A3DB51F75A630A7F");
+ torture_assert(tctx, blob.data, "Not enough memory!");
+ ctr->mappings[0].oid.length = blob.length;
+ ctr->mappings[0].oid.binary_oid = blob.data;
+ torture_assert_werr_equal(tctx,
+ dsdb_schema_info_cmp(priv->schema, ctr),
+ WERR_INVALID_PARAMETER,
+ "dsdb_schema_info_cmp(): unexpected result");
+
+ /* test with valid schemaInfo, but not correct one */
+ blob = strhex_to_data_blob(ctr, "FF0000000000000000000000000000000000000000");
+ torture_assert(tctx, blob.data, "Not enough memory!");
+ ctr->mappings[0].oid.length = blob.length;
+ ctr->mappings[0].oid.binary_oid = blob.data;
+ torture_assert_werr_equal(tctx,
+ dsdb_schema_info_cmp(priv->schema, ctr),
+ WERR_DS_DRA_SCHEMA_MISMATCH,
+ "dsdb_schema_info_cmp(): unexpected result");
+
+ /* test with correct schemaInfo, but invalid ATTID */
+ blob = strhex_to_data_blob(ctr, priv->schema->schema_info);
+ torture_assert(tctx, blob.data, "Not enough memory!");
+ ctr->mappings[0].id_prefix = 1;
+ ctr->mappings[0].oid.length = blob.length;
+ ctr->mappings[0].oid.binary_oid = blob.data;
+ torture_assert_werr_equal(tctx,
+ dsdb_schema_info_cmp(priv->schema, ctr),
+ WERR_INVALID_PARAMETER,
+ "dsdb_schema_info_cmp(): unexpected result");
+
+ /* test with valid schemaInfo */
+ blob = strhex_to_data_blob(ctr, priv->schema->schema_info);
+ ctr->mappings[0].id_prefix = 0;
+ torture_assert_werr_ok(tctx,
+ dsdb_schema_info_cmp(priv->schema, ctr),
+ "dsdb_schema_info_cmp(): unexpected result");
+
+ talloc_free(ctr);
+ return true;
+}
+
/*
* Tests dsdb_module_schema_info_blob_read()
* and dsdb_module_schema_info_blob_write()
@@ -515,6 +591,9 @@ static bool torture_drs_unit_schemainfo_setup(struct torture_context *tctx,
/* create schema mockup object */
priv->schema = dsdb_new_schema(priv);
+ /* set schema_info in dsdb_schema for testing */
+ priv->schema->schema_info = talloc_strdup(priv->schema, SCHEMA_INFO_DEFAULT_STR);
+
/* pre-cache invocationId for samdb_ntds_invocation_id()
* to work with our mock ldb */
ldb_err = ldb_set_opaque(priv->ldb, "cache.invocation_id",
@@ -575,6 +654,8 @@ struct torture_tcase * torture_drs_unit_schemainfo(struct torture_suite *suite)
(pfn_run)test_dsdb_schema_info_from_blob);
torture_tcase_add_simple_test(tc, "dsdb_blob_from_schema_info",
(pfn_run)test_dsdb_blob_from_schema_info);
+ torture_tcase_add_simple_test(tc, "dsdb_schema_info_cmp",
+ (pfn_run)test_dsdb_schema_info_cmp);
torture_tcase_add_simple_test(tc, "dsdb_module_schema_info_blob read|write",
(pfn_run)test_dsdb_module_schema_info_blob_rw);
torture_tcase_add_simple_test(tc, "dsdb_module_schema_info_update",
diff --git a/source4/torture/gentest.c b/source4/torture/gentest.c
index 4fc05df3f4..6f69460dc8 100644
--- a/source4/torture/gentest.c
+++ b/source4/torture/gentest.c
@@ -1211,7 +1211,7 @@ static void check_pending(void)
{
int i, j;
- msleep(20);
+ smb_msleep(20);
for (j=0;j<NINSTANCES;j++) {
for (i=0;i<NSERVERS;i++) {
diff --git a/source4/torture/libnetapi/config.mk b/source4/torture/libnetapi/config.mk
index 2ac506e1b2..0cd485e44a 100644
--- a/source4/torture/libnetapi/config.mk
+++ b/source4/torture/libnetapi/config.mk
@@ -12,6 +12,7 @@ PRIVATE_DEPENDENCIES = \
TORTURE_LIBNETAPI_OBJ_FILES = $(addprefix $(torturesrcdir)/libnetapi/, libnetapi.o \
libnetapi_user.o \
- libnetapi_group.o)
+ libnetapi_group.o
+ libnetapi_server.o)
$(eval $(call proto_header_template,$(torturesrcdir)/libnetapi/proto.h,$(TORTURE_LIBNETAPI_OBJ_FILES:.o=.c)))
diff --git a/source4/torture/libnetapi/libnetapi.c b/source4/torture/libnetapi/libnetapi.c
index c3a27eba0c..6854bf8444 100644
--- a/source4/torture/libnetapi/libnetapi.c
+++ b/source4/torture/libnetapi/libnetapi.c
@@ -68,6 +68,7 @@ NTSTATUS torture_libnetapi_init(void)
suite = torture_suite_create(talloc_autofree_context(), "NETAPI");
+ torture_suite_add_simple_test(suite, "SERVER", torture_libnetapi_server);
torture_suite_add_simple_test(suite, "GROUP", torture_libnetapi_group);
torture_suite_add_simple_test(suite, "USER", torture_libnetapi_user);
torture_suite_add_simple_test(suite, "INITIALIZE", torture_libnetapi_initialize);
diff --git a/source4/torture/libnetapi/libnetapi_server.c b/source4/torture/libnetapi/libnetapi_server.c
new file mode 100644
index 0000000000..1888009402
--- /dev/null
+++ b/source4/torture/libnetapi/libnetapi_server.c
@@ -0,0 +1,76 @@
+/*
+ Unix SMB/CIFS implementation.
+ SMB torture tester
+ Copyright (C) Guenther Deschner 2010
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "includes.h"
+#include "torture/smbtorture.h"
+#include <netapi.h>
+#include "torture/libnetapi/proto.h"
+
+#define NETAPI_STATUS(tctx, x,y,fn) \
+ torture_warning(tctx, "FAILURE: line %d: %s failed with status: %s (%d)\n", \
+ __LINE__, fn, libnetapi_get_error_string(x,y), y);
+
+bool torture_libnetapi_server(struct torture_context *tctx)
+{
+ NET_API_STATUS status = 0;
+ uint8_t *buffer = NULL;
+ int i;
+
+ const char *hostname = torture_setting_string(tctx, "host", NULL);
+ struct libnetapi_ctx *ctx;
+
+ torture_assert(tctx, torture_libnetapi_init_context(tctx, &ctx),
+ "failed to initialize libnetapi");
+
+ torture_comment(tctx, "NetServer tests\n");
+
+ torture_comment(tctx, "Testing NetRemoteTOD\n");
+
+ status = NetRemoteTOD(hostname, &buffer);
+ if (status) {
+ NETAPI_STATUS(tctx, ctx, status, "NetRemoteTOD");
+ goto out;
+ }
+ NetApiBufferFree(buffer);
+
+ torture_comment(tctx, "Testing NetRemoteTOD 10 times\n");
+
+ for (i=0; i<10; i++) {
+ status = NetRemoteTOD(hostname, &buffer);
+ if (status) {
+ NETAPI_STATUS(tctx, ctx, status, "NetRemoteTOD");
+ goto out;
+ }
+ NetApiBufferFree(buffer);
+ }
+
+ status = 0;
+
+ torture_comment(tctx, "NetServer tests succeeded\n");
+ out:
+ if (status != 0) {
+ torture_comment(tctx, "NetServer testsuite failed with: %s\n",
+ libnetapi_get_error_string(ctx, status));
+ libnetapi_free(ctx);
+ return false;
+ }
+
+ libnetapi_free(ctx);
+ return true;
+}
diff --git a/source4/torture/libnetapi/wscript_build b/source4/torture/libnetapi/wscript_build
index ddcc602f88..a087c96662 100644
--- a/source4/torture/libnetapi/wscript_build
+++ b/source4/torture/libnetapi/wscript_build
@@ -1,7 +1,7 @@
#!/usr/bin/env python
bld.SAMBA_MODULE('TORTURE_LIBNETAPI',
- source='libnetapi.c libnetapi_user.c libnetapi_group.c',
+ source='libnetapi.c libnetapi_user.c libnetapi_group.c libnetapi_server.c',
autoproto='proto.h',
subsystem='smbtorture',
init_function='torture_libnetapi_init',
diff --git a/source4/torture/nbench/nbio.c b/source4/torture/nbench/nbio.c
index fa8155e2c3..ca186d007b 100644
--- a/source4/torture/nbench/nbio.c
+++ b/source4/torture/nbench/nbio.c
@@ -192,7 +192,7 @@ void nbio_target_rate(double rate)
tdelay = (children[nbio_id].bytes - last_bytes)/(1.0e6*rate) - timeval_elapsed(&last_time);
if (tdelay > 0) {
- msleep(tdelay*1000);
+ smb_msleep(tdelay*1000);
} else {
children[nbio_id].max_latency = MAX(children[nbio_id].max_latency, -tdelay);
}
@@ -210,7 +210,7 @@ void nbio_time_delay(double targett)
{
double elapsed = timeval_elapsed(&children[nbio_id].starttime);
if (targett > elapsed) {
- msleep(1000*(targett - elapsed));
+ smb_msleep(1000*(targett - elapsed));
} else if (elapsed - targett > children[nbio_id].max_latency) {
children[nbio_id].max_latency = MAX(elapsed - targett, children[nbio_id].max_latency);
}
diff --git a/source4/torture/nbt/winsreplication.c b/source4/torture/nbt/winsreplication.c
index a0d4c23ae7..caa2d33ede 100644
--- a/source4/torture/nbt/winsreplication.c
+++ b/source4/torture/nbt/winsreplication.c
@@ -9599,7 +9599,7 @@ static void test_conflict_owned_active_vs_replica_handler_query(struct nbt_name_
while (nbtsock->send_queue) {
event_loop_once(nbtsock->event_ctx);
}
- msleep(1000);
+ smb_msleep(1000);
rec->defend.timeout = 0;
rec->defend.ret = true;
@@ -9656,7 +9656,7 @@ static void test_conflict_owned_active_vs_replica_handler_release(
while (nbtsock->send_queue) {
event_loop_once(nbtsock->event_ctx);
}
- msleep(1000);
+ smb_msleep(1000);
rec->defend.timeout = 0;
rec->defend.ret = true;
diff --git a/source4/torture/ndr/ndr.c b/source4/torture/ndr/ndr.c
index e13cb94bbd..8c2e7f8e45 100644
--- a/source4/torture/ndr/ndr.c
+++ b/source4/torture/ndr/ndr.c
@@ -353,6 +353,7 @@ struct torture_suite *torture_local_ndr(TALLOC_CTX *mem_ctx)
torture_suite_add_suite(suite, ndr_samr_suite(suite));
torture_suite_add_suite(suite, ndr_drsblobs_suite(suite));
torture_suite_add_suite(suite, ndr_nbt_suite(suite));
+ torture_suite_add_suite(suite, ndr_ntlmssp_suite(suite));
torture_suite_add_simple_test(suite, "string terminator",
test_check_string_terminator);
diff --git a/source4/torture/ndr/ntlmssp.c b/source4/torture/ndr/ntlmssp.c
new file mode 100644
index 0000000000..b139fdf232
--- /dev/null
+++ b/source4/torture/ndr/ntlmssp.c
@@ -0,0 +1,119 @@
+/*
+ Unix SMB/CIFS implementation.
+ test suite for ntlmssp ndr operations
+
+ Copyright (C) Guenther Deschner 2010
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "includes.h"
+#include "torture/ndr/ndr.h"
+#include "librpc/gen_ndr/ndr_ntlmssp.h"
+
+static const uint8_t ntlmssp_NEGOTIATE_MESSAGE_data[] = {
+ 0x4e, 0x54, 0x4c, 0x4d, 0x53, 0x53, 0x50, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x97, 0x82, 0x08, 0xe2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x01, 0xb0, 0x1d,
+ 0x00, 0x00, 0x00, 0x0f
+};
+
+static bool ntlmssp_NEGOTIATE_MESSAGE_check(struct torture_context *tctx,
+ struct NEGOTIATE_MESSAGE *r)
+{
+ return true;
+}
+
+static const uint8_t ntlmssp_CHALLENGE_MESSAGE_data[] = {
+ 0x4e, 0x54, 0x4c, 0x4d, 0x53, 0x53, 0x50, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x0a, 0x00, 0x0a, 0x00, 0x38, 0x00, 0x00, 0x00, 0x95, 0x82, 0x89, 0xe2,
+ 0xed, 0xc8, 0x2b, 0x7d, 0x2e, 0xd7, 0xd0, 0xd9, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x78, 0x00, 0x78, 0x00, 0x42, 0x00, 0x00, 0x00,
+ 0x06, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x53, 0x00, 0x41, 0x00,
+ 0x4d, 0x00, 0x42, 0x00, 0x41, 0x00, 0x02, 0x00, 0x0a, 0x00, 0x53, 0x00,
+ 0x41, 0x00, 0x4d, 0x00, 0x42, 0x00, 0x41, 0x00, 0x01, 0x00, 0x10, 0x00,
+ 0x4d, 0x00, 0x54, 0x00, 0x48, 0x00, 0x45, 0x00, 0x4c, 0x00, 0x45, 0x00,
+ 0x4e, 0x00, 0x41, 0x00, 0x04, 0x00, 0x1c, 0x00, 0x62, 0x00, 0x65, 0x00,
+ 0x72, 0x00, 0x2e, 0x00, 0x72, 0x00, 0x65, 0x00, 0x64, 0x00, 0x68, 0x00,
+ 0x61, 0x00, 0x74, 0x00, 0x2e, 0x00, 0x63, 0x00, 0x6f, 0x00, 0x6d, 0x00,
+ 0x03, 0x00, 0x2e, 0x00, 0x6d, 0x00, 0x74, 0x00, 0x68, 0x00, 0x65, 0x00,
+ 0x6c, 0x00, 0x65, 0x00, 0x6e, 0x00, 0x61, 0x00, 0x2e, 0x00, 0x62, 0x00,
+ 0x65, 0x00, 0x72, 0x00, 0x2e, 0x00, 0x72, 0x00, 0x65, 0x00, 0x64, 0x00,
+ 0x68, 0x00, 0x61, 0x00, 0x74, 0x00, 0x2e, 0x00, 0x63, 0x00, 0x6f, 0x00,
+ 0x6d, 0x00, 0x00, 0x00, 0x00, 0x00
+};
+
+static bool ntlmssp_CHALLENGE_MESSAGE_check(struct torture_context *tctx,
+ struct CHALLENGE_MESSAGE *r)
+{
+ return true;
+}
+
+static const uint8_t ntlmssp_AUTHENTICATE_MESSAGE_data[] = {
+ 0x4e, 0x54, 0x4c, 0x4d, 0x53, 0x53, 0x50, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x18, 0x00, 0x18, 0x00, 0x8c, 0x00, 0x00, 0x00, 0x0e, 0x01, 0x0e, 0x01,
+ 0xa4, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x0e, 0x00, 0x58, 0x00, 0x00, 0x00,
+ 0x1a, 0x00, 0x1a, 0x00, 0x66, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x0c, 0x00,
+ 0x80, 0x00, 0x00, 0x00, 0x10, 0x00, 0x10, 0x00, 0xb2, 0x01, 0x00, 0x00,
+ 0x15, 0x82, 0x88, 0xe2, 0x06, 0x01, 0xb0, 0x1d, 0x00, 0x00, 0x00, 0x0f,
+ 0x50, 0xe2, 0xb2, 0xa7, 0xf5, 0x83, 0x3e, 0xda, 0x71, 0xa7, 0xe8, 0x6e,
+ 0x95, 0x1e, 0x3a, 0x57, 0x57, 0x00, 0x32, 0x00, 0x4b, 0x00, 0x38, 0x00,
+ 0x44, 0x00, 0x4f, 0x00, 0x4d, 0x00, 0x41, 0x00, 0x64, 0x00, 0x6d, 0x00,
+ 0x69, 0x00, 0x6e, 0x00, 0x69, 0x00, 0x73, 0x00, 0x74, 0x00, 0x72, 0x00,
+ 0x61, 0x00, 0x74, 0x00, 0x6f, 0x00, 0x72, 0x00, 0x57, 0x00, 0x32, 0x00,
+ 0x4b, 0x00, 0x38, 0x00, 0x52, 0x00, 0x32, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0xcf, 0xfb, 0x39,
+ 0x5a, 0xb3, 0x4c, 0x58, 0x86, 0x35, 0xa3, 0xe7, 0x1e, 0x00, 0x98, 0x43,
+ 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x96, 0x79, 0x02, 0x77,
+ 0x1e, 0x54, 0xcb, 0x01, 0x3c, 0x21, 0x0a, 0xe9, 0xde, 0x61, 0xc0, 0x7e,
+ 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x0a, 0x00, 0x53, 0x00, 0x41, 0x00,
+ 0x4d, 0x00, 0x42, 0x00, 0x41, 0x00, 0x01, 0x00, 0x10, 0x00, 0x4d, 0x00,
+ 0x54, 0x00, 0x48, 0x00, 0x45, 0x00, 0x4c, 0x00, 0x45, 0x00, 0x4e, 0x00,
+ 0x41, 0x00, 0x04, 0x00, 0x1c, 0x00, 0x62, 0x00, 0x65, 0x00, 0x72, 0x00,
+ 0x2e, 0x00, 0x72, 0x00, 0x65, 0x00, 0x64, 0x00, 0x68, 0x00, 0x61, 0x00,
+ 0x74, 0x00, 0x2e, 0x00, 0x63, 0x00, 0x6f, 0x00, 0x6d, 0x00, 0x03, 0x00,
+ 0x2e, 0x00, 0x6d, 0x00, 0x74, 0x00, 0x68, 0x00, 0x65, 0x00, 0x6c, 0x00,
+ 0x65, 0x00, 0x6e, 0x00, 0x61, 0x00, 0x2e, 0x00, 0x62, 0x00, 0x65, 0x00,
+ 0x72, 0x00, 0x2e, 0x00, 0x72, 0x00, 0x65, 0x00, 0x64, 0x00, 0x68, 0x00,
+ 0x61, 0x00, 0x74, 0x00, 0x2e, 0x00, 0x63, 0x00, 0x6f, 0x00, 0x6d, 0x00,
+ 0x08, 0x00, 0x30, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x0a, 0xfd, 0x3b, 0x2c,
+ 0xad, 0x43, 0x46, 0x8b, 0x49, 0x01, 0x6c, 0xa5, 0xf3, 0xbc, 0xd2, 0x13,
+ 0xbb, 0x70, 0xe2, 0x65, 0x96, 0xba, 0x0d, 0x8d, 0x5d, 0x31, 0xe6, 0x47,
+ 0x94, 0x61, 0xed, 0x28, 0x0a, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x09, 0x00, 0x1a, 0x00, 0x63, 0x00, 0x69, 0x00, 0x66, 0x00, 0x73, 0x00,
+ 0x2f, 0x00, 0x6d, 0x00, 0x74, 0x00, 0x68, 0x00, 0x65, 0x00, 0x6c, 0x00,
+ 0x65, 0x00, 0x6e, 0x00, 0x61, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0xa4, 0x23, 0xd4, 0x5c, 0x16, 0x52, 0x8d, 0x56, 0x34, 0x2d,
+ 0x1c, 0xff, 0x86, 0x17, 0xc9, 0x4f
+};
+
+static bool ntlmssp_AUTHENTICATE_MESSAGE_check(struct torture_context *tctx,
+ struct AUTHENTICATE_MESSAGE *r)
+{
+ return true;
+}
+
+struct torture_suite *ndr_ntlmssp_suite(TALLOC_CTX *ctx)
+{
+ struct torture_suite *suite = torture_suite_create(ctx, "ntlmssp");
+
+ torture_suite_add_ndr_pull_fn_test(suite, NEGOTIATE_MESSAGE, ntlmssp_NEGOTIATE_MESSAGE_data, NDR_IN, ntlmssp_NEGOTIATE_MESSAGE_check);
+ /* torture_suite_add_ndr_pull_fn_test(suite, CHALLENGE_MESSAGE, ntlmssp_CHALLENGE_MESSAGE_data, NDR_IN, ntlmssp_CHALLENGE_MESSAGE_check);
+ torture_suite_add_ndr_pull_fn_test(suite, AUTHENTICATE_MESSAGE, ntlmssp_AUTHENTICATE_MESSAGE_data, NDR_IN, ntlmssp_AUTHENTICATE_MESSAGE_check); */
+
+ return suite;
+}
diff --git a/source4/torture/ndr/winreg.c b/source4/torture/ndr/winreg.c
index ca3a71ed7d..b6da7bccd2 100644
--- a/source4/torture/ndr/winreg.c
+++ b/source4/torture/ndr/winreg.c
@@ -247,7 +247,7 @@ static bool querymultiplevalues_in_check(struct torture_context *tctx,
torture_assert_int_equal(tctx, r->in.values_in[0].ve_valuename->length, 18, "name len");
torture_assert_int_equal(tctx, r->in.values_in[0].ve_valuename->size, 18, "name size");
torture_assert_int_equal(tctx, r->in.values_in[0].ve_valuelen, 0, "length");
- torture_assert(tctx, (r->in.values_in[0].ve_valueptr == NULL), "ve_valueptr");
+ torture_assert_int_equal(tctx, r->in.values_in[0].ve_valueptr, 0, "ve_valueptr");
torture_assert_int_equal(tctx, r->in.values_in[0].ve_type, 0, "type");
torture_assert_int_equal(tctx, *r->in.buffer_size, 32, "buffer size");
@@ -303,7 +303,7 @@ static bool querymultiplevalues2_in_check(struct torture_context *tctx,
torture_assert_int_equal(tctx, r->in.values_in[0].ve_valuename->length, 10, "name len");
torture_assert_int_equal(tctx, r->in.values_in[0].ve_valuename->size, 10, "name size");
torture_assert_int_equal(tctx, r->in.values_in[0].ve_valuelen, 0, "length");
- torture_assert(tctx, (r->in.values_in[0].ve_valueptr == NULL), "ve_valueptr");
+ torture_assert_int_equal(tctx, r->in.values_in[0].ve_valueptr, 0, "ve_valueptr");
torture_assert_int_equal(tctx, r->in.values_in[0].ve_type, 0, "type");
torture_assert_int_equal(tctx, *r->in.offered, 0, "buffer size");
diff --git a/source4/torture/raw/notify.c b/source4/torture/raw/notify.c
index 6fc005929c..7ccdbd7c76 100644
--- a/source4/torture/raw/notify.c
+++ b/source4/torture/raw/notify.c
@@ -144,7 +144,7 @@ static bool test_notify_dir(struct smbcli_state *cli, struct smbcli_state *cli2,
smbcli_rmdir(cli2->tree, BASEDIR "\\subdir-name");
smbcli_mkdir(cli2->tree, BASEDIR "\\subdir-name");
smbcli_rmdir(cli2->tree, BASEDIR "\\subdir-name");
- msleep(200);
+ smb_msleep(200);
req = smb_raw_changenotify_send(cli->tree, &notify);
status = smb_raw_changenotify_recv(req, mem_ctx, &notify);
CHECK_STATUS(status, NT_STATUS_OK);
@@ -365,7 +365,7 @@ static bool test_notify_recursive(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
notify.nttrans.in.completion_filter = 0;
notify.nttrans.in.recursive = true;
- msleep(200);
+ smb_msleep(200);
req1 = smb_raw_changenotify_send(cli->tree, &notify);
smbcli_rmdir(cli->tree, BASEDIR "\\subdir-name\\subname1-r");
@@ -602,7 +602,7 @@ static bool test_notify_mask(struct smbcli_state *cli, struct torture_context *t
notify.nttrans.in.completion_filter = (1<<i); \
req = smb_raw_changenotify_send(cli->tree, &notify); \
op \
- msleep(200); smb_raw_ntcancel(req); \
+ smb_msleep(200); smb_raw_ntcancel(req); \
status = smb_raw_changenotify_recv(req, tctx, &notify); \
cleanup \
smbcli_close(cli->tree, fnum); \
@@ -1420,7 +1420,7 @@ static bool test_notify_basedir(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
/* set attribute on a file to assure we receive a notification */
smbcli_setatr(cli->tree, BASEDIR "\\tname1", FILE_ATTRIBUTE_HIDDEN, 0);
- msleep(200);
+ smb_msleep(200);
/* check how many responses were given, expect only 1 for the file */
status = smb_raw_changenotify_recv(req1, mem_ctx, &notify);
diff --git a/source4/torture/rpc/handles.c b/source4/torture/rpc/handles.c
index f47789ae60..13357ac947 100644
--- a/source4/torture/rpc/handles.c
+++ b/source4/torture/rpc/handles.c
@@ -287,7 +287,7 @@ static bool test_handles_lsa_shared(struct torture_context *torture)
/* close first connection */
torture_comment(torture, "disconnect p1\n");
talloc_free(p1);
- msleep(5);
+ smb_msleep(5);
/*
* and it's still available on p2,p3
@@ -327,7 +327,7 @@ static bool test_handles_lsa_shared(struct torture_context *torture)
talloc_free(p2);
talloc_free(p3);
talloc_free(p4);
- msleep(10);
+ smb_msleep(10);
/*
* now open p5
@@ -455,7 +455,7 @@ static bool test_handles_mixed_shared(struct torture_context *torture)
talloc_free(p1);
talloc_free(p2);
- msleep(10);
+ smb_msleep(10);
torture_comment(torture, "connect samr pipe3 - should fail\n");
status = torture_rpc_connection_transport(torture, &p3, &ndr_table_samr,
diff --git a/source4/torture/rpc/lsa.c b/source4/torture/rpc/lsa.c
index 9283fc3e31..a1ad9fde1d 100644
--- a/source4/torture/rpc/lsa.c
+++ b/source4/torture/rpc/lsa.c
@@ -1435,7 +1435,7 @@ static bool test_CreateSecret(struct dcerpc_pipe *p,
r5.in.new_val->size = enc_key.length;
- msleep(200);
+ smb_msleep(200);
torture_comment(tctx, "Testing SetSecret (existing value should move to old)\n");
torture_assert_ntstatus_ok(tctx, dcerpc_lsa_SetSecret_r(b, tctx, &r5),
diff --git a/source4/torture/rpc/netlogon.c b/source4/torture/rpc/netlogon.c
index b83b050fb2..c2eb872462 100644
--- a/source4/torture/rpc/netlogon.c
+++ b/source4/torture/rpc/netlogon.c
@@ -2911,7 +2911,7 @@ static bool test_GetDomainInfo(struct torture_context *tctx,
torture_assert_ntstatus_ok(tctx, r.out.result, "LogonGetDomainInfo failed");
torture_assert(tctx, netlogon_creds_client_check(creds, &a.cred), "Credential chaining failed");
- msleep(250);
+ smb_msleep(250);
if (sam_ctx) {
/* AD workstation infos entry check */
@@ -3000,7 +3000,7 @@ static bool test_GetDomainInfo(struct torture_context *tctx,
torture_assert(tctx, netlogon_creds_client_check(creds, &a.cred), "Credential chaining failed");
- msleep(250);
+ smb_msleep(250);
if (sam_ctx) {
/* AD workstation infos entry check */
@@ -3076,7 +3076,7 @@ static bool test_GetDomainInfo(struct torture_context *tctx,
torture_assert_ntstatus_ok(tctx, r.out.result, "LogonGetDomainInfo failed");
torture_assert(tctx, netlogon_creds_client_check(creds, &a.cred), "Credential chaining failed");
- msleep(250);
+ smb_msleep(250);
if (sam_ctx) {
/* AD workstation infos entry check */
@@ -3147,7 +3147,7 @@ static bool test_GetDomainInfo(struct torture_context *tctx,
torture_assert_ntstatus_ok(tctx, r.out.result, "LogonGetDomainInfo failed");
torture_assert(tctx, netlogon_creds_client_check(creds, &a.cred), "Credential chaining failed");
- msleep(250);
+ smb_msleep(250);
/* Now the in/out DNS hostnames should be the same */
torture_assert_str_equal(tctx,
@@ -3181,7 +3181,7 @@ static bool test_GetDomainInfo(struct torture_context *tctx,
torture_assert_ntstatus_ok(tctx, r.out.result, "LogonGetDomainInfo failed");
torture_assert(tctx, netlogon_creds_client_check(creds, &a.cred), "Credential chaining failed");
- msleep(250);
+ smb_msleep(250);
/* Checks "workstation flags" */
torture_assert(tctx,
diff --git a/source4/torture/rpc/svcctl.c b/source4/torture/rpc/svcctl.c
index 8f9ec1aed8..5ad678fe0e 100644
--- a/source4/torture/rpc/svcctl.c
+++ b/source4/torture/rpc/svcctl.c
@@ -1,6 +1,6 @@
/*
Unix SMB/CIFS implementation.
- test suite for srvsvc rpc operations
+ test suite for svcctl rpc operations
Copyright (C) Jelmer Vernooij 2004
Copyright (C) Guenther Deschner 2008,2009
@@ -324,6 +324,65 @@ static bool test_QueryServiceObjectSecurity(struct torture_context *tctx,
return true;
}
+static bool test_SetServiceObjectSecurity(struct torture_context *tctx,
+ struct dcerpc_pipe *p)
+{
+ struct svcctl_QueryServiceObjectSecurity q;
+ struct svcctl_SetServiceObjectSecurity r;
+ struct policy_handle h, s;
+ struct dcerpc_binding_handle *b = p->binding_handle;
+
+ uint8_t *buffer;
+ uint32_t needed;
+
+ if (!test_OpenSCManager(b, tctx, &h))
+ return false;
+
+ if (!test_OpenService(b, tctx, &h, TORTURE_DEFAULT_SERVICE, &s))
+ return false;
+
+ q.in.handle = &s;
+ q.in.security_flags = SECINFO_DACL;
+ q.in.offered = 0;
+ q.out.buffer = NULL;
+ q.out.needed = &needed;
+
+ torture_assert_ntstatus_ok(tctx,
+ dcerpc_svcctl_QueryServiceObjectSecurity_r(b, tctx, &q),
+ "QueryServiceObjectSecurity failed!");
+
+ if (W_ERROR_EQUAL(q.out.result, WERR_INSUFFICIENT_BUFFER)) {
+ q.in.offered = needed;
+ buffer = talloc_array(tctx, uint8_t, needed);
+ q.out.buffer = buffer;
+ torture_assert_ntstatus_ok(tctx,
+ dcerpc_svcctl_QueryServiceObjectSecurity_r(b, tctx, &q),
+ "QueryServiceObjectSecurity failed!");
+ }
+
+ torture_assert_werr_ok(tctx, q.out.result,
+ "QueryServiceObjectSecurity failed!");
+
+ r.in.handle = &s;
+ r.in.security_flags = SECINFO_DACL;
+ r.in.buffer = q.out.buffer;
+ r.in.offered = *q.out.needed;
+
+ torture_assert_ntstatus_ok(tctx,
+ dcerpc_svcctl_SetServiceObjectSecurity_r(b, tctx, &r),
+ "SetServiceObjectSecurity failed!");
+ torture_assert_werr_ok(tctx, r.out.result,
+ "SetServiceObjectSecurity failed!");
+
+ if (!test_CloseServiceHandle(b, tctx, &s))
+ return false;
+
+ if (!test_CloseServiceHandle(b, tctx, &h))
+ return false;
+
+ return true;
+}
+
static bool test_StartServiceW(struct torture_context *tctx,
struct dcerpc_pipe *p)
{
@@ -570,6 +629,8 @@ struct torture_suite *torture_rpc_svcctl(TALLOC_CTX *mem_ctx)
test_QueryServiceConfig2W);
torture_rpc_tcase_add_test(tcase, "QueryServiceObjectSecurity",
test_QueryServiceObjectSecurity);
+ torture_rpc_tcase_add_test(tcase, "SetServiceObjectSecurity",
+ test_SetServiceObjectSecurity);
torture_rpc_tcase_add_test(tcase, "StartServiceW",
test_StartServiceW);
torture_rpc_tcase_add_test(tcase, "ControlService",
diff --git a/source4/torture/smb2/lease.c b/source4/torture/smb2/lease.c
index 63285d40e0..eda3b97eea 100644
--- a/source4/torture/smb2/lease.c
+++ b/source4/torture/smb2/lease.c
@@ -803,7 +803,7 @@ static bool test_lease_multibreak(struct torture_context *tctx,
break_info.held_oplock_level = io.out.oplock_level;
/* Sleep, use a write to clear the recv queue. */
- msleep(250);
+ smb_msleep(250);
ZERO_STRUCT(w);
w.in.file.handle = h3;
w.in.offset = 0;
diff --git a/source4/torture/smb2/notify.c b/source4/torture/smb2/notify.c
index 313ef6848f..0115cd0478 100644
--- a/source4/torture/smb2/notify.c
+++ b/source4/torture/smb2/notify.c
@@ -308,7 +308,7 @@ static bool torture_smb2_notify_dir(struct torture_context *torture,
smb2_util_rmdir(tree2, fname);
smb2_util_mkdir(tree2, fname);
smb2_util_rmdir(tree2, fname);
- msleep(200);
+ smb_msleep(200);
req = smb2_notify_send(tree1, &(notify.smb2));
status = smb2_notify_recv(req, torture, &(notify.smb2));
CHECK_STATUS(status, NT_STATUS_OK);
@@ -603,7 +603,7 @@ static bool torture_smb2_notify_recursive(struct torture_context *torture,
notify.smb2.in.completion_filter = 0;
notify.smb2.in.recursive = true;
- msleep(200);
+ smb_msleep(200);
req1 = smb2_notify_send(tree1, &(notify.smb2));
status = smb2_util_rmdir(tree2, BASEDIR "\\subdir-name\\subname1-r");
@@ -898,7 +898,7 @@ static bool torture_smb2_notify_mask(struct torture_context *torture,
/* send the change notify request */ \
req = smb2_notify_send(tree1, &(notify.smb2)); \
op \
- msleep(200); smb2_cancel(req); \
+ smb_msleep(200); smb2_cancel(req); \
status = smb2_notify_recv(req, torture, &(notify.smb2)); \
cleanup \
smb2_util_close(tree1, h1); \
@@ -1775,7 +1775,7 @@ static bool torture_smb2_notify_basedir(struct torture_context *torture,
/* set attribute on a file to assure we receive a notification */
smb2_util_setatr(tree2, BASEDIR "\\tname1", FILE_ATTRIBUTE_HIDDEN);
- msleep(200);
+ smb_msleep(200);
/* check how many responses were given, expect only 1 for the file */
status = smb2_notify_recv(req1, torture, &(notify.smb2));
diff --git a/source4/torture/util_smb.c b/source4/torture/util_smb.c
index 8d5accd2dc..df2716f316 100644
--- a/source4/torture/util_smb.c
+++ b/source4/torture/util_smb.c
@@ -699,7 +699,7 @@ double torture_create_procs(struct torture_context *tctx,
printf("pid %d failed to start\n", (int)getpid());
_exit(1);
}
- msleep(100);
+ smb_msleep(100);
}
child_status[i] = getpid();
@@ -723,7 +723,7 @@ double torture_create_procs(struct torture_context *tctx,
if (child_status[i]) synccount++;
}
if (synccount == torture_nprocs) break;
- msleep(100);
+ smb_msleep(100);
} while (timeval_elapsed(&tv) < start_time_limit);
if (synccount != torture_nprocs) {
diff --git a/source4/torture/wscript_build b/source4/torture/wscript_build
index 715bec502f..b576a5c95e 100644
--- a/source4/torture/wscript_build
+++ b/source4/torture/wscript_build
@@ -33,7 +33,7 @@ bld.RECURSE('libnetapi')
bld.RECURSE('libsmbclient')
bld.SAMBA_SUBSYSTEM('TORTURE_NDR',
- source='ndr/ndr.c ndr/winreg.c ndr/atsvc.c ndr/lsa.c ndr/epmap.c ndr/dfs.c ndr/netlogon.c ndr/drsuapi.c ndr/spoolss.c ndr/samr.c ndr/dfsblob.c ndr/drsblobs.c ndr/nbt.c',
+ source='ndr/ndr.c ndr/winreg.c ndr/atsvc.c ndr/lsa.c ndr/epmap.c ndr/dfs.c ndr/netlogon.c ndr/drsuapi.c ndr/spoolss.c ndr/samr.c ndr/dfsblob.c ndr/drsblobs.c ndr/nbt.c ndr/ntlmssp.c',
autoproto='ndr/proto.h',
deps='torture SERVICE_SMB'
)