summaryrefslogtreecommitdiff
path: root/source3/torture/test_smb2.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2021-07-14 15:29:01 -0700
committerRalph Boehme <slow@samba.org>2021-07-15 05:02:30 +0000
commit8f8d0eaad68620561eb5bdc95fbb855b90f31fc5 (patch)
tree093785a177bdfa2b434c8231b309200f11bec9bb /source3/torture/test_smb2.c
parent6e7ffa8da34b85ac27396ee3fe29afb5db534e9e (diff)
downloadsamba-8f8d0eaad68620561eb5bdc95fbb855b90f31fc5.tar.gz
s3: tests: Add "SMB2-LIST-DIR-ASYNC" test.
Add as knownfail. Shows our "smbd async dosmode" code wasn't working. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14758 Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
Diffstat (limited to 'source3/torture/test_smb2.c')
-rw-r--r--source3/torture/test_smb2.c84
1 files changed, 84 insertions, 0 deletions
diff --git a/source3/torture/test_smb2.c b/source3/torture/test_smb2.c
index c7fcb3994ba..b186ea4edac 100644
--- a/source3/torture/test_smb2.c
+++ b/source3/torture/test_smb2.c
@@ -3144,3 +3144,87 @@ bool run_smb2_stream_acl(int dummy)
(void)cli_unlink(cli, fname, 0);
return ret;
}
+
+static NTSTATUS list_fn(struct file_info *finfo,
+ const char *name,
+ void *state)
+{
+ bool *matched = (bool *)state;
+ if (finfo->attr & FILE_ATTRIBUTE_DIRECTORY) {
+ *matched = true;
+ }
+ return NT_STATUS_OK;
+}
+
+/*
+ * Must be run against a share with "smbd async dosmode = yes".
+ * Checks we can return DOS attriutes other than "N".
+ * BUG: https://bugzilla.samba.org/show_bug.cgi?id=14758
+ */
+
+bool run_list_dir_async_test(int dummy)
+{
+ struct cli_state *cli = NULL;
+ NTSTATUS status;
+ const char *dname = "ASYNC_DIR";
+ bool ret = false;
+ bool matched = false;
+
+ printf("SMB2 list dir async\n");
+
+ if (!torture_init_connection(&cli)) {
+ return false;
+ }
+
+ status = smbXcli_negprot(cli->conn,
+ cli->timeout,
+ PROTOCOL_SMB2_02,
+ PROTOCOL_SMB3_11);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("smbXcli_negprot returned %s\n", nt_errstr(status));
+ return false;
+ }
+
+ status = cli_session_setup_creds(cli, torture_creds);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("cli_session_setup returned %s\n", nt_errstr(status));
+ return false;
+ }
+
+ status = cli_tree_connect(cli, share, "?????", NULL);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("cli_tree_connect returned %s\n", nt_errstr(status));
+ return false;
+ }
+
+ /* Ensure directory doesn't exist. */
+ (void)cli_rmdir(cli, dname);
+
+ status = cli_mkdir(cli, dname);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("cli_mkdir %s returned %s\n", dname, nt_errstr(status));
+ return false;
+ }
+
+ status = cli_list(cli,
+ dname,
+ FILE_ATTRIBUTE_NORMAL|FILE_ATTRIBUTE_DIRECTORY,
+ list_fn,
+ &matched);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("cli_list %s returned %s\n", dname, nt_errstr(status));
+ goto fail;
+ }
+
+ if (!matched) {
+ printf("Failed to find %s\n", dname);
+ goto fail;
+ }
+
+ ret = true;
+
+ fail:
+
+ (void)cli_rmdir(cli, dname);
+ return ret;
+}