From 8b59dae7482395c7d6d273d1636df882d3045b07 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 7 Sep 2018 15:14:37 -0700 Subject: [PATCH] s4: torture: Ensure raw notify tests use different directories. Should help track down flapping tests. Signed-off-by: Jeremy Allison --- source4/torture/raw/notify.c | 443 ++++++++++++++++++++++------------- 1 file changed, 281 insertions(+), 162 deletions(-) diff --git a/source4/torture/raw/notify.c b/source4/torture/raw/notify.c index afb4a8eb5f2..9a993f5bd88 100644 --- a/source4/torture/raw/notify.c +++ b/source4/torture/raw/notify.c @@ -35,6 +35,8 @@ do { \ "wire_bad_flags"); \ } while (0) +#define BASEDIR_CN1_DIR BASEDIR "_CN1_DIR" + /* basic testing of change notify on directories */ @@ -53,8 +55,8 @@ static bool test_notify_dir(struct torture_context *tctx, torture_comment(tctx, "TESTING CHANGE NOTIFY ON DIRECTORIES\n"); - torture_assert(tctx, torture_setup_dir(cli, BASEDIR), - "Failed to setup up test directory: " BASEDIR); + torture_assert(tctx, torture_setup_dir(cli, BASEDIR_CN1_DIR), + "Failed to setup up test directory: " BASEDIR_CN1_DIR); /* get a handle on the directory @@ -70,7 +72,7 @@ static bool test_notify_dir(struct torture_context *tctx, io.ntcreatex.in.open_disposition = NTCREATEX_DISP_OPEN; io.ntcreatex.in.impersonation = NTCREATEX_IMPERSONATION_ANONYMOUS; io.ntcreatex.in.security_flags = 0; - io.ntcreatex.in.fname = BASEDIR; + io.ntcreatex.in.fname = BASEDIR_CN1_DIR; status = smb_raw_open(cli->tree, tctx, &io); torture_assert_ntstatus_ok_goto(tctx, status, ret, done, @@ -102,7 +104,7 @@ static bool test_notify_dir(struct torture_context *tctx, torture_comment(tctx, "Testing notify mkdir\n"); req = smb_raw_changenotify_send(cli->tree, ¬ify); - smbcli_mkdir(cli2->tree, BASEDIR "\\subdir-name"); + smbcli_mkdir(cli2->tree, BASEDIR_CN1_DIR "\\subdir-name"); status = smb_raw_changenotify_recv(req, tctx, ¬ify); torture_assert_ntstatus_ok_goto(tctx, status, ret, done, @@ -120,7 +122,7 @@ static bool test_notify_dir(struct torture_context *tctx, torture_comment(tctx, "Testing notify rmdir\n"); req = smb_raw_changenotify_send(cli->tree, ¬ify); - smbcli_rmdir(cli2->tree, BASEDIR "\\subdir-name"); + smbcli_rmdir(cli2->tree, BASEDIR_CN1_DIR "\\subdir-name"); status = smb_raw_changenotify_recv(req, tctx, ¬ify); torture_assert_ntstatus_ok_goto(tctx, status, ret, done, @@ -136,10 +138,10 @@ static bool test_notify_dir(struct torture_context *tctx, torture_comment(tctx, "Testing notify mkdir - rmdir - mkdir - rmdir\n"); - smbcli_mkdir(cli2->tree, BASEDIR "\\subdir-name"); - smbcli_rmdir(cli2->tree, BASEDIR "\\subdir-name"); - smbcli_mkdir(cli2->tree, BASEDIR "\\subdir-name"); - smbcli_rmdir(cli2->tree, BASEDIR "\\subdir-name"); + smbcli_mkdir(cli2->tree, BASEDIR_CN1_DIR "\\subdir-name"); + smbcli_rmdir(cli2->tree, BASEDIR_CN1_DIR "\\subdir-name"); + smbcli_mkdir(cli2->tree, BASEDIR_CN1_DIR "\\subdir-name"); + smbcli_rmdir(cli2->tree, BASEDIR_CN1_DIR "\\subdir-name"); smb_msleep(200); req = smb_raw_changenotify_send(cli->tree, ¬ify); status = smb_raw_changenotify_recv(req, tctx, ¬ify); @@ -175,7 +177,9 @@ static bool test_notify_dir(struct torture_context *tctx, count = torture_numops; torture_comment(tctx, "Testing buffered notify on create of %d files\n", count); for (i=0;itree, fname, O_CREAT|O_RDWR, DENY_NONE); torture_assert_int_not_equal_goto(tctx, fnum3, -1, ret, done, talloc_asprintf(tctx, "Failed to create %s - %s", @@ -194,7 +198,7 @@ static bool test_notify_dir(struct torture_context *tctx, notify.nttrans.in.file.fnum = fnum; req = smb_raw_changenotify_send(cli->tree, ¬ify); - status = smbcli_unlink(cli->tree, BASEDIR "\\nonexistent.txt"); + status = smbcli_unlink(cli->tree, BASEDIR_CN1_DIR "\\nonexistent.txt"); torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OBJECT_NAME_NOT_FOUND, ret, done, @@ -204,7 +208,7 @@ static bool test_notify_dir(struct torture_context *tctx, this unlink is only seen by the 1st notify and the 3rd notify (later) */ torture_comment(tctx, "Testing notify on unlink for the first file\n"); - status = smbcli_unlink(cli2->tree, BASEDIR "\\test0.txt"); + status = smbcli_unlink(cli2->tree, BASEDIR_CN1_DIR "\\test0.txt"); torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "smbcli_unlink"); @@ -241,7 +245,7 @@ static bool test_notify_dir(struct torture_context *tctx, torture_comment(tctx, "(3rd notify) this notify will only see the 1st unlink\n"); req = smb_raw_changenotify_send(cli->tree, ¬ify); - status = smbcli_unlink(cli->tree, BASEDIR "\\nonexistent.txt"); + status = smbcli_unlink(cli->tree, BASEDIR_CN1_DIR "\\nonexistent.txt"); torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OBJECT_NAME_NOT_FOUND, ret, done, @@ -249,7 +253,7 @@ static bool test_notify_dir(struct torture_context *tctx, torture_comment(tctx, "Testing notify on wildcard unlink for %d files\n", count-1); /* (2nd unlink) do a wildcard unlink */ - status = smbcli_unlink(cli2->tree, BASEDIR "\\test*.txt"); + status = smbcli_unlink(cli2->tree, BASEDIR_CN1_DIR "\\test*.txt"); torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "smb_raw_changenotify_recv"); @@ -317,7 +321,7 @@ static bool test_notify_dir(struct torture_context *tctx, done: smb_raw_exit(cli->session); - smbcli_deltree(cli->tree, BASEDIR); + smbcli_deltree(cli->tree, BASEDIR_CN1_DIR); return ret; } @@ -352,6 +356,9 @@ static bool check_rename_reply(struct torture_context *tctx, /* testing of recursive change notify */ + +#define BASEDIR_CN1_RECUR BASEDIR "_CN1_RECUR" + static bool test_notify_recursive(struct torture_context *tctx, struct smbcli_state *cli, struct smbcli_state *cli2) @@ -365,8 +372,8 @@ static bool test_notify_recursive(struct torture_context *tctx, torture_comment(tctx, "TESTING CHANGE NOTIFY WITH RECURSION\n"); - torture_assert(tctx, torture_setup_dir(cli, BASEDIR), - "Failed to setup up test directory: " BASEDIR); + torture_assert(tctx, torture_setup_dir(cli, BASEDIR_CN1_RECUR), + "Failed to setup up test directory: " BASEDIR_CN1_RECUR); /* get a handle on the directory @@ -382,7 +389,7 @@ static bool test_notify_recursive(struct torture_context *tctx, io.ntcreatex.in.open_disposition = NTCREATEX_DISP_OPEN; io.ntcreatex.in.impersonation = NTCREATEX_IMPERSONATION_ANONYMOUS; io.ntcreatex.in.security_flags = 0; - io.ntcreatex.in.fname = BASEDIR; + io.ntcreatex.in.fname = BASEDIR_CN1_RECUR; status = smb_raw_open(cli->tree, tctx, &io); torture_assert_ntstatus_ok_goto(tctx, status, ret, done, @@ -421,24 +428,28 @@ static bool test_notify_recursive(struct torture_context *tctx, * Make notifies a bit more interesting in a cluster by doing * the changes against different nodes with --unclist */ - smbcli_mkdir(cli->tree, BASEDIR "\\subdir-name"); - smbcli_mkdir(cli2->tree, BASEDIR "\\subdir-name\\subname1"); + smbcli_mkdir(cli->tree, BASEDIR_CN1_RECUR "\\subdir-name"); + smbcli_mkdir(cli2->tree, BASEDIR_CN1_RECUR "\\subdir-name\\subname1"); smbcli_close(cli->tree, - smbcli_open(cli->tree, BASEDIR "\\subdir-name\\subname2", O_CREAT, 0)); - smbcli_rename(cli2->tree, BASEDIR "\\subdir-name\\subname1", - BASEDIR "\\subdir-name\\subname1-r"); - smbcli_rename(cli->tree, BASEDIR "\\subdir-name\\subname2", BASEDIR "\\subname2-r"); - smbcli_rename(cli2->tree, BASEDIR "\\subname2-r", - BASEDIR "\\subname3-r"); + smbcli_open(cli->tree, + BASEDIR_CN1_RECUR "\\subdir-name\\subname2", + O_CREAT, 0)); + smbcli_rename(cli2->tree, BASEDIR_CN1_RECUR "\\subdir-name\\subname1", + BASEDIR_CN1_RECUR "\\subdir-name\\subname1-r"); + smbcli_rename(cli->tree, + BASEDIR_CN1_RECUR "\\subdir-name\\subname2", + BASEDIR_CN1_RECUR "\\subname2-r"); + smbcli_rename(cli2->tree, BASEDIR_CN1_RECUR "\\subname2-r", + BASEDIR_CN1_RECUR "\\subname3-r"); notify.nttrans.in.completion_filter = 0; notify.nttrans.in.recursive = true; smb_msleep(200); req1 = smb_raw_changenotify_send(cli->tree, ¬ify); - smbcli_rmdir(cli->tree, BASEDIR "\\subdir-name\\subname1-r"); - smbcli_rmdir(cli2->tree, BASEDIR "\\subdir-name"); - smbcli_unlink(cli->tree, BASEDIR "\\subname3-r"); + smbcli_rmdir(cli->tree, BASEDIR_CN1_RECUR "\\subdir-name\\subname1-r"); + smbcli_rmdir(cli2->tree, BASEDIR_CN1_RECUR "\\subdir-name"); + smbcli_unlink(cli->tree, BASEDIR_CN1_RECUR "\\subname3-r"); smb_msleep(200); notify.nttrans.in.recursive = false; @@ -532,13 +543,16 @@ static bool test_notify_recursive(struct torture_context *tctx, done: smb_raw_exit(cli->session); - smbcli_deltree(cli->tree, BASEDIR); + smbcli_deltree(cli->tree, BASEDIR_CN1_RECUR); return ret; } /* testing of change notify mask change */ + +#define BASEDIR_CN1_CNMC BASEDIR "_CN1_CNMC" + static bool test_notify_mask_change(struct torture_context *tctx, struct smbcli_state *cli) { @@ -551,8 +565,8 @@ static bool test_notify_mask_change(struct torture_context *tctx, torture_comment(tctx, "TESTING CHANGE NOTIFY WITH MASK CHANGE\n"); - torture_assert(tctx, torture_setup_dir(cli, BASEDIR), - "Failed to setup up test directory: " BASEDIR); + torture_assert(tctx, torture_setup_dir(cli, BASEDIR_CN1_CNMC), + "Failed to setup up test directory: " BASEDIR_CN1_CNMC); /* get a handle on the directory @@ -568,7 +582,7 @@ static bool test_notify_mask_change(struct torture_context *tctx, io.ntcreatex.in.open_disposition = NTCREATEX_DISP_OPEN; io.ntcreatex.in.impersonation = NTCREATEX_IMPERSONATION_ANONYMOUS; io.ntcreatex.in.security_flags = 0; - io.ntcreatex.in.fname = BASEDIR; + io.ntcreatex.in.fname = BASEDIR_CN1_CNMC; status = smb_raw_open(cli->tree, tctx, &io); torture_assert_ntstatus_ok_goto(tctx, status, ret, done, @@ -607,9 +621,11 @@ static bool test_notify_mask_change(struct torture_context *tctx, req1 = smb_raw_changenotify_send(cli->tree, ¬ify); /* Set to hidden then back again. */ - smbcli_close(cli->tree, smbcli_open(cli->tree, BASEDIR "\\tname1", O_CREAT, 0)); - smbcli_setatr(cli->tree, BASEDIR "\\tname1", FILE_ATTRIBUTE_HIDDEN, 0); - smbcli_unlink(cli->tree, BASEDIR "\\tname1"); + smbcli_close(cli->tree, + smbcli_open(cli->tree,BASEDIR_CN1_CNMC "\\tname1", O_CREAT, 0)); + smbcli_setatr(cli->tree, BASEDIR_CN1_CNMC "\\tname1", + FILE_ATTRIBUTE_HIDDEN, 0); + smbcli_unlink(cli->tree, BASEDIR_CN1_CNMC "\\tname1"); status = smb_raw_changenotify_recv(req1, tctx, ¬ify); torture_assert_ntstatus_ok_goto(tctx, status, ret, done, @@ -635,17 +651,25 @@ static bool test_notify_mask_change(struct torture_context *tctx, notify.nttrans.in.recursive = false; req2 = smb_raw_changenotify_send(cli->tree, ¬ify); - smbcli_mkdir(cli->tree, BASEDIR "\\subdir-name"); - smbcli_mkdir(cli->tree, BASEDIR "\\subdir-name\\subname1"); + smbcli_mkdir(cli->tree, BASEDIR_CN1_CNMC "\\subdir-name"); + smbcli_mkdir(cli->tree, BASEDIR_CN1_CNMC "\\subdir-name\\subname1"); smbcli_close(cli->tree, - smbcli_open(cli->tree, BASEDIR "\\subdir-name\\subname2", O_CREAT, 0)); - smbcli_rename(cli->tree, BASEDIR "\\subdir-name\\subname1", BASEDIR "\\subdir-name\\subname1-r"); - smbcli_rename(cli->tree, BASEDIR "\\subdir-name\\subname2", BASEDIR "\\subname2-r"); - smbcli_rename(cli->tree, BASEDIR "\\subname2-r", BASEDIR "\\subname3-r"); - - smbcli_rmdir(cli->tree, BASEDIR "\\subdir-name\\subname1-r"); - smbcli_rmdir(cli->tree, BASEDIR "\\subdir-name"); - smbcli_unlink(cli->tree, BASEDIR "\\subname3-r"); + smbcli_open(cli->tree, + BASEDIR_CN1_CNMC "\\subdir-name\\subname2", + O_CREAT, 0)); + smbcli_rename(cli->tree, + BASEDIR_CN1_CNMC "\\subdir-name\\subname1", + BASEDIR_CN1_CNMC "\\subdir-name\\subname1-r"); + smbcli_rename(cli->tree, + BASEDIR_CN1_CNMC "\\subdir-name\\subname2", + BASEDIR_CN1_CNMC "\\subname2-r"); + smbcli_rename(cli->tree, + BASEDIR_CN1_CNMC "\\subname2-r", + BASEDIR_CN1_CNMC "\\subname3-r"); + + smbcli_rmdir(cli->tree, BASEDIR_CN1_CNMC "\\subdir-name\\subname1-r"); + smbcli_rmdir(cli->tree, BASEDIR_CN1_CNMC "\\subdir-name"); + smbcli_unlink(cli->tree, BASEDIR_CN1_CNMC "\\subname3-r"); status = smb_raw_changenotify_recv(req1, tctx, ¬ify); torture_assert_ntstatus_ok_goto(tctx, status, ret, done, @@ -675,7 +699,7 @@ static bool test_notify_mask_change(struct torture_context *tctx, done: smb_raw_exit(cli->session); - smbcli_deltree(cli->tree, BASEDIR); + smbcli_deltree(cli->tree, BASEDIR_CN1_CNMC); return ret; } @@ -683,6 +707,9 @@ done: /* testing of mask bits for change notify */ + +#define BASEDIR_CN1_NOTM BASEDIR "_CN1_NOTM" + static bool test_notify_mask(struct torture_context *tctx, struct smbcli_state *cli, struct smbcli_state *cli2) @@ -701,8 +728,8 @@ static bool test_notify_mask(struct torture_context *tctx, torture_comment(tctx, "TESTING CHANGE NOTIFY COMPLETION FILTERS\n"); - torture_assert(tctx, torture_setup_dir(cli, BASEDIR), - "Failed to setup up test directory: " BASEDIR); + torture_assert(tctx, torture_setup_dir(cli, BASEDIR_CN1_NOTM), + "Failed to setup up test directory: " BASEDIR_CN1_NOTM); tv = timeval_current_ofs(1000, 0); t = timeval_to_nttime(&tv); @@ -721,7 +748,7 @@ static bool test_notify_mask(struct torture_context *tctx, io.ntcreatex.in.open_disposition = NTCREATEX_DISP_OPEN; io.ntcreatex.in.impersonation = NTCREATEX_IMPERSONATION_ANONYMOUS; io.ntcreatex.in.security_flags = 0; - io.ntcreatex.in.fname = BASEDIR; + io.ntcreatex.in.fname = BASEDIR_CN1_NOTM; notify.nttrans.level = RAW_NOTIFY_NTTRANS; notify.nttrans.in.buffer_size = 1000; @@ -801,71 +828,94 @@ static bool test_notify_mask(struct torture_context *tctx, torture_comment(tctx, "Testing mkdir\n"); NOTIFY_MASK_TEST("Testing mkdir",;, - smbcli_mkdir(cli->tree, BASEDIR "\\tname1");, - smbcli_rmdir(cli2->tree, BASEDIR "\\tname1");, + smbcli_mkdir(cli->tree, BASEDIR_CN1_NOTM "\\tname1");, + smbcli_rmdir(cli2->tree, BASEDIR_CN1_NOTM "\\tname1");, NOTIFY_ACTION_ADDED, FILE_NOTIFY_CHANGE_DIR_NAME, 1); torture_comment(tctx, "Testing create file\n"); NOTIFY_MASK_TEST("Testing create file",;, - smbcli_close(cli->tree, smbcli_open(cli->tree, BASEDIR "\\tname1", O_CREAT, 0));, - smbcli_unlink(cli2->tree, BASEDIR "\\tname1");, + smbcli_close(cli->tree, + smbcli_open(cli->tree, + BASEDIR_CN1_NOTM "\\tname1", + O_CREAT, 0));, + smbcli_unlink(cli2->tree, + BASEDIR_CN1_NOTM "\\tname1");, NOTIFY_ACTION_ADDED, FILE_NOTIFY_CHANGE_FILE_NAME, 1); torture_comment(tctx, "Testing unlink\n"); NOTIFY_MASK_TEST("Testing unlink", - smbcli_close(cli->tree, smbcli_open(cli->tree, BASEDIR "\\tname1", O_CREAT, 0));, - smbcli_unlink(cli2->tree, BASEDIR "\\tname1");, + smbcli_close(cli->tree, + smbcli_open(cli->tree, + BASEDIR_CN1_NOTM "\\tname1", + O_CREAT, 0));, + smbcli_unlink(cli2->tree, + BASEDIR_CN1_NOTM "\\tname1");, ;, NOTIFY_ACTION_REMOVED, FILE_NOTIFY_CHANGE_FILE_NAME, 1); torture_comment(tctx, "Testing rmdir\n"); NOTIFY_MASK_TEST("Testing rmdir", - smbcli_mkdir(cli->tree, BASEDIR "\\tname1");, - smbcli_rmdir(cli2->tree, BASEDIR "\\tname1");, + smbcli_mkdir(cli->tree, BASEDIR_CN1_NOTM "\\tname1");, + smbcli_rmdir(cli2->tree, BASEDIR_CN1_NOTM "\\tname1");, ;, NOTIFY_ACTION_REMOVED, FILE_NOTIFY_CHANGE_DIR_NAME, 1); torture_comment(tctx, "Testing rename file\n"); NOTIFY_MASK_TEST("Testing rename file", - smbcli_close(cli->tree, smbcli_open(cli->tree, BASEDIR "\\tname1", O_CREAT, 0));, - smbcli_rename(cli2->tree, BASEDIR "\\tname1", BASEDIR "\\tname2");, - smbcli_unlink(cli->tree, BASEDIR "\\tname2");, + smbcli_close(cli->tree, + smbcli_open(cli->tree, + BASEDIR_CN1_NOTM "\\tname1", + O_CREAT, 0));, + smbcli_rename(cli2->tree, + BASEDIR_CN1_NOTM "\\tname1", + BASEDIR_CN1_NOTM "\\tname2");, + smbcli_unlink(cli->tree, BASEDIR_CN1_NOTM "\\tname2");, NOTIFY_ACTION_OLD_NAME, FILE_NOTIFY_CHANGE_FILE_NAME|FILE_NOTIFY_CHANGE_ATTRIBUTES|FILE_NOTIFY_CHANGE_CREATION, 2); torture_comment(tctx, "Testing rename dir\n"); NOTIFY_MASK_TEST("Testing rename dir", - smbcli_mkdir(cli->tree, BASEDIR "\\tname1");, - smbcli_rename(cli2->tree, BASEDIR "\\tname1", BASEDIR "\\tname2");, - smbcli_rmdir(cli->tree, BASEDIR "\\tname2");, + smbcli_mkdir(cli->tree, BASEDIR_CN1_NOTM "\\tname1");, + smbcli_rename(cli2->tree, + BASEDIR_CN1_NOTM "\\tname1", + BASEDIR_CN1_NOTM "\\tname2");, + smbcli_rmdir(cli->tree, BASEDIR_CN1_NOTM "\\tname2");, NOTIFY_ACTION_OLD_NAME, FILE_NOTIFY_CHANGE_DIR_NAME, 2); torture_comment(tctx, "Testing set path attribute\n"); NOTIFY_MASK_TEST("Testing set path attribute", - smbcli_close(cli->tree, smbcli_open(cli->tree, BASEDIR "\\tname1", O_CREAT, 0));, - smbcli_setatr(cli2->tree, BASEDIR "\\tname1", FILE_ATTRIBUTE_HIDDEN, 0);, - smbcli_unlink(cli->tree, BASEDIR "\\tname1");, + smbcli_close(cli->tree, + smbcli_open(cli->tree, + BASEDIR_CN1_NOTM "\\tname1", O_CREAT, 0));, + smbcli_setatr(cli2->tree, + BASEDIR_CN1_NOTM "\\tname1", FILE_ATTRIBUTE_HIDDEN, 0);, + smbcli_unlink(cli->tree, BASEDIR_CN1_NOTM "\\tname1");, NOTIFY_ACTION_MODIFIED, FILE_NOTIFY_CHANGE_ATTRIBUTES, 1); torture_comment(tctx, "Testing set path write time\n"); NOTIFY_MASK_TEST("Testing set path write time", - smbcli_close(cli->tree, smbcli_open(cli->tree, BASEDIR "\\tname1", O_CREAT, 0));, - smbcli_setatr(cli2->tree, BASEDIR "\\tname1", FILE_ATTRIBUTE_NORMAL, 1000);, - smbcli_unlink(cli->tree, BASEDIR "\\tname1");, + smbcli_close(cli->tree, smbcli_open(cli->tree, + BASEDIR_CN1_NOTM "\\tname1", O_CREAT, 0));, + smbcli_setatr(cli2->tree, + BASEDIR_CN1_NOTM "\\tname1", + FILE_ATTRIBUTE_NORMAL, 1000);, + smbcli_unlink(cli->tree, BASEDIR_CN1_NOTM "\\tname1");, NOTIFY_ACTION_MODIFIED, FILE_NOTIFY_CHANGE_LAST_WRITE, 1); torture_comment(tctx, "Testing set file attribute\n"); NOTIFY_MASK_TEST("Testing set file attribute", - fnum2 = create_complex_file(cli2, tctx, BASEDIR "\\tname1");, + fnum2 = create_complex_file(cli2, tctx, + BASEDIR_CN1_NOTM "\\tname1");, smbcli_fsetatr(cli2->tree, fnum2, FILE_ATTRIBUTE_HIDDEN, 0, 0, 0, 0);, - (smbcli_close(cli2->tree, fnum2), smbcli_unlink(cli2->tree, BASEDIR "\\tname1"));, + (smbcli_close(cli2->tree, fnum2), + smbcli_unlink(cli2->tree, BASEDIR_CN1_NOTM "\\tname1"));, NOTIFY_ACTION_MODIFIED, FILE_NOTIFY_CHANGE_ATTRIBUTES, 1); @@ -877,64 +927,78 @@ static bool test_notify_mask(struct torture_context *tctx, torture_comment(tctx, "Testing set file create time\n"); NOTIFY_MASK_TEST("Testing set file create time", fnum2 = create_complex_file(cli, tctx, - BASEDIR "\\tname1");, + BASEDIR_CN1_NOTM "\\tname1");, smbcli_fsetatr(cli->tree, fnum2, 0, t, 0, 0, 0);, (smbcli_close(cli->tree, fnum2), - smbcli_unlink(cli->tree, BASEDIR "\\tname1"));, + smbcli_unlink(cli->tree, + BASEDIR_CN1_NOTM "\\tname1"));, NOTIFY_ACTION_MODIFIED, FILE_NOTIFY_CHANGE_CREATION, 1); } torture_comment(tctx, "Testing set file access time\n"); NOTIFY_MASK_TEST("Testing set file access time", - fnum2 = create_complex_file(cli, tctx, BASEDIR "\\tname1");, + fnum2 = create_complex_file(cli, tctx, + BASEDIR_CN1_NOTM "\\tname1");, smbcli_fsetatr(cli->tree, fnum2, 0, 0, t, 0, 0);, - (smbcli_close(cli->tree, fnum2), smbcli_unlink(cli->tree, BASEDIR "\\tname1"));, + (smbcli_close(cli->tree, fnum2), + smbcli_unlink(cli->tree, BASEDIR_CN1_NOTM "\\tname1"));, NOTIFY_ACTION_MODIFIED, FILE_NOTIFY_CHANGE_LAST_ACCESS, 1); torture_comment(tctx, "Testing set file write time\n"); NOTIFY_MASK_TEST("Testing set file write time", - fnum2 = create_complex_file(cli, tctx, BASEDIR "\\tname1");, + fnum2 = create_complex_file(cli, tctx, + BASEDIR_CN1_NOTM "\\tname1");, smbcli_fsetatr(cli->tree, fnum2, 0, 0, 0, t, 0);, - (smbcli_close(cli->tree, fnum2), smbcli_unlink(cli->tree, BASEDIR "\\tname1"));, + (smbcli_close(cli->tree, fnum2), + smbcli_unlink(cli->tree, BASEDIR_CN1_NOTM "\\tname1"));, NOTIFY_ACTION_MODIFIED, FILE_NOTIFY_CHANGE_LAST_WRITE, 1); torture_comment(tctx, "Testing set file change time\n"); NOTIFY_MASK_TEST("Testing set file change time", - fnum2 = create_complex_file(cli, tctx, BASEDIR "\\tname1");, + fnum2 = create_complex_file(cli, tctx, + BASEDIR_CN1_NOTM "\\tname1");, smbcli_fsetatr(cli->tree, fnum2, 0, 0, 0, 0, t);, - (smbcli_close(cli->tree, fnum2), smbcli_unlink(cli->tree, BASEDIR "\\tname1"));, + (smbcli_close(cli->tree, fnum2), + smbcli_unlink(cli->tree, BASEDIR_CN1_NOTM "\\tname1"));, NOTIFY_ACTION_MODIFIED, 0, 1); torture_comment(tctx, "Testing write\n"); NOTIFY_MASK_TEST("Testing write", - fnum2 = create_complex_file(cli2, tctx, BASEDIR "\\tname1");, + fnum2 = create_complex_file(cli2, tctx, + BASEDIR_CN1_NOTM "\\tname1");, smbcli_write(cli2->tree, fnum2, 1, &c, 10000, 1);, - (smbcli_close(cli2->tree, fnum2), smbcli_unlink(cli->tree, BASEDIR "\\tname1"));, + (smbcli_close(cli2->tree, fnum2), + smbcli_unlink(cli->tree, BASEDIR_CN1_NOTM "\\tname1"));, NOTIFY_ACTION_MODIFIED, 0, 1); torture_comment(tctx, "Testing truncate\n"); NOTIFY_MASK_TEST("Testing truncate", - fnum2 = create_complex_file(cli2, tctx, BASEDIR "\\tname1");, + fnum2 = create_complex_file(cli2, tctx, + BASEDIR_CN1_NOTM "\\tname1");, smbcli_ftruncate(cli2->tree, fnum2, 10000);, - (smbcli_close(cli2->tree, fnum2), smbcli_unlink(cli2->tree, BASEDIR "\\tname1"));, + (smbcli_close(cli2->tree, fnum2), + smbcli_unlink(cli2->tree, BASEDIR_CN1_NOTM "\\tname1"));, NOTIFY_ACTION_MODIFIED, FILE_NOTIFY_CHANGE_SIZE | FILE_NOTIFY_CHANGE_ATTRIBUTES, 1); done: smb_raw_exit(cli->session); - smbcli_deltree(cli->tree, BASEDIR); + smbcli_deltree(cli->tree, BASEDIR_CN1_NOTM); return ret; } /* basic testing of change notify on files */ + +#define BASEDIR_CN1_FILE BASEDIR "_CN1_FILE" + static bool test_notify_file(struct torture_context *tctx, struct smbcli_state *cli) { @@ -945,12 +1009,12 @@ static bool test_notify_file(struct torture_context *tctx, union smb_notify notify; struct smbcli_request *req; int fnum; - const char *fname = BASEDIR "\\file.txt"; + const char *fname = BASEDIR_CN1_FILE "\\file.txt"; torture_comment(tctx, "TESTING CHANGE NOTIFY ON FILES\n"); - torture_assert(tctx, torture_setup_dir(cli, BASEDIR), - "Failed to setup up test directory: " BASEDIR); + torture_assert(tctx, torture_setup_dir(cli, BASEDIR_CN1_FILE), + "Failed to setup up test directory: " BASEDIR_CN1_FILE); io.generic.level = RAW_OPEN_NTCREATEX; io.ntcreatex.in.root_fid.fnum = 0; @@ -999,13 +1063,15 @@ static bool test_notify_file(struct torture_context *tctx, done: smb_raw_exit(cli->session); - smbcli_deltree(cli->tree, BASEDIR); + smbcli_deltree(cli->tree, BASEDIR_CN1_FILE); return ret; } /* basic testing of change notifies followed by a tdis */ +#define BASEDIR_CN1_TDIS BASEDIR "_CN1_TDIS" + static bool test_notify_tdis(struct torture_context *tctx, struct smbcli_state *cli1) { @@ -1019,8 +1085,8 @@ static bool test_notify_tdis(struct torture_context *tctx, torture_comment(tctx, "TESTING CHANGE NOTIFY FOLLOWED BY TDIS\n"); - torture_assert(tctx, torture_setup_dir(cli1, BASEDIR), - "Failed to setup up test directory: " BASEDIR); + torture_assert(tctx, torture_setup_dir(cli1, BASEDIR_CN1_TDIS), + "Failed to setup up test directory: " BASEDIR_CN1_TDIS); torture_assert(tctx, torture_open_connection(&cli, tctx, 0), "Failed to open connection."); @@ -1039,7 +1105,7 @@ static bool test_notify_tdis(struct torture_context *tctx, io.ntcreatex.in.open_disposition = NTCREATEX_DISP_OPEN; io.ntcreatex.in.impersonation = NTCREATEX_IMPERSONATION_ANONYMOUS; io.ntcreatex.in.security_flags = 0; - io.ntcreatex.in.fname = BASEDIR; + io.ntcreatex.in.fname = BASEDIR_CN1_TDIS; status = smb_raw_open(cli->tree, tctx, &io); torture_assert_ntstatus_ok_goto(tctx, status, ret, done, @@ -1069,13 +1135,16 @@ static bool test_notify_tdis(struct torture_context *tctx, done: torture_close_connection(cli); - smbcli_deltree(cli1->tree, BASEDIR); + smbcli_deltree(cli1->tree, BASEDIR_CN1_TDIS); return ret; } /* basic testing of change notifies followed by a exit */ + +#define BASEDIR_CN1_EX BASEDIR "_CN1_EX" + static bool test_notify_exit(struct torture_context *tctx, struct smbcli_state *cli1) { @@ -1089,8 +1158,8 @@ static bool test_notify_exit(struct torture_context *tctx, torture_comment(tctx, "TESTING CHANGE NOTIFY FOLLOWED BY EXIT\n"); - torture_assert(tctx, torture_setup_dir(cli1, BASEDIR), - "Failed to setup up test directory: " BASEDIR); + torture_assert(tctx, torture_setup_dir(cli1, BASEDIR_CN1_EX), + "Failed to setup up test directory: " BASEDIR_CN1_EX); torture_assert(tctx, torture_open_connection(&cli, tctx, 0), "Failed to open connection."); @@ -1109,7 +1178,7 @@ static bool test_notify_exit(struct torture_context *tctx, io.ntcreatex.in.open_disposition = NTCREATEX_DISP_OPEN; io.ntcreatex.in.impersonation = NTCREATEX_IMPERSONATION_ANONYMOUS; io.ntcreatex.in.security_flags = 0; - io.ntcreatex.in.fname = BASEDIR; + io.ntcreatex.in.fname = BASEDIR_CN1_EX; status = smb_raw_open(cli->tree, tctx, &io); torture_assert_ntstatus_ok_goto(tctx, status, ret, done, @@ -1138,13 +1207,16 @@ static bool test_notify_exit(struct torture_context *tctx, done: torture_close_connection(cli); - smbcli_deltree(cli1->tree, BASEDIR); + smbcli_deltree(cli1->tree, BASEDIR_CN1_EX); return ret; } /* basic testing of change notifies followed by a ulogoff */ + +#define BASEDIR_CN1_UL BASEDIR "_CN1_UL" + static bool test_notify_ulogoff(struct torture_context *tctx, struct smbcli_state *cli1) { @@ -1158,8 +1230,8 @@ static bool test_notify_ulogoff(struct torture_context *tctx, torture_comment(tctx, "TESTING CHANGE NOTIFY FOLLOWED BY ULOGOFF\n"); - torture_assert(tctx, torture_setup_dir(cli1, BASEDIR), - "Failed to setup up test directory: " BASEDIR); + torture_assert(tctx, torture_setup_dir(cli1, BASEDIR_CN1_UL), + "Failed to setup up test directory: " BASEDIR_CN1_UL); torture_assert(tctx, torture_open_connection(&cli, tctx, 0), "Failed to open connection."); @@ -1178,7 +1250,7 @@ static bool test_notify_ulogoff(struct torture_context *tctx, io.ntcreatex.in.open_disposition = NTCREATEX_DISP_OPEN; io.ntcreatex.in.impersonation = NTCREATEX_IMPERSONATION_ANONYMOUS; io.ntcreatex.in.security_flags = 0; - io.ntcreatex.in.fname = BASEDIR; + io.ntcreatex.in.fname = BASEDIR_CN1_UL; status = smb_raw_open(cli->tree, tctx, &io); torture_assert_ntstatus_ok_goto(tctx, status, ret, done, @@ -1207,7 +1279,7 @@ static bool test_notify_ulogoff(struct torture_context *tctx, done: torture_close_connection(cli); - smbcli_deltree(cli1->tree, BASEDIR); + smbcli_deltree(cli1->tree, BASEDIR_CN1_UL); return ret; } @@ -1221,6 +1293,9 @@ static void tcp_dis_handler(struct smbcli_transport *t, void *p) /* basic testing of change notifies followed by tcp disconnect */ + +#define BASEDIR_CN1_TCPDIS BASEDIR "_CN1_TCPDIS" + static bool test_notify_tcp_dis(struct torture_context *tctx, struct smbcli_state *cli1) { @@ -1234,8 +1309,9 @@ static bool test_notify_tcp_dis(struct torture_context *tctx, torture_comment(tctx, "TESTING CHANGE NOTIFY FOLLOWED BY TCP DISCONNECT\n"); - torture_assert(tctx, torture_setup_dir(cli1, BASEDIR), - "Failed to setup up test directory: " BASEDIR); + torture_assert(tctx, torture_setup_dir(cli1, BASEDIR_CN1_TCPDIS), + "Failed to setup up test directory: " + BASEDIR_CN1_TCPDIS); torture_assert(tctx, torture_open_connection(&cli, tctx, 0), "Failed to open connection."); @@ -1254,7 +1330,7 @@ static bool test_notify_tcp_dis(struct torture_context *tctx, io.ntcreatex.in.open_disposition = NTCREATEX_DISP_OPEN; io.ntcreatex.in.impersonation = NTCREATEX_IMPERSONATION_ANONYMOUS; io.ntcreatex.in.security_flags = 0; - io.ntcreatex.in.fname = BASEDIR; + io.ntcreatex.in.fname = BASEDIR_CN1_TCPDIS; status = smb_raw_open(cli->tree, tctx, &io); torture_assert_ntstatus_ok_goto(tctx, status, ret, done, @@ -1281,13 +1357,16 @@ static bool test_notify_tcp_dis(struct torture_context *tctx, done: torture_close_connection(cli); - smbcli_deltree(cli1->tree, BASEDIR); + smbcli_deltree(cli1->tree, BASEDIR_CN1_TCPDIS); return ret; } /* test setting up two change notify requests on one handle */ + +#define BASEDIR_CN1_DBL BASEDIR "_CN1_DBL" + static bool test_notify_double(struct torture_context *tctx, struct smbcli_state *cli) { @@ -1300,8 +1379,8 @@ static bool test_notify_double(struct torture_context *tctx, torture_comment(tctx, "TESTING CHANGE NOTIFY TWICE ON ONE DIRECTORY\n"); - torture_assert(tctx, torture_setup_dir(cli, BASEDIR), - "Failed to setup up test directory: " BASEDIR); + torture_assert(tctx, torture_setup_dir(cli, BASEDIR_CN1_DBL), + "Failed to setup up test directory: " BASEDIR_CN1_DBL); /* get a handle on the directory @@ -1317,7 +1396,7 @@ static bool test_notify_double(struct torture_context *tctx, io.ntcreatex.in.open_disposition = NTCREATEX_DISP_OPEN; io.ntcreatex.in.impersonation = NTCREATEX_IMPERSONATION_ANONYMOUS; io.ntcreatex.in.security_flags = 0; - io.ntcreatex.in.fname = BASEDIR; + io.ntcreatex.in.fname = BASEDIR_CN1_DBL; status = smb_raw_open(cli->tree, tctx, &io); torture_assert_ntstatus_ok_goto(tctx, status, ret, done, @@ -1335,7 +1414,7 @@ static bool test_notify_double(struct torture_context *tctx, req1 = smb_raw_changenotify_send(cli->tree, ¬ify); req2 = smb_raw_changenotify_send(cli->tree, ¬ify); - smbcli_mkdir(cli->tree, BASEDIR "\\subdir-name"); + smbcli_mkdir(cli->tree, BASEDIR_CN1_DBL "\\subdir-name"); status = smb_raw_changenotify_recv(req1, tctx, ¬ify); torture_assert_ntstatus_ok_goto(tctx, status, ret, done, @@ -1345,7 +1424,7 @@ static bool test_notify_double(struct torture_context *tctx, CHECK_WSTR(tctx, notify.nttrans.out.changes[0].name, "subdir-name", STR_UNICODE); - smbcli_mkdir(cli->tree, BASEDIR "\\subdir-name2"); + smbcli_mkdir(cli->tree, BASEDIR_CN1_DBL "\\subdir-name2"); status = smb_raw_changenotify_recv(req2, tctx, ¬ify); torture_assert_ntstatus_ok_goto(tctx, status, ret, done, @@ -1357,7 +1436,7 @@ static bool test_notify_double(struct torture_context *tctx, done: smb_raw_exit(cli->session); - smbcli_deltree(cli->tree, BASEDIR); + smbcli_deltree(cli->tree, BASEDIR_CN1_DBL); return ret; } @@ -1365,6 +1444,9 @@ done: /* test multiple change notifies at different depths and with/without recursion */ + +#define BASEDIR_CN1_TNT BASEDIR "_CN1_TNT" + static bool test_notify_tree(struct torture_context *tctx, struct smbcli_state *cli, struct smbcli_state *cli2) @@ -1382,26 +1464,46 @@ static bool test_notify_tree(struct torture_context *tctx, int fnum; int counted; } dirs[] = { - {BASEDIR "\\abc", true, FILE_NOTIFY_CHANGE_NAME, 30 }, - {BASEDIR "\\zqy", true, FILE_NOTIFY_CHANGE_NAME, 8 }, - {BASEDIR "\\atsy", true, FILE_NOTIFY_CHANGE_NAME, 4 }, - {BASEDIR "\\abc\\foo", true, FILE_NOTIFY_CHANGE_NAME, 2 }, - {BASEDIR "\\abc\\blah", true, FILE_NOTIFY_CHANGE_NAME, 13 }, - {BASEDIR "\\abc\\blah", false, FILE_NOTIFY_CHANGE_NAME, 7 }, - {BASEDIR "\\abc\\blah\\a", true, FILE_NOTIFY_CHANGE_NAME, 2 }, - {BASEDIR "\\abc\\blah\\b", true, FILE_NOTIFY_CHANGE_NAME, 2 }, - {BASEDIR "\\abc\\blah\\c", true, FILE_NOTIFY_CHANGE_NAME, 2 }, - {BASEDIR "\\abc\\fooblah", true, FILE_NOTIFY_CHANGE_NAME, 2 }, - {BASEDIR "\\zqy\\xx", true, FILE_NOTIFY_CHANGE_NAME, 2 }, - {BASEDIR "\\zqy\\yyy", true, FILE_NOTIFY_CHANGE_NAME, 2 }, - {BASEDIR "\\zqy\\..", true, FILE_NOTIFY_CHANGE_NAME, 40 }, - {BASEDIR, true, FILE_NOTIFY_CHANGE_NAME, 40 }, - {BASEDIR, false,FILE_NOTIFY_CHANGE_NAME, 6 }, - {BASEDIR "\\atsy", false,FILE_NOTIFY_CHANGE_NAME, 4 }, - {BASEDIR "\\abc", true, FILE_NOTIFY_CHANGE_NAME, 24 }, - {BASEDIR "\\abc", false,FILE_NOTIFY_CHANGE_FILE_NAME, 0 }, - {BASEDIR "\\abc", true, FILE_NOTIFY_CHANGE_FILE_NAME, 0 }, - {BASEDIR "\\abc", true, FILE_NOTIFY_CHANGE_NAME, 24 }, + {BASEDIR_CN1_TNT "\\abc", + true, FILE_NOTIFY_CHANGE_NAME, 30 }, + {BASEDIR_CN1_TNT "\\zqy", + true, FILE_NOTIFY_CHANGE_NAME, 8 }, + {BASEDIR_CN1_TNT "\\atsy", + true, FILE_NOTIFY_CHANGE_NAME, 4 }, + {BASEDIR_CN1_TNT "\\abc\\foo", + true, FILE_NOTIFY_CHANGE_NAME, 2 }, + {BASEDIR_CN1_TNT "\\abc\\blah", + true, FILE_NOTIFY_CHANGE_NAME, 13 }, + {BASEDIR_CN1_TNT "\\abc\\blah", + false, FILE_NOTIFY_CHANGE_NAME, 7 }, + {BASEDIR_CN1_TNT "\\abc\\blah\\a", + true, FILE_NOTIFY_CHANGE_NAME, 2 }, + {BASEDIR_CN1_TNT "\\abc\\blah\\b", + true, FILE_NOTIFY_CHANGE_NAME, 2 }, + {BASEDIR_CN1_TNT "\\abc\\blah\\c", + true, FILE_NOTIFY_CHANGE_NAME, 2 }, + {BASEDIR_CN1_TNT "\\abc\\fooblah", + true, FILE_NOTIFY_CHANGE_NAME, 2 }, + {BASEDIR_CN1_TNT "\\zqy\\xx", + true, FILE_NOTIFY_CHANGE_NAME, 2 }, + {BASEDIR_CN1_TNT "\\zqy\\yyy", + true, FILE_NOTIFY_CHANGE_NAME, 2 }, + {BASEDIR_CN1_TNT "\\zqy\\..", + true, FILE_NOTIFY_CHANGE_NAME, 40 }, + {BASEDIR_CN1_TNT, + true, FILE_NOTIFY_CHANGE_NAME, 40 }, + {BASEDIR_CN1_TNT, + false,FILE_NOTIFY_CHANGE_NAME, 6 }, + {BASEDIR_CN1_TNT "\\atsy", + false,FILE_NOTIFY_CHANGE_NAME, 4 }, + {BASEDIR_CN1_TNT "\\abc", + true, FILE_NOTIFY_CHANGE_NAME, 24 }, + {BASEDIR_CN1_TNT "\\abc", + false,FILE_NOTIFY_CHANGE_FILE_NAME, 0 }, + {BASEDIR_CN1_TNT "\\abc", + true, FILE_NOTIFY_CHANGE_FILE_NAME, 0 }, + {BASEDIR_CN1_TNT "\\abc", + true, FILE_NOTIFY_CHANGE_NAME, 24 }, }; int i; NTSTATUS status; @@ -1409,8 +1511,8 @@ static bool test_notify_tree(struct torture_context *tctx, torture_comment(tctx, "TESTING CHANGE NOTIFY FOR DIFFERENT DEPTHS\n"); - torture_assert(tctx, torture_setup_dir(cli, BASEDIR), - "Failed to setup up test directory: " BASEDIR); + torture_assert(tctx, torture_setup_dir(cli, BASEDIR_CN1_TNT), + "Failed to setup up test directory: " BASEDIR_CN1_TNT); io.generic.level = RAW_OPEN_NTCREATEX; io.ntcreatex.in.root_fid.fnum = 0; @@ -1505,7 +1607,7 @@ static bool test_notify_tree(struct torture_context *tctx, done: smb_raw_exit(cli->session); - smbcli_deltree(cli->tree, BASEDIR); + smbcli_deltree(cli->tree, BASEDIR_CN1_TNT); return ret; } @@ -1513,6 +1615,9 @@ done: Test response when cached server events exceed single NT NOTFIY response packet size. */ + +#define BASEDIR_CN1_NO BASEDIR "_CN1_NO" + static bool test_notify_overflow(struct torture_context *tctx, struct smbcli_state *cli) { @@ -1527,8 +1632,8 @@ static bool test_notify_overflow(struct torture_context *tctx, torture_comment(tctx, "TESTING CHANGE NOTIFY EVENT OVERFLOW\n"); - torture_assert(tctx, torture_setup_dir(cli, BASEDIR), - "Failed to setup up test directory: " BASEDIR); + torture_assert(tctx, torture_setup_dir(cli, BASEDIR_CN1_NO), + "Failed to setup up test directory: " BASEDIR_CN1_NO); /* get a handle on the directory */ io.generic.level = RAW_OPEN_NTCREATEX; @@ -1543,7 +1648,7 @@ static bool test_notify_overflow(struct torture_context *tctx, io.ntcreatex.in.open_disposition = NTCREATEX_DISP_OPEN; io.ntcreatex.in.impersonation = NTCREATEX_IMPERSONATION_ANONYMOUS; io.ntcreatex.in.security_flags = 0; - io.ntcreatex.in.fname = BASEDIR; + io.ntcreatex.in.fname = BASEDIR_CN1_NO; status = smb_raw_open(cli->tree, tctx, &io); torture_assert_ntstatus_ok_goto(tctx, status, ret, done, @@ -1571,7 +1676,8 @@ static bool test_notify_overflow(struct torture_context *tctx, torture_comment(tctx, "Testing overflowed buffer notify on create of %d files\n", count); for (i=0;itree, fname, O_CREAT|O_RDWR, DENY_NONE); torture_assert_int_not_equal_goto(tctx, fnum2, -1, ret, done, @@ -1591,7 +1697,7 @@ static bool test_notify_overflow(struct torture_context *tctx, done: smb_raw_exit(cli->session); - smbcli_deltree(cli->tree, BASEDIR); + smbcli_deltree(cli->tree, BASEDIR_CN1_NO); return ret; } @@ -1599,6 +1705,9 @@ done: Test if notifications are returned for changes to the base directory. They shouldn't be. */ + +#define BASEDIR_CN1_NBASE BASEDIR "_CN1_NBASE" + static bool test_notify_basedir(struct torture_context *tctx, struct smbcli_state *cli) { @@ -1611,8 +1720,8 @@ static bool test_notify_basedir(struct torture_context *tctx, torture_comment(tctx, "TESTING CHANGE NOTIFY BASEDIR EVENTS\n"); - torture_assert(tctx, torture_setup_dir(cli, BASEDIR), - "Failed to setup up test directory: " BASEDIR); + torture_assert(tctx, torture_setup_dir(cli, BASEDIR_CN1_NBASE), + "Failed to setup up test directory: " BASEDIR_CN1_NBASE); /* get a handle on the directory */ io.generic.level = RAW_OPEN_NTCREATEX; @@ -1627,7 +1736,7 @@ static bool test_notify_basedir(struct torture_context *tctx, io.ntcreatex.in.open_disposition = NTCREATEX_DISP_OPEN; io.ntcreatex.in.impersonation = NTCREATEX_IMPERSONATION_ANONYMOUS; io.ntcreatex.in.security_flags = 0; - io.ntcreatex.in.fname = BASEDIR; + io.ntcreatex.in.fname = BASEDIR_CN1_NBASE; status = smb_raw_open(cli->tree, tctx, &io); torture_assert_ntstatus_ok_goto(tctx, status, ret, done, @@ -1635,7 +1744,8 @@ static bool test_notify_basedir(struct torture_context *tctx, fnum = io.ntcreatex.out.file.fnum; /* create a test file that will also be modified */ - smbcli_close(cli->tree, smbcli_open(cli->tree, BASEDIR "\\tname1", + smbcli_close(cli->tree, smbcli_open(cli->tree, + BASEDIR_CN1_NBASE "\\tname1", O_CREAT, 0)); /* ask for a change notify, on attribute changes. */ @@ -1648,10 +1758,11 @@ static bool test_notify_basedir(struct torture_context *tctx, req1 = smb_raw_changenotify_send(cli->tree, ¬ify); /* set attribute on the base dir */ - smbcli_setatr(cli->tree, BASEDIR, FILE_ATTRIBUTE_HIDDEN, 0); + smbcli_setatr(cli->tree, BASEDIR_CN1_NBASE, FILE_ATTRIBUTE_HIDDEN, 0); /* set attribute on a file to assure we receive a notification */ - smbcli_setatr(cli->tree, BASEDIR "\\tname1", FILE_ATTRIBUTE_HIDDEN, 0); + smbcli_setatr(cli->tree, BASEDIR_CN1_NBASE "\\tname1", + FILE_ATTRIBUTE_HIDDEN, 0); smb_msleep(200); /* check how many responses were given, expect only 1 for the file */ @@ -1669,7 +1780,7 @@ static bool test_notify_basedir(struct torture_context *tctx, done: smb_raw_exit(cli->session); - smbcli_deltree(cli->tree, BASEDIR); + smbcli_deltree(cli->tree, BASEDIR_CN1_NBASE); return ret; } @@ -1678,6 +1789,7 @@ done: create a secondary tree connect - used to test for a bug in Samba3 messaging with change notify */ + static struct smbcli_tree *secondary_tcon(struct smbcli_state *cli, struct torture_context *tctx) { @@ -1714,6 +1826,9 @@ static struct smbcli_tree *secondary_tcon(struct smbcli_state *cli, /* very simple change notify test */ + +#define BASEDIR_CN1_NTCON BASEDIR "_CN1_NTCON" + static bool test_notify_tcon(struct torture_context *tctx, struct smbcli_state *cli) { @@ -1728,8 +1843,8 @@ static bool test_notify_tcon(struct torture_context *tctx, torture_comment(tctx, "TESTING SIMPLE CHANGE NOTIFY\n"); - torture_assert(tctx, torture_setup_dir(cli, BASEDIR), - "Failed to setup up test directory: " BASEDIR); + torture_assert(tctx, torture_setup_dir(cli, BASEDIR_CN1_NTCON), + "Failed to setup up test directory: " BASEDIR_CN1_NTCON); /* get a handle on the directory @@ -1745,7 +1860,7 @@ static bool test_notify_tcon(struct torture_context *tctx, io.ntcreatex.in.open_disposition = NTCREATEX_DISP_OPEN; io.ntcreatex.in.impersonation = NTCREATEX_IMPERSONATION_ANONYMOUS; io.ntcreatex.in.security_flags = 0; - io.ntcreatex.in.fname = BASEDIR; + io.ntcreatex.in.fname = BASEDIR_CN1_NTCON; status = smb_raw_open(cli->tree, tctx, &io); torture_assert_ntstatus_ok_goto(tctx, status, ret, done, @@ -1766,7 +1881,7 @@ static bool test_notify_tcon(struct torture_context *tctx, torture_comment(tctx, "Testing notify mkdir\n"); req = smb_raw_changenotify_send(cli->tree, ¬ify); - smbcli_mkdir(cli->tree, BASEDIR "\\subdir-name"); + smbcli_mkdir(cli->tree, BASEDIR_CN1_NTCON "\\subdir-name"); status = smb_raw_changenotify_recv(req, tctx, ¬ify); torture_assert_ntstatus_ok_goto(tctx, status, ret, done, @@ -1783,7 +1898,7 @@ static bool test_notify_tcon(struct torture_context *tctx, torture_comment(tctx, "Testing notify rmdir\n"); req = smb_raw_changenotify_send(cli->tree, ¬ify); - smbcli_rmdir(cli->tree, BASEDIR "\\subdir-name"); + smbcli_rmdir(cli->tree, BASEDIR_CN1_NTCON "\\subdir-name"); status = smb_raw_changenotify_recv(req, tctx, ¬ify); torture_assert_ntstatus_ok_goto(tctx, status, ret, done, @@ -1806,7 +1921,7 @@ static bool test_notify_tcon(struct torture_context *tctx, torture_comment(tctx, "Testing notify mkdir\n"); req = smb_raw_changenotify_send(cli->tree, ¬ify); - smbcli_mkdir(cli->tree, BASEDIR "\\subdir-name"); + smbcli_mkdir(cli->tree, BASEDIR_CN1_NTCON "\\subdir-name"); status = smb_raw_changenotify_recv(req, tctx, ¬ify); torture_assert_ntstatus_ok_goto(tctx, status, ret, done, @@ -1823,7 +1938,7 @@ static bool test_notify_tcon(struct torture_context *tctx, torture_comment(tctx, "Testing notify rmdir\n"); req = smb_raw_changenotify_send(cli->tree, ¬ify); - smbcli_rmdir(cli->tree, BASEDIR "\\subdir-name"); + smbcli_rmdir(cli->tree, BASEDIR_CN1_NTCON "\\subdir-name"); status = smb_raw_changenotify_recv(req, tctx, ¬ify); torture_assert_ntstatus_ok_goto(tctx, status, ret, done, @@ -1847,7 +1962,7 @@ static bool test_notify_tcon(struct torture_context *tctx, torture_comment(tctx, "Testing notify mkdir\n"); req = smb_raw_changenotify_send(cli->tree, ¬ify); - smbcli_mkdir(cli->tree, BASEDIR "\\subdir-name"); + smbcli_mkdir(cli->tree, BASEDIR_CN1_NTCON "\\subdir-name"); status = smb_raw_changenotify_recv(req, tctx, ¬ify); torture_assert_ntstatus_ok_goto(tctx, status, ret, done, @@ -1864,7 +1979,7 @@ static bool test_notify_tcon(struct torture_context *tctx, torture_comment(tctx, "Testing notify rmdir\n"); req = smb_raw_changenotify_send(cli->tree, ¬ify); - smbcli_rmdir(cli->tree, BASEDIR "\\subdir-name"); + smbcli_rmdir(cli->tree, BASEDIR_CN1_NTCON "\\subdir-name"); status = smb_raw_changenotify_recv(req, tctx, ¬ify); torture_assert_ntstatus_ok_goto(tctx, status, ret, done, @@ -1881,7 +1996,7 @@ static bool test_notify_tcon(struct torture_context *tctx, torture_comment(tctx, "CHANGE NOTIFY WITH TDIS OK\n"); done: smb_raw_exit(cli->session); - smbcli_deltree(cli->tree, BASEDIR); + smbcli_deltree(cli->tree, BASEDIR_CN1_NTCON); return ret; } @@ -1889,6 +2004,9 @@ done: /* testing alignment of multiple change notify infos */ + +#define BASEDIR_CN1_NALIGN BASEDIR "_CN1_NALIGN" + static bool test_notify_alignment(struct torture_context *tctx, struct smbcli_state *cli) { @@ -1897,7 +2015,7 @@ static bool test_notify_alignment(struct torture_context *tctx, union smb_open io; int i, fnum, fnum2; struct smbcli_request *req; - const char *fname = BASEDIR "\\starter"; + const char *fname = BASEDIR_CN1_NALIGN "\\starter"; const char *fnames[] = { "a", "ab", "abc", @@ -1907,8 +2025,8 @@ static bool test_notify_alignment(struct torture_context *tctx, torture_comment(tctx, "TESTING CHANGE NOTIFY REPLY ALIGNMENT\n"); - torture_assert(tctx, torture_setup_dir(cli, BASEDIR), - "Failed to setup up test directory: " BASEDIR); + torture_assert(tctx, torture_setup_dir(cli, BASEDIR_CN1_NALIGN), + "Failed to setup up test directory: " BASEDIR_CN1_NALIGN); /* get a handle on the directory */ io.generic.level = RAW_OPEN_NTCREATEX; @@ -1923,7 +2041,7 @@ static bool test_notify_alignment(struct torture_context *tctx, io.ntcreatex.in.open_disposition = NTCREATEX_DISP_OPEN; io.ntcreatex.in.impersonation = NTCREATEX_IMPERSONATION_ANONYMOUS; io.ntcreatex.in.security_flags = 0; - io.ntcreatex.in.fname = BASEDIR; + io.ntcreatex.in.fname = BASEDIR_CN1_NALIGN; status = smb_raw_open(cli->tree, tctx, &io); torture_assert_ntstatus_ok(tctx, status, "smb_raw_open"); @@ -1952,7 +2070,8 @@ static bool test_notify_alignment(struct torture_context *tctx, * 4-byte aligned. */ for (i = 0; i < num_names; i++) { - fpath = talloc_asprintf(tctx, "%s\\%s", BASEDIR, fnames[i]); + fpath = talloc_asprintf(tctx, "%s\\%s", + BASEDIR_CN1_NALIGN, fnames[i]); fnum2 = smbcli_open(cli->tree, fpath, O_CREAT|O_RDWR, DENY_NONE); torture_assert(tctx, fnum2 != -1, smbcli_errstr(cli->tree)); @@ -1976,7 +2095,7 @@ static bool test_notify_alignment(struct torture_context *tctx, } smb_raw_exit(cli->session); - smbcli_deltree(cli->tree, BASEDIR); + smbcli_deltree(cli->tree, BASEDIR_CN1_NALIGN); return true; } -- 2.19.0.rc2.392.g5ba43deb5a-goog