goto done; \
}} while (0)
+#define WAIT_FOR_ASYNC_RESPONSE(req) \
+ while (!req->cancel.can_cancel && req->state <= SMB2_REQUEST_RECV) { \
+ if (tevent_loop_once(torture->ev) != 0) { \
+ break; \
+ } \
+ }
+
#define BASEDIR "test_notify"
#define FNAME "smb2-notify01.dat"
torture_comment(torture, "TESTING VALIDITY OF CHANGE NOTIFY REQUEST\n");
+ smb2_transport_credits_ask_num(tree->session->transport, 256);
+
smb2_util_unlink(tree, FNAME);
status = smb2_util_roothandle(tree, &dh);
CHECK_STATUS(status, NT_STATUS_OK);
- /* 0x00080000 is the default max buffer size for Windows servers
- * pre-Win7 */
- max_buffer_size = torture_setting_ulong(torture, "cn_max_buffer_size",
- 0x00080000);
+ max_buffer_size =
+ smb2cli_conn_max_trans_size(tree->session->transport->conn);
n.in.recursive = 0x0000;
n.in.buffer_size = max_buffer_size;
}
}
- status = torture_setup_complex_file(tree, FNAME);
+ status = torture_setup_simple_file(torture, tree, FNAME);
CHECK_STATUS(status, NT_STATUS_OK);
status = smb2_notify_recv(req, torture, &n);
}
}
- status = torture_setup_complex_file(tree, FNAME);
+ status = torture_setup_simple_file(torture, tree, FNAME);
CHECK_STATUS(status, NT_STATUS_OK);
status = smb2_notify_recv(req, torture, &n);
}
}
- status = torture_setup_complex_file(tree, FNAME);
+ status = torture_setup_simple_file(torture, tree, FNAME);
CHECK_STATUS(status, NT_STATUS_OK);
status = smb2_notify_recv(req, torture, &n);
}
}
- status = torture_setup_complex_file(tree, FNAME);
+ status = torture_setup_simple_file(torture, tree, FNAME);
CHECK_STATUS(status, NT_STATUS_OK);
status = smb2_notify_recv(req, torture, &n);
}
}
- status = torture_setup_complex_file(tree, FNAME);
+ status = torture_setup_simple_file(torture, tree, FNAME);
CHECK_STATUS(status, NT_STATUS_OK);
status = smb2_notify_recv(req, torture, &n);
/*
basic testing of change notify on directories
*/
+
+#define BASEDIR_DIR BASEDIR "_DIR"
+
static bool torture_smb2_notify_dir(struct torture_context *torture,
struct smb2_tree *tree1,
struct smb2_tree *tree2)
union smb_open io;
union smb_close cl;
int i, count;
- struct smb2_handle h1, h2;
+ struct smb2_handle h1 = {{0}};
+ struct smb2_handle h2 = {{0}};
struct smb2_request *req, *req2;
- const char *fname = BASEDIR "\\subdir-name";
+ const char *fname = BASEDIR_DIR "\\subdir-name";
extern int torture_numops;
torture_comment(torture, "TESTING CHANGE NOTIFY ON DIRECTORIES\n");
- smb2_deltree(tree1, BASEDIR);
- smb2_util_rmdir(tree1, BASEDIR);
+ smb2_deltree(tree1, BASEDIR_DIR);
+ smb2_util_rmdir(tree1, BASEDIR_DIR);
/*
get a handle on the directory
*/
io.smb2.in.create_disposition = NTCREATEX_DISP_CREATE;
io.smb2.in.impersonation_level = SMB2_IMPERSONATION_ANONYMOUS;
io.smb2.in.security_flags = 0;
- io.smb2.in.fname = BASEDIR;
+ io.smb2.in.fname = BASEDIR_DIR;
status = smb2_create(tree1, torture, &(io.smb2));
CHECK_STATUS(status, NT_STATUS_OK);
"Testing buffered notify on create of %d files\n", count);
for (i=0;i<count;i++) {
struct smb2_handle h12;
- char *fname2 = talloc_asprintf(torture, BASEDIR "\\test%d.txt",
- i);
+ char *fname2 = talloc_asprintf(torture,
+ BASEDIR_DIR "\\test%d.txt",
+ i);
ZERO_STRUCT(io.smb2);
io.generic.level = RAW_OPEN_SMB2;
notify.smb2.in.file.handle = h1;
req = smb2_notify_send(tree1, &(notify.smb2));
- status = smb2_util_unlink(tree1, BASEDIR "\\nonexistent.txt");
+ status = smb2_util_unlink(tree1, BASEDIR_DIR "\\nonexistent.txt");
CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_NOT_FOUND);
/* (1st unlink) as the 2nd notify directly returns,
the 3rd notify (later) */
torture_comment(torture,
"Testing notify on unlink for the first file\n");
- status = smb2_util_unlink(tree2, BASEDIR "\\test0.txt");
+ status = smb2_util_unlink(tree2, BASEDIR_DIR "\\test0.txt");
CHECK_STATUS(status, NT_STATUS_OK);
/* receive the reply from the 2nd notify */
"(3rd notify) this notify will only see the 1st unlink\n");
req = smb2_notify_send(tree1, &(notify.smb2));
- status = smb2_util_unlink(tree1, BASEDIR "\\nonexistent.txt");
+ status = smb2_util_unlink(tree1, BASEDIR_DIR "\\nonexistent.txt");
CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_NOT_FOUND);
for (i=1;i<count;i++) {
char *fname2 = talloc_asprintf(torture,
- BASEDIR "\\test%d.txt", i);
+ BASEDIR_DIR "\\test%d.txt", i);
status = smb2_util_unlink(tree2, fname2);
CHECK_STATUS(status, NT_STATUS_OK);
talloc_free(fname2);
done:
smb2_util_close(tree1, h1);
smb2_util_close(tree1, h2);
- smb2_deltree(tree1, BASEDIR);
+ smb2_deltree(tree1, BASEDIR_DIR);
return ret;
}
CHECK_STATUS(status, NT_STATUS_OK);
h1 = smb2->out.file.handle;
done:
+ if (!ret) {
+ h1 = (struct smb2_handle) {
+ .data = { 0 , 0},
+ };
+ }
return h1;
}
testing of recursive change notify
*/
+#define BASEDIR_REC BASEDIR "_REC"
+
static bool torture_smb2_notify_recursive(struct torture_context *torture,
struct smb2_tree *tree1,
struct smb2_tree *tree2)
struct smb2_handle h1;
struct smb2_request *req1, *req2;
- smb2_deltree(tree1, BASEDIR);
- smb2_util_rmdir(tree1, BASEDIR);
+ smb2_deltree(tree1, BASEDIR_REC);
+ smb2_util_rmdir(tree1, BASEDIR_REC);
torture_comment(torture, "TESTING CHANGE NOTIFY WITH RECURSION\n");
io.smb2.in.create_disposition = NTCREATEX_DISP_CREATE;
io.smb2.in.impersonation_level = SMB2_IMPERSONATION_ANONYMOUS;
io.smb2.in.security_flags = 0;
- io.smb2.in.fname = BASEDIR;
+ io.smb2.in.fname = BASEDIR_REC;
status = smb2_create(tree1, torture, &(io.smb2));
CHECK_STATUS(status, NT_STATUS_OK);
io1.smb2.in.create_disposition = NTCREATEX_DISP_OPEN_IF;
io1.smb2.in.impersonation_level = SMB2_IMPERSONATION_ANONYMOUS;
io1.smb2.in.security_flags = 0;
- io1.smb2.in.fname = BASEDIR "\\subdir-name";
+ io1.smb2.in.fname = BASEDIR_REC "\\subdir-name";
status = smb2_create(tree2, torture, &(io1.smb2));
CHECK_STATUS(status, NT_STATUS_OK);
smb2_util_close(tree2, io1.smb2.out.file.handle);
- io1.smb2.in.fname = BASEDIR "\\subdir-name\\subname1";
+ io1.smb2.in.fname = BASEDIR_REC "\\subdir-name\\subname1";
status = smb2_create(tree2, torture, &(io1.smb2));
CHECK_STATUS(status, NT_STATUS_OK);
ZERO_STRUCT(sinfo);
sinfo.rename_information.in.overwrite = 0;
sinfo.rename_information.in.root_fid = 0;
sinfo.rename_information.in.new_name =
- BASEDIR "\\subdir-name\\subname1-r";
+ BASEDIR_REC "\\subdir-name\\subname1-r";
status = smb2_setinfo_file(tree2, &sinfo);
CHECK_STATUS(status, NT_STATUS_OK);
io1.smb2.in.create_options = NTCREATEX_OPTIONS_NON_DIRECTORY_FILE;
- io1.smb2.in.fname = BASEDIR "\\subdir-name\\subname2";
+ io1.smb2.in.fname = BASEDIR_REC "\\subdir-name\\subname2";
status = smb2_create(tree2, torture, &(io1.smb2));
CHECK_STATUS(status, NT_STATUS_OK);
ZERO_STRUCT(sinfo);
sinfo.rename_information.in.file.handle = io1.smb2.out.file.handle;
sinfo.rename_information.in.overwrite = true;
sinfo.rename_information.in.root_fid = 0;
- sinfo.rename_information.in.new_name = BASEDIR "\\subname2-r";
+ sinfo.rename_information.in.new_name = BASEDIR_REC "\\subname2-r";
status = smb2_setinfo_file(tree2, &sinfo);
CHECK_STATUS(status, NT_STATUS_OK);
- io1.smb2.in.fname = BASEDIR "\\subname2-r";
+ io1.smb2.in.fname = BASEDIR_REC "\\subname2-r";
io1.smb2.in.create_disposition = NTCREATEX_DISP_OPEN;
status = smb2_create(tree2, torture, &(io1.smb2));
CHECK_STATUS(status, NT_STATUS_OK);
sinfo.rename_information.in.file.handle = io1.smb2.out.file.handle;
sinfo.rename_information.in.overwrite = true;
sinfo.rename_information.in.root_fid = 0;
- sinfo.rename_information.in.new_name = BASEDIR "\\subname3-r";
+ sinfo.rename_information.in.new_name = BASEDIR_REC "\\subname3-r";
status = smb2_setinfo_file(tree2, &sinfo);
CHECK_STATUS(status, NT_STATUS_OK);
smb_msleep(200);
req1 = smb2_notify_send(tree1, &(notify.smb2));
- status = smb2_util_rmdir(tree2, BASEDIR "\\subdir-name\\subname1-r");
+ status = smb2_util_rmdir(tree2,
+ BASEDIR_REC "\\subdir-name\\subname1-r");
CHECK_STATUS(status, NT_STATUS_OK);
- status = smb2_util_rmdir(tree2, BASEDIR "\\subdir-name");
+ status = smb2_util_rmdir(tree2,
+ BASEDIR_REC "\\subdir-name");
CHECK_STATUS(status, NT_STATUS_OK);
- status = smb2_util_unlink(tree2, BASEDIR "\\subname3-r");
+ status = smb2_util_unlink(tree2, BASEDIR_REC "\\subname3-r");
CHECK_STATUS(status, NT_STATUS_OK);
notify.smb2.in.recursive = false;
CHECK_WIRE_STR(notify.smb2.out.changes[8].name, "subname3-r");
done:
- smb2_deltree(tree1, BASEDIR);
+ smb2_deltree(tree1, BASEDIR_REC);
return ret;
}
testing of change notify mask change
*/
+#define BASEDIR_MC BASEDIR "_MC"
+
static bool torture_smb2_notify_mask_change(struct torture_context *torture,
struct smb2_tree *tree1,
struct smb2_tree *tree2)
struct smb2_request *req1, *req2;
union smb_setfileinfo sinfo;
- smb2_deltree(tree1, BASEDIR);
- smb2_util_rmdir(tree1, BASEDIR);
+ smb2_deltree(tree1, BASEDIR_MC);
+ smb2_util_rmdir(tree1, BASEDIR_MC);
torture_comment(torture, "TESTING CHANGE NOTIFY WITH MASK CHANGE\n");
io.smb2.in.create_disposition = NTCREATEX_DISP_CREATE;
io.smb2.in.impersonation_level = SMB2_IMPERSONATION_ANONYMOUS;
io.smb2.in.security_flags = 0;
- io.smb2.in.fname = BASEDIR;
+ io.smb2.in.fname = BASEDIR_MC;
status = smb2_create(tree1, torture, &(io.smb2));
CHECK_STATUS(status, NT_STATUS_OK);
io1.smb2.in.security_flags = 0;
io1.smb2.in.create_options = NTCREATEX_OPTIONS_NON_DIRECTORY_FILE;
io1.smb2.in.create_disposition = NTCREATEX_DISP_CREATE;
- io1.smb2.in.fname = BASEDIR "\\tname1";
+ io1.smb2.in.fname = BASEDIR_MC "\\tname1";
smb2_util_close(tree1,
custom_smb2_create(tree1, torture, &(io1.smb2)));
- status = smb2_util_setatr(tree1, BASEDIR "\\tname1",
+ status = smb2_util_setatr(tree1, BASEDIR_MC "\\tname1",
FILE_ATTRIBUTE_HIDDEN);
CHECK_STATUS(status, NT_STATUS_OK);
- smb2_util_unlink(tree1, BASEDIR "\\tname1");
+ smb2_util_unlink(tree1, BASEDIR_MC "\\tname1");
status = smb2_notify_recv(req1, torture, &(notify.smb2));
CHECK_STATUS(status, NT_STATUS_OK);
io1.smb2.in.create_options = NTCREATEX_OPTIONS_DIRECTORY;
io1.smb2.in.create_disposition = NTCREATEX_DISP_CREATE;
- io1.smb2.in.fname = BASEDIR "\\subdir-name";
+ io1.smb2.in.fname = BASEDIR_MC "\\subdir-name";
status = smb2_create(tree2, torture, &(io1.smb2));
CHECK_STATUS(status, NT_STATUS_OK);
smb2_util_close(tree2, io1.smb2.out.file.handle);
ZERO_STRUCT(sinfo);
- io1.smb2.in.fname = BASEDIR "\\subdir-name\\subname1";
+ io1.smb2.in.fname = BASEDIR_MC "\\subdir-name\\subname1";
io1.smb2.in.create_options = NTCREATEX_OPTIONS_DIRECTORY;
io1.smb2.in.create_disposition = NTCREATEX_DISP_CREATE;
status = smb2_create(tree2, torture, &(io1.smb2));
sinfo.rename_information.in.overwrite = true;
sinfo.rename_information.in.root_fid = 0;
sinfo.rename_information.in.new_name =
- BASEDIR "\\subdir-name\\subname1-r";
+ BASEDIR_MC "\\subdir-name\\subname1-r";
status = smb2_setinfo_file(tree2, &sinfo);
CHECK_STATUS(status, NT_STATUS_OK);
- io1.smb2.in.fname = BASEDIR "\\subdir-name\\subname2";
+ io1.smb2.in.fname = BASEDIR_MC "\\subdir-name\\subname2";
io1.smb2.in.create_disposition = NTCREATEX_DISP_CREATE;
io1.smb2.in.create_options = NTCREATEX_OPTIONS_NON_DIRECTORY_FILE;
status = smb2_create(tree2, torture, &(io1.smb2));
CHECK_STATUS(status, NT_STATUS_OK);
sinfo.rename_information.in.file.handle = io1.smb2.out.file.handle;
- sinfo.rename_information.in.new_name = BASEDIR "\\subname2-r";
+ sinfo.rename_information.in.new_name = BASEDIR_MC "\\subname2-r";
status = smb2_setinfo_file(tree2, &sinfo);
CHECK_STATUS(status, NT_STATUS_OK);
smb2_util_close(tree2, io1.smb2.out.file.handle);
- io1.smb2.in.fname = BASEDIR "\\subname2-r";
+ io1.smb2.in.fname = BASEDIR_MC "\\subname2-r";
io1.smb2.in.create_disposition = NTCREATEX_DISP_OPEN;
status = smb2_create(tree2, torture, &(io1.smb2));
CHECK_STATUS(status, NT_STATUS_OK);
sinfo.rename_information.in.file.handle = io1.smb2.out.file.handle;
- sinfo.rename_information.in.new_name = BASEDIR "\\subname3-r";
+ sinfo.rename_information.in.new_name = BASEDIR_MC "\\subname3-r";
status = smb2_setinfo_file(tree2, &sinfo);
CHECK_STATUS(status, NT_STATUS_OK);
smb2_util_close(tree2, io1.smb2.out.file.handle);
- status = smb2_util_rmdir(tree2, BASEDIR "\\subdir-name\\subname1-r");
+ status = smb2_util_rmdir(tree2, BASEDIR_MC "\\subdir-name\\subname1-r");
CHECK_STATUS(status, NT_STATUS_OK);
- status = smb2_util_rmdir(tree2, BASEDIR "\\subdir-name");
+ status = smb2_util_rmdir(tree2, BASEDIR_MC "\\subdir-name");
CHECK_STATUS(status, NT_STATUS_OK);
- status = smb2_util_unlink(tree2, BASEDIR "\\subname3-r");
+ status = smb2_util_unlink(tree2, BASEDIR_MC "\\subname3-r");
CHECK_STATUS(status, NT_STATUS_OK);
status = smb2_notify_recv(req1, torture, &(notify.smb2));
}
done:
- smb2_deltree(tree1, BASEDIR);
+ smb2_deltree(tree1, BASEDIR_MC);
return ret;
}
testing of mask bits for change notify
*/
+#define BASEDIR_MSK BASEDIR "_MSK"
+
static bool torture_smb2_notify_mask(struct torture_context *torture,
struct smb2_tree *tree1,
struct smb2_tree *tree2)
char c = 1;
union smb_setfileinfo sinfo;
- smb2_deltree(tree1, BASEDIR);
- smb2_util_rmdir(tree1, BASEDIR);
+ smb2_deltree(tree1, BASEDIR_MSK);
+ smb2_util_rmdir(tree1, BASEDIR_MSK);
torture_comment(torture, "TESTING CHANGE NOTIFY COMPLETION FILTERS\n");
+ ZERO_STRUCT(h1);
+ ZERO_STRUCT(h2);
/*
get a handle on the directory
*/
io.smb2.in.create_disposition = NTCREATEX_DISP_OPEN_IF;
io.smb2.in.impersonation_level = SMB2_IMPERSONATION_ANONYMOUS;
io.smb2.in.security_flags = 0;
- io.smb2.in.fname = BASEDIR;
+ io.smb2.in.fname = BASEDIR_MSK;
ZERO_STRUCT(notify.smb2);
notify.smb2.level = RAW_NOTIFY_SMB2;
torture_comment(torture, "Testing mkdir\n");
NOTIFY_MASK_TEST("Testing mkdir",;,
- smb2_util_mkdir(tree2, BASEDIR "\\tname1");,
- smb2_util_rmdir(tree2, BASEDIR "\\tname1");,
+ smb2_util_mkdir(tree2, BASEDIR_MSK "\\tname1");,
+ smb2_util_rmdir(tree2, BASEDIR_MSK "\\tname1");,
NOTIFY_ACTION_ADDED,
FILE_NOTIFY_CHANGE_DIR_NAME, 1);
io1.smb2.in.security_flags = 0;
io1.smb2.in.create_options = NTCREATEX_OPTIONS_NON_DIRECTORY_FILE;
io1.smb2.in.create_disposition = NTCREATEX_DISP_CREATE;
- io1.smb2.in.fname = BASEDIR "\\tname1";
+ io1.smb2.in.fname = BASEDIR_MSK "\\tname1";
NOTIFY_MASK_TEST("Testing create file",;,
smb2_util_close(tree2, custom_smb2_create(tree2,
torture, &(io1.smb2)));,
- smb2_util_unlink(tree2, BASEDIR "\\tname1");,
+ smb2_util_unlink(tree2, BASEDIR_MSK "\\tname1");,
NOTIFY_ACTION_ADDED,
FILE_NOTIFY_CHANGE_FILE_NAME, 1);
NOTIFY_MASK_TEST("Testing unlink",
smb2_util_close(tree2, custom_smb2_create(tree2,
torture, &(io1.smb2)));,
- smb2_util_unlink(tree2, BASEDIR "\\tname1");,
+ smb2_util_unlink(tree2, BASEDIR_MSK "\\tname1");,
;,
NOTIFY_ACTION_REMOVED,
FILE_NOTIFY_CHANGE_FILE_NAME, 1);
torture_comment(torture, "Testing rmdir\n");
NOTIFY_MASK_TEST("Testing rmdir",
- smb2_util_mkdir(tree2, BASEDIR "\\tname1");,
- smb2_util_rmdir(tree2, BASEDIR "\\tname1");,
+ smb2_util_mkdir(tree2, BASEDIR_MSK "\\tname1");,
+ smb2_util_rmdir(tree2, BASEDIR_MSK "\\tname1");,
;,
NOTIFY_ACTION_REMOVED,
FILE_NOTIFY_CHANGE_DIR_NAME, 1);
sinfo.rename_information.in.file.handle = h1;
sinfo.rename_information.in.overwrite = true;
sinfo.rename_information.in.root_fid = 0;
- sinfo.rename_information.in.new_name = BASEDIR "\\tname2";
+ sinfo.rename_information.in.new_name = BASEDIR_MSK "\\tname2";
NOTIFY_MASK_TEST("Testing rename file",
smb2_util_close(tree2, custom_smb2_create(tree2,
torture, &(io1.smb2)));,
smb2_setinfo_file(tree2, &sinfo);,
- smb2_util_unlink(tree2, BASEDIR "\\tname2");,
+ smb2_util_unlink(tree2, BASEDIR_MSK "\\tname2");,
NOTIFY_ACTION_OLD_NAME,
FILE_NOTIFY_CHANGE_FILE_NAME, 2);
sinfo.rename_information.in.file.handle = h1;
sinfo.rename_information.in.overwrite = true;
sinfo.rename_information.in.root_fid = 0;
- sinfo.rename_information.in.new_name = BASEDIR "\\tname2";
+ sinfo.rename_information.in.new_name = BASEDIR_MSK "\\tname2";
NOTIFY_MASK_TEST("Testing rename dir",
- smb2_util_mkdir(tree2, BASEDIR "\\tname1");,
+ smb2_util_mkdir(tree2, BASEDIR_MSK "\\tname1");,
smb2_setinfo_file(tree2, &sinfo);,
- smb2_util_rmdir(tree2, BASEDIR "\\tname2");,
+ smb2_util_rmdir(tree2, BASEDIR_MSK "\\tname2");,
NOTIFY_ACTION_OLD_NAME,
FILE_NOTIFY_CHANGE_DIR_NAME, 2);
NOTIFY_MASK_TEST("Testing set path attribute",
smb2_util_close(tree2, custom_smb2_create(tree2,
torture, &(io.smb2)));,
- smb2_util_setatr(tree2, BASEDIR "\\tname1",
+ smb2_util_setatr(tree2, BASEDIR_MSK "\\tname1",
FILE_ATTRIBUTE_HIDDEN);,
- smb2_util_unlink(tree2, BASEDIR "\\tname1");,
+ smb2_util_unlink(tree2, BASEDIR_MSK "\\tname1");,
NOTIFY_ACTION_MODIFIED,
FILE_NOTIFY_CHANGE_ATTRIBUTES, 1);
smb2_util_close(tree2, custom_smb2_create(tree2,
torture, &(io1.smb2)));,
smb2_setinfo_file(tree2, &sinfo);,
- smb2_util_unlink(tree2, BASEDIR "\\tname1");,
+ smb2_util_unlink(tree2, BASEDIR_MSK "\\tname1");,
NOTIFY_ACTION_MODIFIED,
FILE_NOTIFY_CHANGE_LAST_WRITE, 1);
sinfo.basic_info.in.create_time = 0;
torture_comment(torture, "Testing set file create time\n");
NOTIFY_MASK_TEST("Testing set file create time",
- smb2_create_complex_file(tree2,
- BASEDIR "\\tname1", &h2);,
+ smb2_create_complex_file(torture, tree2,
+ BASEDIR_MSK "\\tname1", &h2);,
smb2_setinfo_file(tree2, &sinfo);,
(smb2_util_close(tree2, h2),
- smb2_util_unlink(tree2, BASEDIR "\\tname1"));,
+ smb2_util_unlink(tree2, BASEDIR_MSK "\\tname1"));,
NOTIFY_ACTION_MODIFIED,
FILE_NOTIFY_CHANGE_CREATION, 1);
}
sinfo.basic_info.in.access_time = 0;
torture_comment(torture, "Testing set file access time\n");
NOTIFY_MASK_TEST("Testing set file access time",
- smb2_create_complex_file(tree2, BASEDIR "\\tname1", &h2);,
+ smb2_create_complex_file(torture,
+ tree2,
+ BASEDIR_MSK "\\tname1",
+ &h2);,
smb2_setinfo_file(tree2, &sinfo);,
(smb2_util_close(tree2, h2),
- smb2_util_unlink(tree2, BASEDIR "\\tname1"));,
+ smb2_util_unlink(tree2, BASEDIR_MSK "\\tname1"));,
NOTIFY_ACTION_MODIFIED,
FILE_NOTIFY_CHANGE_LAST_ACCESS, 1);
sinfo.basic_info.in.change_time = 0;
torture_comment(torture, "Testing set file change time\n");
NOTIFY_MASK_TEST("Testing set file change time",
- smb2_create_complex_file(tree2, BASEDIR "\\tname1", &h2);,
+ smb2_create_complex_file(torture,
+ tree2,
+ BASEDIR_MSK "\\tname1",
+ &h2);,
smb2_setinfo_file(tree2, &sinfo);,
(smb2_util_close(tree2, h2),
- smb2_util_unlink(tree2, BASEDIR "\\tname1"));,
+ smb2_util_unlink(tree2, BASEDIR_MSK "\\tname1"));,
NOTIFY_ACTION_MODIFIED,
0, 1);
torture_comment(torture, "Testing write\n");
NOTIFY_MASK_TEST("Testing write",
- smb2_create_complex_file(tree2, BASEDIR "\\tname1", &h2);,
+ smb2_create_complex_file(torture,
+ tree2,
+ BASEDIR_MSK "\\tname1",
+ &h2);,
smb2_util_write(tree2, h2, &c, 10000, 1);,
(smb2_util_close(tree2, h2),
- smb2_util_unlink(tree2, BASEDIR "\\tname1"));,
+ smb2_util_unlink(tree2, BASEDIR_MSK "\\tname1"));,
NOTIFY_ACTION_MODIFIED,
0, 1);
done:
- smb2_deltree(tree1, BASEDIR);
+ smb2_deltree(tree1, BASEDIR_MSK);
return ret;
}
+#define BASEDIR_FL BASEDIR "_FL"
/*
basic testing of change notify on files
*/
union smb_notify notify;
struct smb2_request *req;
struct smb2_handle h1;
- const char *fname = BASEDIR "\\file.txt";
+ const char *fname = BASEDIR_FL "\\file.txt";
- smb2_deltree(tree, BASEDIR);
- smb2_util_rmdir(tree, BASEDIR);
+ smb2_deltree(tree, BASEDIR_FL);
+ smb2_util_rmdir(tree, BASEDIR_FL);
torture_comment(torture, "TESTING CHANGE NOTIFY ON FILES\n");
- status = torture_smb2_testdir(tree, BASEDIR, &h1);
+ status = torture_smb2_testdir(tree, BASEDIR_FL, &h1);
CHECK_STATUS(status, NT_STATUS_OK);
ZERO_STRUCT(io.smb2);
CHECK_STATUS(status, NT_STATUS_OK);
done:
- smb2_deltree(tree, BASEDIR);
+ smb2_deltree(tree, BASEDIR_FL);
return ret;
}
/*
basic testing of change notifies followed by a tdis
*/
+#define BASEDIR_TD BASEDIR "_TD"
+
static bool torture_smb2_notify_tree_disconnect(
struct torture_context *torture,
struct smb2_tree *tree)
struct smb2_handle h1;
struct smb2_request *req;
- smb2_deltree(tree, BASEDIR);
- smb2_util_rmdir(tree, BASEDIR);
+ smb2_deltree(tree, BASEDIR_TD);
+ smb2_util_rmdir(tree, BASEDIR_TD);
- torture_comment(torture, "TESTING CHANGE NOTIFY FOLLOWED BY "
+ torture_comment(torture, "TESTING CHANGE NOTIFY+CANCEL FOLLOWED BY "
"TREE-DISCONNECT\n");
/*
io.smb2.in.create_disposition = NTCREATEX_DISP_CREATE;
io.smb2.in.impersonation_level = SMB2_IMPERSONATION_ANONYMOUS;
io.smb2.in.security_flags = 0;
- io.smb2.in.fname = BASEDIR;
+ io.smb2.in.fname = BASEDIR_TD;
status = smb2_create(tree, torture, &(io.smb2));
CHECK_STATUS(status, NT_STATUS_OK);
CHECK_VAL(notify.smb2.out.num_changes, 0);
done:
- smb2_deltree(tree, BASEDIR);
+ smb2_deltree(tree, BASEDIR_TD);
+ return ret;
+}
+
+/*
+ testing of change notifies followed by a tdis - no cancel
+*/
+
+#define BASEDIR_NTDIS BASEDIR "_NTDIS"
+
+static bool torture_smb2_notify_tree_disconnect_1(
+ struct torture_context *torture,
+ struct smb2_tree *tree)
+{
+ bool ret = true;
+ NTSTATUS status;
+ union smb_notify notify;
+ union smb_open io;
+ struct smb2_handle h1;
+ struct smb2_request *req;
+
+ smb2_deltree(tree, BASEDIR_NTDIS);
+ smb2_util_rmdir(tree, BASEDIR_NTDIS);
+
+ torture_comment(torture, "TESTING CHANGE NOTIFY ASYNC FOLLOWED BY "
+ "TREE-DISCONNECT\n");
+
+ /*
+ get a handle on the directory
+ */
+ ZERO_STRUCT(io.smb2);
+ io.generic.level = RAW_OPEN_SMB2;
+ io.smb2.in.create_flags = 0;
+ io.smb2.in.desired_access = SEC_FILE_ALL;
+ io.smb2.in.create_options = NTCREATEX_OPTIONS_DIRECTORY;
+ io.smb2.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
+ io.smb2.in.share_access = NTCREATEX_SHARE_ACCESS_READ |
+ NTCREATEX_SHARE_ACCESS_WRITE;
+ io.smb2.in.alloc_size = 0;
+ io.smb2.in.create_disposition = NTCREATEX_DISP_CREATE;
+ io.smb2.in.impersonation_level = SMB2_IMPERSONATION_ANONYMOUS;
+ io.smb2.in.security_flags = 0;
+ io.smb2.in.fname = BASEDIR_NTDIS;
+
+ status = smb2_create(tree, torture, &(io.smb2));
+ CHECK_STATUS(status, NT_STATUS_OK);
+ h1 = io.smb2.out.file.handle;
+
+ /* ask for a change notify,
+ on file or directory name changes */
+ ZERO_STRUCT(notify.smb2);
+ notify.smb2.level = RAW_NOTIFY_SMB2;
+ notify.smb2.in.buffer_size = 1000;
+ notify.smb2.in.completion_filter = FILE_NOTIFY_CHANGE_NAME;
+ notify.smb2.in.file.handle = h1;
+ notify.smb2.in.recursive = true;
+
+ req = smb2_notify_send(tree, &(notify.smb2));
+ WAIT_FOR_ASYNC_RESPONSE(req);
+
+ status = smb2_tdis(tree);
+ CHECK_STATUS(status, NT_STATUS_OK);
+
+ status = smb2_notify_recv(req, torture, &(notify.smb2));
+ CHECK_STATUS(status, STATUS_NOTIFY_CLEANUP);
+ CHECK_VAL(notify.smb2.out.num_changes, 0);
+
+done:
+ smb2_deltree(tree, BASEDIR_NTDIS);
+ return ret;
+}
+
+/*
+ basic testing of change notifies followed by a close
+*/
+
+#define BASEDIR_CNC BASEDIR "_CNC"
+
+static bool torture_smb2_notify_close(struct torture_context *torture,
+ struct smb2_tree *tree1)
+{
+ bool ret = true;
+ NTSTATUS status;
+ union smb_notify notify;
+ union smb_open io;
+ struct smb2_handle h1;
+ struct smb2_request *req;
+
+ smb2_deltree(tree1, BASEDIR_CNC);
+ smb2_util_rmdir(tree1, BASEDIR_CNC);
+
+ torture_comment(torture, "TESTING CHANGE NOTIFY FOLLOWED BY ULOGOFF\n");
+
+ /*
+ get a handle on the directory
+ */
+ ZERO_STRUCT(io.smb2);
+ io.generic.level = RAW_OPEN_SMB2;
+ io.smb2.in.create_flags = 0;
+ io.smb2.in.desired_access = SEC_FILE_ALL;
+ io.smb2.in.create_options = NTCREATEX_OPTIONS_DIRECTORY;
+ io.smb2.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
+ io.smb2.in.share_access = NTCREATEX_SHARE_ACCESS_READ |
+ NTCREATEX_SHARE_ACCESS_WRITE;
+ io.smb2.in.alloc_size = 0;
+ io.smb2.in.create_disposition = NTCREATEX_DISP_CREATE;
+ io.smb2.in.impersonation_level = SMB2_IMPERSONATION_ANONYMOUS;
+ io.smb2.in.security_flags = 0;
+ io.smb2.in.fname = BASEDIR_CNC;
+
+ status = smb2_create(tree1, torture, &(io.smb2));
+ CHECK_STATUS(status, NT_STATUS_OK);
+
+ io.smb2.in.create_disposition = NTCREATEX_DISP_OPEN;
+ status = smb2_create(tree1, torture, &(io.smb2));
+ CHECK_STATUS(status, NT_STATUS_OK);
+ h1 = io.smb2.out.file.handle;
+
+ /* ask for a change notify,
+ on file or directory name changes */
+ ZERO_STRUCT(notify.smb2);
+ notify.smb2.level = RAW_NOTIFY_SMB2;
+ notify.smb2.in.buffer_size = 1000;
+ notify.smb2.in.completion_filter = FILE_NOTIFY_CHANGE_NAME;
+ notify.smb2.in.file.handle = h1;
+ notify.smb2.in.recursive = true;
+
+ req = smb2_notify_send(tree1, &(notify.smb2));
+
+ WAIT_FOR_ASYNC_RESPONSE(req);
+
+ status = smb2_util_close(tree1, h1);
+ CHECK_STATUS(status, NT_STATUS_OK);
+
+ status = smb2_notify_recv(req, torture, &(notify.smb2));
+ CHECK_STATUS(status, STATUS_NOTIFY_CLEANUP);
+ CHECK_VAL(notify.smb2.out.num_changes, 0);
+
+done:
+ smb2_deltree(tree1, BASEDIR_CNC);
return ret;
}
basic testing of change notifies followed by a ulogoff
*/
+#define BASEDIR_NUL BASEDIR "_NUL"
static bool torture_smb2_notify_ulogoff(struct torture_context *torture,
- struct smb2_tree *tree1,
- struct smb2_tree *tree2)
+ struct smb2_tree *tree1)
{
bool ret = true;
NTSTATUS status;
struct smb2_handle h1;
struct smb2_request *req;
- smb2_deltree(tree1, BASEDIR);
- smb2_util_rmdir(tree1, BASEDIR);
+ smb2_deltree(tree1, BASEDIR_NUL);
+ smb2_util_rmdir(tree1, BASEDIR_NUL);
torture_comment(torture, "TESTING CHANGE NOTIFY FOLLOWED BY ULOGOFF\n");
io.smb2.in.create_disposition = NTCREATEX_DISP_CREATE;
io.smb2.in.impersonation_level = SMB2_IMPERSONATION_ANONYMOUS;
io.smb2.in.security_flags = 0;
- io.smb2.in.fname = BASEDIR;
+ io.smb2.in.fname = BASEDIR_NUL;
+
+ status = smb2_create(tree1, torture, &(io.smb2));
+ CHECK_STATUS(status, NT_STATUS_OK);
+
+ io.smb2.in.create_disposition = NTCREATEX_DISP_OPEN;
+ status = smb2_create(tree1, torture, &(io.smb2));
+ CHECK_STATUS(status, NT_STATUS_OK);
+ h1 = io.smb2.out.file.handle;
+
+ /* ask for a change notify,
+ on file or directory name changes */
+ ZERO_STRUCT(notify.smb2);
+ notify.smb2.level = RAW_NOTIFY_SMB2;
+ notify.smb2.in.buffer_size = 1000;
+ notify.smb2.in.completion_filter = FILE_NOTIFY_CHANGE_NAME;
+ notify.smb2.in.file.handle = h1;
+ notify.smb2.in.recursive = true;
+
+ req = smb2_notify_send(tree1, &(notify.smb2));
+
+ WAIT_FOR_ASYNC_RESPONSE(req);
+
+ status = smb2_logoff(tree1->session);
+ CHECK_STATUS(status, NT_STATUS_OK);
+
+ status = smb2_notify_recv(req, torture, &(notify.smb2));
+ CHECK_STATUS(status, STATUS_NOTIFY_CLEANUP);
+ CHECK_VAL(notify.smb2.out.num_changes, 0);
+
+done:
+ smb2_deltree(tree1, BASEDIR_NUL);
+ return ret;
+}
+
+/*
+ basic testing of change notifies followed by a session reconnect
+*/
+
+#define BASEDIR_NSR BASEDIR "_NSR"
+
+static bool torture_smb2_notify_session_reconnect(struct torture_context *torture,
+ struct smb2_tree *tree1)
+{
+ bool ret = true;
+ NTSTATUS status;
+ union smb_notify notify;
+ union smb_open io;
+ struct smb2_handle h1;
+ struct smb2_request *req;
+ uint64_t previous_session_id = 0;
+ struct smb2_session *session2 = NULL;
+
+ smb2_deltree(tree1, BASEDIR_NSR);
+ smb2_util_rmdir(tree1, BASEDIR_NSR);
+
+ torture_comment(torture, "TESTING CHANGE NOTIFY FOLLOWED BY SESSION RECONNECT\n");
+
+ /*
+ get a handle on the directory
+ */
+ ZERO_STRUCT(io.smb2);
+ io.generic.level = RAW_OPEN_SMB2;
+ io.smb2.in.create_flags = 0;
+ io.smb2.in.desired_access = SEC_FILE_ALL;
+ io.smb2.in.create_options = NTCREATEX_OPTIONS_DIRECTORY;
+ io.smb2.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
+ io.smb2.in.share_access = NTCREATEX_SHARE_ACCESS_READ |
+ NTCREATEX_SHARE_ACCESS_WRITE;
+ io.smb2.in.alloc_size = 0;
+ io.smb2.in.create_disposition = NTCREATEX_DISP_CREATE;
+ io.smb2.in.impersonation_level = SMB2_IMPERSONATION_ANONYMOUS;
+ io.smb2.in.security_flags = 0;
+ io.smb2.in.fname = BASEDIR_NSR;
- status = smb2_create(tree2, torture, &(io.smb2));
+ status = smb2_create(tree1, torture, &(io.smb2));
CHECK_STATUS(status, NT_STATUS_OK);
io.smb2.in.create_disposition = NTCREATEX_DISP_OPEN;
- status = smb2_create(tree2, torture, &(io.smb2));
+ status = smb2_create(tree1, torture, &(io.smb2));
CHECK_STATUS(status, NT_STATUS_OK);
h1 = io.smb2.out.file.handle;
req = smb2_notify_send(tree1, &(notify.smb2));
- status = smb2_logoff(tree2->session);
+ WAIT_FOR_ASYNC_RESPONSE(req);
+
+ previous_session_id = smb2cli_session_current_id(tree1->session->smbXcli);
+ torture_assert(torture, torture_smb2_session_setup(torture,
+ tree1->session->transport,
+ previous_session_id,
+ torture, &session2),
+ "session setup with previous_session_id failed");
+
+ status = smb2_notify_recv(req, torture, &(notify.smb2));
+ CHECK_STATUS(status, STATUS_NOTIFY_CLEANUP);
+ CHECK_VAL(notify.smb2.out.num_changes, 0);
+
+ status = smb2_logoff(tree1->session);
+ CHECK_STATUS(status, NT_STATUS_USER_SESSION_DELETED);
+
+ status = smb2_logoff(session2);
CHECK_STATUS(status, NT_STATUS_OK);
+done:
+ smb2_deltree(tree1, BASEDIR_NSR);
+ return ret;
+}
+
+/*
+ basic testing of change notifies followed by an invalid reauth
+*/
+
+#define BASEDIR_IR BASEDIR "_IR"
+
+static bool torture_smb2_notify_invalid_reauth(struct torture_context *torture,
+ struct smb2_tree *tree1,
+ struct smb2_tree *tree2)
+{
+ bool ret = true;
+ NTSTATUS status;
+ union smb_notify notify;
+ union smb_open io;
+ struct smb2_handle h1;
+ struct smb2_request *req;
+ struct cli_credentials *invalid_creds;
+
+ smb2_deltree(tree2, BASEDIR_IR);
+ smb2_util_rmdir(tree2, BASEDIR_IR);
+
+ torture_comment(torture, "TESTING CHANGE NOTIFY FOLLOWED BY invalid REAUTH\n");
+
+ /*
+ get a handle on the directory
+ */
+ ZERO_STRUCT(io.smb2);
+ io.generic.level = RAW_OPEN_SMB2;
+ io.smb2.in.create_flags = 0;
+ io.smb2.in.desired_access = SEC_FILE_ALL;
+ io.smb2.in.create_options = NTCREATEX_OPTIONS_DIRECTORY;
+ io.smb2.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
+ io.smb2.in.share_access = NTCREATEX_SHARE_ACCESS_READ |
+ NTCREATEX_SHARE_ACCESS_WRITE;
+ io.smb2.in.alloc_size = 0;
+ io.smb2.in.create_disposition = NTCREATEX_DISP_CREATE;
+ io.smb2.in.impersonation_level = SMB2_IMPERSONATION_ANONYMOUS;
+ io.smb2.in.security_flags = 0;
+ io.smb2.in.fname = BASEDIR_IR;
+
+ status = smb2_create(tree1, torture, &(io.smb2));
+ CHECK_STATUS(status, NT_STATUS_OK);
+
+ io.smb2.in.create_disposition = NTCREATEX_DISP_OPEN;
+ status = smb2_create(tree1, torture, &(io.smb2));
+ CHECK_STATUS(status, NT_STATUS_OK);
+ h1 = io.smb2.out.file.handle;
+
+ /* ask for a change notify,
+ on file or directory name changes */
+ ZERO_STRUCT(notify.smb2);
+ notify.smb2.level = RAW_NOTIFY_SMB2;
+ notify.smb2.in.buffer_size = 1000;
+ notify.smb2.in.completion_filter = FILE_NOTIFY_CHANGE_NAME;
+ notify.smb2.in.file.handle = h1;
+ notify.smb2.in.recursive = true;
+
+ req = smb2_notify_send(tree1, &(notify.smb2));
+
+ WAIT_FOR_ASYNC_RESPONSE(req);
+
+ invalid_creds = cli_credentials_init(torture);
+ torture_assert(torture, (invalid_creds != NULL), "talloc error");
+ cli_credentials_set_username(invalid_creds, "__none__invalid__none__", CRED_SPECIFIED);
+ cli_credentials_set_domain(invalid_creds, "__none__invalid__none__", CRED_SPECIFIED);
+ cli_credentials_set_password(invalid_creds, "__none__invalid__none__", CRED_SPECIFIED);
+ cli_credentials_set_realm(invalid_creds, NULL, CRED_SPECIFIED);
+ cli_credentials_set_workstation(invalid_creds, "", CRED_UNINITIALISED);
+
+ status = smb2_session_setup_spnego(tree1->session,
+ invalid_creds,
+ 0 /* previous_session_id */);
+ CHECK_STATUS(status, NT_STATUS_LOGON_FAILURE);
status = smb2_notify_recv(req, torture, &(notify.smb2));
+ CHECK_STATUS(status, STATUS_NOTIFY_CLEANUP);
CHECK_VAL(notify.smb2.out.num_changes, 0);
done:
- smb2_deltree(tree1, BASEDIR);
+ smb2_deltree(tree2, BASEDIR_IR);
return ret;
}
basic testing of change notifies followed by tcp disconnect
*/
+#define BASEDIR_NTCPD BASEDIR "_NTCPD"
+
static bool torture_smb2_notify_tcp_disconnect(
struct torture_context *torture,
struct smb2_tree *tree)
struct smb2_handle h1;
struct smb2_request *req;
- smb2_deltree(tree, BASEDIR);
- smb2_util_rmdir(tree, BASEDIR);
+ smb2_deltree(tree, BASEDIR_NTCPD);
+ smb2_util_rmdir(tree, BASEDIR_NTCPD);
torture_comment(torture,
"TESTING CHANGE NOTIFY FOLLOWED BY TCP DISCONNECT\n");
io.smb2.in.create_disposition = NTCREATEX_DISP_OPEN_IF;
io.smb2.in.impersonation_level = SMB2_IMPERSONATION_ANONYMOUS;
io.smb2.in.security_flags = 0;
- io.smb2.in.fname = BASEDIR;
+ io.smb2.in.fname = BASEDIR_NTCPD;
status = smb2_create(tree, torture, &(io.smb2));
CHECK_STATUS(status, NT_STATUS_OK);
notify.smb2.in.recursive = true;
req = smb2_notify_send(tree, &(notify.smb2));
smb2_transport_idle_handler(tree->session->transport,
- tcp_dis_handler, 250, tree);
+ tcp_dis_handler, 250000, tree);
tree = NULL;
status = smb2_notify_recv(req, torture, &(notify.smb2));
CHECK_STATUS(status, NT_STATUS_LOCAL_DISCONNECT);
test setting up two change notify requests on one handle
*/
+#define BASEDIR_NDOH BASEDIR "_NDOH"
+
static bool torture_smb2_notify_double(struct torture_context *torture,
struct smb2_tree *tree1,
struct smb2_tree *tree2)
struct smb2_handle h1;
struct smb2_request *req1, *req2;
- smb2_deltree(tree1, BASEDIR);
- smb2_util_rmdir(tree1, BASEDIR);
+ smb2_deltree(tree1, BASEDIR_NDOH);
+ smb2_util_rmdir(tree1, BASEDIR_NDOH);
torture_comment(torture,
"TESTING CHANGE NOTIFY TWICE ON ONE DIRECTORY\n");
io.smb2.in.create_disposition = NTCREATEX_DISP_CREATE;
io.smb2.in.impersonation_level = SMB2_IMPERSONATION_ANONYMOUS;
io.smb2.in.security_flags = 0;
- io.smb2.in.fname = BASEDIR;
+ io.smb2.in.fname = BASEDIR_NDOH;
status = smb2_create(tree1, torture, &(io.smb2));
CHECK_STATUS(status, NT_STATUS_OK);
status = smb2_notify_recv(req2, torture, &(notify.smb2));
CHECK_STATUS(status, NT_STATUS_CANCELLED);
- smb2_util_mkdir(tree2, BASEDIR "\\subdir-name");
+ smb2_util_mkdir(tree2, BASEDIR_NDOH "\\subdir-name");
req1 = smb2_notify_send(tree1, &(notify.smb2));
req2 = smb2_notify_send(tree1, &(notify.smb2));
CHECK_VAL(notify.smb2.out.num_changes, 1);
CHECK_WIRE_STR(notify.smb2.out.changes[0].name, "subdir-name");
- smb2_util_mkdir(tree2, BASEDIR "\\subdir-name2");
+ smb2_util_mkdir(tree2, BASEDIR_NDOH "\\subdir-name2");
status = smb2_notify_recv(req2, torture, &(notify.smb2));
CHECK_STATUS(status, NT_STATUS_OK);
CHECK_WIRE_STR(notify.smb2.out.changes[0].name, "subdir-name2");
done:
- smb2_deltree(tree1, BASEDIR);
+ smb2_deltree(tree1, BASEDIR_NDOH);
return ret;
}
test multiple change notifies at different depths and with/without recursion
*/
+#define BASEDIR_TREE BASEDIR "_TREE"
+
static bool torture_smb2_notify_tree(struct torture_context *torture,
struct smb2_tree *tree)
{
struct smb2_handle h1;
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 },
+ {
+ .path = BASEDIR_TREE "\\abc",
+ .recursive = true,
+ .filter = FILE_NOTIFY_CHANGE_NAME,
+ .expected = 30,
+ },
+ {
+ .path = BASEDIR_TREE "\\zqy",
+ .recursive = true,
+ .filter = FILE_NOTIFY_CHANGE_NAME,
+ .expected = 8,
+ },
+ {
+ .path = BASEDIR_TREE "\\atsy",
+ .recursive = true,
+ .filter = FILE_NOTIFY_CHANGE_NAME,
+ .expected = 4,
+ },
+ {
+ .path = BASEDIR_TREE "\\abc\\foo",
+ .recursive = true,
+ .filter = FILE_NOTIFY_CHANGE_NAME,
+ .expected = 2,
+ },
+ {
+ .path = BASEDIR_TREE "\\abc\\blah",
+ .recursive = true,
+ .filter = FILE_NOTIFY_CHANGE_NAME,
+ .expected = 13,
+ },
+ {
+ .path = BASEDIR_TREE "\\abc\\blah",
+ .recursive = false,
+ .filter = FILE_NOTIFY_CHANGE_NAME,
+ .expected = 7,
+ },
+ {
+ .path = BASEDIR_TREE "\\abc\\blah\\a",
+ .recursive = true,
+ .filter = FILE_NOTIFY_CHANGE_NAME,
+ .expected = 2,
+ },
+ {
+ .path = BASEDIR_TREE "\\abc\\blah\\b",
+ .recursive = true,
+ .filter = FILE_NOTIFY_CHANGE_NAME,
+ .expected = 2,
+ },
+ {
+ .path = BASEDIR_TREE "\\abc\\blah\\c",
+ .recursive = true,
+ .filter = FILE_NOTIFY_CHANGE_NAME,
+ .expected = 2,
+ },
+ {
+ .path = BASEDIR_TREE "\\abc\\fooblah",
+ .recursive = true,
+ .filter = FILE_NOTIFY_CHANGE_NAME,
+ .expected = 2,
+ },
+ {
+ .path = BASEDIR_TREE "\\zqy\\xx",
+ .recursive = true,
+ .filter = FILE_NOTIFY_CHANGE_NAME,
+ .expected = 2,
+ },
+ {
+ .path = BASEDIR_TREE "\\zqy\\yyy",
+ .recursive = true,
+ .filter = FILE_NOTIFY_CHANGE_NAME,
+ .expected = 2,
+ },
+ {
+ .path = BASEDIR_TREE "\\zqy\\..",
+ .recursive = true,
+ .filter = FILE_NOTIFY_CHANGE_NAME,
+ .expected = 40,
+ },
+ {
+ .path = BASEDIR_TREE,
+ .recursive = true,
+ .filter = FILE_NOTIFY_CHANGE_NAME,
+ .expected = 40,
+ },
+ {
+ .path = BASEDIR_TREE,
+ .recursive = false,
+ .filter = FILE_NOTIFY_CHANGE_NAME,
+ .expected = 6,
+ },
+ {
+ .path = BASEDIR_TREE "\\atsy",
+ .recursive = false,
+ .filter = FILE_NOTIFY_CHANGE_NAME,
+ .expected = 4,
+ },
+ {
+ .path = BASEDIR_TREE "\\abc",
+ .recursive = true,
+ .filter = FILE_NOTIFY_CHANGE_NAME,
+ .expected = 24,
+ },
+ {
+ .path = BASEDIR_TREE "\\abc",
+ .recursive = false,
+ .filter = FILE_NOTIFY_CHANGE_FILE_NAME,
+ .expected = 0,
+ },
+ {
+ .path = BASEDIR_TREE "\\abc",
+ .recursive = true,
+ .filter = FILE_NOTIFY_CHANGE_FILE_NAME,
+ .expected = 0,
+ },
+ {
+ .path = BASEDIR_TREE "\\abc",
+ .recursive = true,
+ .filter = FILE_NOTIFY_CHANGE_NAME,
+ .expected = 24,
+ },
};
int i;
NTSTATUS status;
bool all_done = false;
- smb2_deltree(tree, BASEDIR);
- smb2_util_rmdir(tree, BASEDIR);
+ smb2_deltree(tree, BASEDIR_TREE);
+ smb2_util_rmdir(tree, BASEDIR_TREE);
torture_comment(torture, "TESTING NOTIFY FOR DIFFERENT DEPTHS\n");
io.smb2.in.create_disposition = NTCREATEX_DISP_OPEN_IF;
io.smb2.in.impersonation_level = SMB2_IMPERSONATION_ANONYMOUS;
io.smb2.in.security_flags = 0;
- io.smb2.in.fname = BASEDIR;
+ io.smb2.in.fname = BASEDIR_TREE;
status = smb2_create(tree, torture, &(io.smb2));
CHECK_STATUS(status, NT_STATUS_OK);
talloc_free(path);
}
- /* give a bit of time for the events to propogate */
+ /* give a bit of time for the events to propagate */
tv = timeval_current();
do {
/* count events that have happened in each dir */
for (i=0;i<ARRAY_SIZE(dirs);i++) {
+ notify.smb2.in.completion_filter = dirs[i].filter;
notify.smb2.in.file.handle = dirs[i].h1;
+ notify.smb2.in.recursive = dirs[i].recursive;
req = smb2_notify_send(tree, &(notify.smb2));
smb2_cancel(req);
notify.smb2.out.num_changes = 0;
}
} while (!all_done && timeval_elapsed(&tv) < 20);
- torture_comment(torture, "took %.4f seconds to propogate all events\n",
+ torture_comment(torture, "took %.4f seconds to propagate all events\n",
timeval_elapsed(&tv));
for (i=0;i<ARRAY_SIZE(dirs);i++) {
}
done:
- smb2_deltree(tree, BASEDIR);
- smb2_util_rmdir(tree, BASEDIR);
+ smb2_deltree(tree, BASEDIR_TREE);
+ smb2_util_rmdir(tree, BASEDIR_TREE);
return ret;
}
packet size.
*/
+#define BASEDIR_OVF BASEDIR "_OVF"
+
static bool torture_smb2_notify_overflow(struct torture_context *torture,
struct smb2_tree *tree)
{
struct smb2_request *req1;
int i;
- smb2_deltree(tree, BASEDIR);
- smb2_util_rmdir(tree, BASEDIR);
+ smb2_deltree(tree, BASEDIR_OVF);
+ smb2_util_rmdir(tree, BASEDIR_OVF);
torture_comment(torture, "TESTING CHANGE NOTIFY EVENT OVERFLOW\n");
io.smb2.in.create_disposition = NTCREATEX_DISP_CREATE;
io.smb2.in.impersonation_level = SMB2_IMPERSONATION_ANONYMOUS;
io.smb2.in.security_flags = 0;
- io.smb2.in.fname = BASEDIR;
+ io.smb2.in.fname = BASEDIR_OVF;
status = smb2_create(tree, torture, &(io.smb2));
CHECK_STATUS(status, NT_STATUS_OK);
for (i=0;i<count;i++) {
char *fname = talloc_asprintf(torture,
- BASEDIR "\\test%d.txt", i);
+ BASEDIR_OVF "\\test%d.txt", i);
union smb_open io1;
ZERO_STRUCT(io1.smb2);
io1.generic.level = RAW_OPEN_SMB2;
CHECK_VAL(notify.smb2.out.num_changes, 0);
done:
- smb2_deltree(tree, BASEDIR);
+ smb2_deltree(tree, BASEDIR_OVF);
return ret;
}
They shouldn't be.
*/
+#define BASEDIR_BAS BASEDIR "_BAS"
+
static bool torture_smb2_notify_basedir(struct torture_context *torture,
struct smb2_tree *tree1,
struct smb2_tree *tree2)
struct smb2_handle h1;
struct smb2_request *req1;
- smb2_deltree(tree1, BASEDIR);
- smb2_util_rmdir(tree1, BASEDIR);
+ smb2_deltree(tree1, BASEDIR_BAS);
+ smb2_util_rmdir(tree1, BASEDIR_BAS);
torture_comment(torture, "TESTING CHANGE NOTIFY BASEDIR EVENTS\n");
io.smb2.in.create_disposition = NTCREATEX_DISP_OPEN_IF;
io.smb2.in.impersonation_level = NTCREATEX_IMPERSONATION_ANONYMOUS;
io.smb2.in.security_flags = 0;
- io.smb2.in.fname = BASEDIR;
+ io.smb2.in.fname = BASEDIR_BAS;
status = smb2_create(tree1, torture, &(io.smb2));
CHECK_STATUS(status, NT_STATUS_OK);
h1 = io.smb2.out.file.handle;
/* create a test file that will also be modified */
- io.smb2.in.fname = BASEDIR "\\tname1";
+ io.smb2.in.fname = BASEDIR_BAS "\\tname1";
io.smb2.in.create_options = NTCREATEX_OPTIONS_NON_DIRECTORY_FILE;
status = smb2_create(tree2, torture, &(io.smb2));
CHECK_STATUS(status,NT_STATUS_OK);
req1 = smb2_notify_send(tree1, &(notify.smb2));
/* set attribute on the base dir */
- smb2_util_setatr(tree2, BASEDIR, FILE_ATTRIBUTE_HIDDEN);
+ smb2_util_setatr(tree2, BASEDIR_BAS, FILE_ATTRIBUTE_HIDDEN);
/* set attribute on a file to assure we receive a notification */
- smb2_util_setatr(tree2, BASEDIR "\\tname1", FILE_ATTRIBUTE_HIDDEN);
+ smb2_util_setatr(tree2, BASEDIR_BAS "\\tname1", FILE_ATTRIBUTE_HIDDEN);
smb_msleep(200);
/* check how many responses were given, expect only 1 for the file */
CHECK_WIRE_STR(notify.smb2.out.changes[0].name, "tname1");
done:
- smb2_deltree(tree1, BASEDIR);
+ smb2_deltree(tree1, BASEDIR_BAS);
return ret;
}
-
/*
- create a secondary tree connect - used to test for a bug in Samba3 messaging
- with change notify
+ very simple change notify test
*/
-static struct smb2_tree *secondary_tcon(struct smb2_tree *tree,
- struct torture_context *tctx)
-{
- NTSTATUS status;
- const char *share, *host;
- struct smb2_tree *tree1;
- union smb_tcon tcon;
-
- share = torture_setting_string(tctx, "share", NULL);
- host = torture_setting_string(tctx, "host", NULL);
-
- torture_comment(tctx,
- "create a second tree context on the same session\n");
- tree1 = smb2_tree_init(tree->session, tctx, false);
- if (tree1 == NULL) {
- torture_comment(tctx, "Out of memory\n");
- return NULL;
- }
-
- ZERO_STRUCT(tcon.smb2);
- tcon.generic.level = RAW_TCON_SMB2;
- tcon.smb2.in.path = talloc_asprintf(tctx, "\\\\%s\\%s", host, share);
- status = smb2_tree_connect(tree->session, &(tcon.smb2));
- if (!NT_STATUS_IS_OK(status)) {
- talloc_free(tree1);
- torture_comment(tctx,"Failed to create secondary tree\n");
- return NULL;
- }
-
- smb2cli_tcon_set_values(tree1->smbXcli,
- tree1->session->smbXcli,
- tcon.smb2.out.tid,
- tcon.smb2.out.share_type,
- tcon.smb2.out.flags,
- tcon.smb2.out.capabilities,
- tcon.smb2.out.access_mask);
-
- torture_comment(tctx,"tid1=%d tid2=%d\n",
- smb2cli_tcon_current_id(tree->smbXcli),
- smb2cli_tcon_current_id(tree1->smbXcli));
-
- return tree1;
-}
+#define BASEDIR_TCON BASEDIR "_TCON"
-/*
- very simple change notify test
-*/
static bool torture_smb2_notify_tcon(struct torture_context *torture,
struct smb2_tree *tree)
{
NTSTATUS status;
union smb_notify notify;
union smb_open io;
- struct smb2_handle h1;
+ struct smb2_handle h1 = {{0}};
struct smb2_request *req = NULL;
struct smb2_tree *tree1 = NULL;
- const char *fname = BASEDIR "\\subdir-name";
+ const char *fname = BASEDIR_TCON "\\subdir-name";
- smb2_deltree(tree, BASEDIR);
- smb2_util_rmdir(tree, BASEDIR);
+ smb2_deltree(tree, BASEDIR_TCON);
+ smb2_util_rmdir(tree, BASEDIR_TCON);
torture_comment(torture, "TESTING SIMPLE CHANGE NOTIFY\n");
io.smb2.in.create_disposition = NTCREATEX_DISP_OPEN_IF;
io.smb2.in.impersonation_level = SMB2_IMPERSONATION_ANONYMOUS;
io.smb2.in.security_flags = 0;
- io.smb2.in.fname = BASEDIR;
+ io.smb2.in.fname = BASEDIR_TCON;
status = smb2_create(tree, torture, &(io.smb2));
CHECK_STATUS(status, NT_STATUS_OK);
torture_comment(torture, "SIMPLE CHANGE NOTIFY OK\n");
torture_comment(torture, "TESTING WITH SECONDARY TCON\n");
- tree1 = secondary_tcon(tree, torture);
+ if (!torture_smb2_tree_connect(torture, tree->session, tree, &tree1)) {
+ torture_warning(torture, "couldn't reconnect to share, bailing\n");
+ ret = false;
+ goto done;
+ }
+
+ torture_comment(torture, "tid1=%d tid2=%d\n",
+ smb2cli_tcon_current_id(tree->smbXcli),
+ smb2cli_tcon_current_id(tree1->smbXcli));
torture_comment(torture, "Testing notify mkdir\n");
req = smb2_notify_send(tree, &(notify.smb2));
torture_comment(torture, "CHANGE NOTIFY WITH TDIS OK\n");
done:
smb2_util_close(tree, h1);
- smb2_deltree(tree, BASEDIR);
+ smb2_deltree(tree, BASEDIR_TCON);
return ret;
}
+#define BASEDIR_RMD BASEDIR "_RMD"
+
+static bool torture_smb2_notify_rmdir(struct torture_context *torture,
+ struct smb2_tree *tree1,
+ struct smb2_tree *tree2,
+ bool initial_delete_on_close)
+{
+ bool ret = true;
+ NTSTATUS status;
+ union smb_notify notify = {};
+ union smb_setfileinfo sfinfo = {};
+ union smb_open io = {};
+ struct smb2_handle h = {};
+ struct smb2_request *req;
+
+ torture_comment(torture, "TESTING NOTIFY CANCEL FOR DELETED DIR\n");
+
+ smb2_deltree(tree1, BASEDIR_RMD);
+ smb2_util_rmdir(tree1, BASEDIR_RMD);
+
+ ZERO_STRUCT(io.smb2);
+ io.generic.level = RAW_OPEN_SMB2;
+ io.smb2.in.create_flags = 0;
+ io.smb2.in.desired_access = SEC_FILE_ALL;
+ io.smb2.in.create_options = NTCREATEX_OPTIONS_DIRECTORY;
+ io.smb2.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
+ io.smb2.in.share_access =
+ NTCREATEX_SHARE_ACCESS_READ |
+ NTCREATEX_SHARE_ACCESS_WRITE |
+ NTCREATEX_SHARE_ACCESS_DELETE ;
+ io.smb2.in.alloc_size = 0;
+ io.smb2.in.create_disposition = NTCREATEX_DISP_CREATE;
+ io.smb2.in.impersonation_level = SMB2_IMPERSONATION_ANONYMOUS;
+ io.smb2.in.security_flags = 0;
+ io.smb2.in.fname = BASEDIR_RMD;
+
+ status = smb2_create(tree1, torture, &(io.smb2));
+ CHECK_STATUS(status, NT_STATUS_OK);
+ h = io.smb2.out.file.handle;
+
+ ZERO_STRUCT(notify.smb2);
+ notify.smb2.level = RAW_NOTIFY_SMB2;
+ notify.smb2.in.buffer_size = 1000;
+ notify.smb2.in.completion_filter = FILE_NOTIFY_CHANGE_NAME;
+ notify.smb2.in.file.handle = h;
+ notify.smb2.in.recursive = false;
+
+ io.smb2.in.desired_access |= SEC_STD_DELETE;
+ io.smb2.in.create_disposition = NTCREATEX_DISP_OPEN;
+ req = smb2_notify_send(tree1, &(notify.smb2));
+
+ if (initial_delete_on_close) {
+ status = smb2_util_rmdir(tree2, BASEDIR_RMD);
+ CHECK_STATUS(status, NT_STATUS_OK);
+ } else {
+ status = smb2_create(tree2, torture, &(io.smb2));
+ CHECK_STATUS(status, NT_STATUS_OK);
+
+ sfinfo.generic.level = RAW_SFILEINFO_DISPOSITION_INFORMATION;
+ sfinfo.generic.in.file.handle = io.smb2.out.file.handle;
+ sfinfo.disposition_info.in.delete_on_close = 1;
+ status = smb2_setinfo_file(tree2, &sfinfo);
+ CHECK_STATUS(status, NT_STATUS_OK);
+
+ smb2_util_close(tree2, io.smb2.out.file.handle);
+ }
+
+ status = smb2_notify_recv(req, torture, &(notify.smb2));
+ CHECK_STATUS(status, NT_STATUS_DELETE_PENDING);
+
+done:
+
+ smb2_util_close(tree1, h);
+ smb2_deltree(tree1, BASEDIR_RMD);
+
+ return ret;
+}
+
+static bool torture_smb2_notify_rmdir1(struct torture_context *torture,
+ struct smb2_tree *tree)
+{
+ return torture_smb2_notify_rmdir(torture, tree, tree, false);
+}
+
+static bool torture_smb2_notify_rmdir2(struct torture_context *torture,
+ struct smb2_tree *tree)
+{
+ return torture_smb2_notify_rmdir(torture, tree, tree, true);
+}
+
+static bool torture_smb2_notify_rmdir3(struct torture_context *torture,
+ struct smb2_tree *tree1,
+ struct smb2_tree *tree2)
+{
+ return torture_smb2_notify_rmdir(torture, tree1, tree2, false);
+}
+
+static bool torture_smb2_notify_rmdir4(struct torture_context *torture,
+ struct smb2_tree *tree1,
+ struct smb2_tree *tree2)
+{
+ return torture_smb2_notify_rmdir(torture, tree1, tree2, true);
+}
+
+static void notify_timeout(struct tevent_context *ev,
+ struct tevent_timer *te,
+ struct timeval current_time,
+ void *private_data)
+{
+ struct smb2_request *req = talloc_get_type_abort(
+ private_data, struct smb2_request);
+
+ smb2_cancel(req);
+}
+
+#define BASEDIR_INR BASEDIR "_INR"
+
+static bool torture_smb2_inotify_rename(struct torture_context *torture,
+ struct smb2_tree *tree1,
+ struct smb2_tree *tree2)
+{
+ NTSTATUS status;
+ struct smb2_notify notify;
+ struct notify_changes change1 = {0};
+ struct notify_changes change2 = {0};
+ struct smb2_create create;
+ union smb_setfileinfo sinfo;
+ struct smb2_handle h1 = {{0}};
+ struct smb2_handle h2 = {{0}};
+ struct smb2_request *req;
+ struct tevent_timer *te = NULL;
+ bool ok = false;
+
+ smb2_deltree(tree1, BASEDIR_INR);
+
+ torture_comment(torture, "Testing change notify of a rename with inotify\n");
+
+ status = torture_smb2_testdir(tree1, BASEDIR_INR, &h1);
+ torture_assert_ntstatus_ok_goto(torture, status, ok, done, "torture_smb2_testdir failed");
+
+ ZERO_STRUCT(create);
+ create.in.desired_access = SEC_RIGHTS_FILE_READ |
+ SEC_RIGHTS_FILE_WRITE|
+ SEC_RIGHTS_FILE_ALL;
+ create.in.create_options = NTCREATEX_OPTIONS_DIRECTORY;
+ create.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
+ create.in.share_access = NTCREATEX_SHARE_ACCESS_READ |
+ NTCREATEX_SHARE_ACCESS_WRITE |
+ NTCREATEX_SHARE_ACCESS_DELETE;
+ create.in.create_disposition = NTCREATEX_DISP_OPEN_IF;
+ create.in.impersonation_level = SMB2_IMPERSONATION_ANONYMOUS;
+ create.in.fname = BASEDIR_INR "\\subdir-name";
+
+ status = smb2_create(tree2, torture, &create);
+ torture_assert_ntstatus_ok_goto(torture, status, ok, done, "smb2_create failed\n");
+ h2 = create.out.file.handle;
+
+ ZERO_STRUCT(notify);
+ notify.level = RAW_NOTIFY_SMB2;
+ notify.in.buffer_size = 4096;
+ notify.in.completion_filter = FILE_NOTIFY_CHANGE_NAME;
+ notify.in.file.handle = h1;
+ notify.in.recursive = true;
+ req = smb2_notify_send(tree1, ¬ify);
+ torture_assert_not_null_goto(torture, req, ok, done, "smb2_notify_send failed\n");
+
+ while (!NT_STATUS_EQUAL(req->status, STATUS_PENDING)) {
+ if (tevent_loop_once(torture->ev) != 0) {
+ goto done;
+ }
+ }
+
+ ZERO_STRUCT(sinfo);
+ sinfo.rename_information.level = RAW_SFILEINFO_RENAME_INFORMATION;
+ sinfo.rename_information.in.file.handle = h2;
+ sinfo.rename_information.in.new_name = BASEDIR_INR "\\subdir-name-r";
+
+ status = smb2_setinfo_file(tree2, &sinfo);
+ torture_assert_ntstatus_ok_goto(torture, status, ok, done, "smb2_setinfo_file failed\n");
+
+ smb2_util_close(tree2, h2);
+
+ te = tevent_add_timer(torture->ev,
+ tree1,
+ tevent_timeval_current_ofs(1, 0),
+ notify_timeout,
+ req);
+ torture_assert_not_null_goto(torture, te, ok, done, "tevent_add_timer failed\n");
+
+ status = smb2_notify_recv(req, torture, ¬ify);
+ torture_assert_ntstatus_ok_goto(torture, status, ok, done, "smb2_notify_recv failed\n");
+
+ torture_assert_goto(torture, notify.out.num_changes == 1 || notify.out.num_changes == 2,
+ ok, done, "bad notify\n");
+
+ change1 = notify.out.changes[0];
+ if (notify.out.num_changes == 2) {
+ change2 = notify.out.changes[1];
+ } else {
+ /*
+ * We may only get one event at a time, so check for the
+ * matching second event for the oldname/newname or
+ * removed/added pair.
+ */
+ ZERO_STRUCT(notify);
+ notify.level = RAW_NOTIFY_SMB2;
+ notify.in.buffer_size = 4096;
+ notify.in.completion_filter = FILE_NOTIFY_CHANGE_NAME;
+ notify.in.file.handle = h1;
+ notify.in.recursive = true;
+ req = smb2_notify_send(tree1, ¬ify);
+ torture_assert_not_null_goto(torture, req, ok, done, "smb2_notify_send failed\n");
+
+ status = smb2_notify_recv(req, torture, ¬ify);
+ torture_assert_ntstatus_ok_goto(torture, status, ok, done, "smb2_notify_recv failed\n");
+
+ torture_assert_goto(torture, notify.out.num_changes == 1, ok, done,
+ "bad notify\n");
+
+ change2 = notify.out.changes[0];
+ }
+
+ if ((change1.action != NOTIFY_ACTION_OLD_NAME) &&
+ (change1.action != NOTIFY_ACTION_REMOVED))
+ {
+ torture_fail_goto(torture, done, "bad change notification\n");
+ }
+ torture_assert_str_equal_goto(torture, change1.name.s, "subdir-name",
+ ok, done, "bad change notification\n");
+
+ if ((change2.action != NOTIFY_ACTION_NEW_NAME) &&
+ (change2.action != NOTIFY_ACTION_ADDED))
+ {
+ torture_fail_goto(torture, done, "bad change notification\n");
+ }
+ torture_assert_str_equal_goto(torture, change2.name.s, "subdir-name-r",
+ ok, done, "bad change notification\n");
+
+ ok = true;
+done:
+ if (!smb2_util_handle_empty(h1)) {
+ smb2_util_close(tree1, h1);
+ }
+ if (!smb2_util_handle_empty(h2)) {
+ smb2_util_close(tree2, h2);
+ }
+
+ smb2_deltree(tree1, BASEDIR_INR);
+ return ok;
+}
+
/*
basic testing of SMB2 change notify
*/
-struct torture_suite *torture_smb2_notify_init(void)
+struct torture_suite *torture_smb2_notify_init(TALLOC_CTX *ctx)
{
- struct torture_suite *suite = torture_suite_create(talloc_autofree_context(), "notify");
+ struct torture_suite *suite = torture_suite_create(ctx, "notify");
torture_suite_add_1smb2_test(suite, "valid-req", test_valid_request);
torture_suite_add_1smb2_test(suite, "tcon", torture_smb2_notify_tcon);
torture_suite_add_2smb2_test(suite, "dir", torture_smb2_notify_dir);
torture_suite_add_2smb2_test(suite, "mask", torture_smb2_notify_mask);
torture_suite_add_1smb2_test(suite, "tdis", torture_smb2_notify_tree_disconnect);
+ torture_suite_add_1smb2_test(suite, "tdis1", torture_smb2_notify_tree_disconnect_1);
torture_suite_add_2smb2_test(suite, "mask-change", torture_smb2_notify_mask_change);
- torture_suite_add_2smb2_test(suite, "logoff", torture_smb2_notify_ulogoff);
+ torture_suite_add_1smb2_test(suite, "close", torture_smb2_notify_close);
+ torture_suite_add_1smb2_test(suite, "logoff", torture_smb2_notify_ulogoff);
+ torture_suite_add_1smb2_test(suite, "session-reconnect", torture_smb2_notify_session_reconnect);
+ torture_suite_add_2smb2_test(suite, "invalid-reauth", torture_smb2_notify_invalid_reauth);
torture_suite_add_1smb2_test(suite, "tree", torture_smb2_notify_tree);
torture_suite_add_2smb2_test(suite, "basedir", torture_smb2_notify_basedir);
torture_suite_add_2smb2_test(suite, "double", torture_smb2_notify_double);
torture_suite_add_1smb2_test(suite, "tcp", torture_smb2_notify_tcp_disconnect);
torture_suite_add_2smb2_test(suite, "rec", torture_smb2_notify_recursive);
torture_suite_add_1smb2_test(suite, "overflow", torture_smb2_notify_overflow);
+ torture_suite_add_1smb2_test(suite, "rmdir1",
+ torture_smb2_notify_rmdir1);
+ torture_suite_add_1smb2_test(suite, "rmdir2",
+ torture_smb2_notify_rmdir2);
+ torture_suite_add_2smb2_test(suite, "rmdir3",
+ torture_smb2_notify_rmdir3);
+ torture_suite_add_2smb2_test(suite, "rmdir4",
+ torture_smb2_notify_rmdir4);
suite->description = talloc_strdup(suite, "SMB2-NOTIFY tests");
return suite;
}
+/*
+ basic testing of SMB2 change notify
+*/
+struct torture_suite *torture_smb2_notify_inotify_init(TALLOC_CTX *ctx)
+{
+ struct torture_suite *suite = torture_suite_create(ctx, "notify-inotify");
+
+ suite->description = talloc_strdup(suite, "SMB2-NOTIFY tests that use inotify");
+
+ torture_suite_add_2smb2_test(suite, "inotify-rename", torture_smb2_inotify_rename);
+
+ return suite;
+}