]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbtorture3: also check test file and it's attributes in two POSIX tests
authorRalph Boehme <slow@samba.org>
Fri, 3 Nov 2023 10:09:47 +0000 (11:09 +0100)
committerJeremy Allison <jra@samba.org>
Sun, 5 Nov 2023 18:34:38 +0000 (18:34 +0000)
Verifies that the correct DOS attribute, FILE_ATTRIBUTE_ARCHIVE in this case,
are returned over SMB1 with UNIX extensions.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/torture/test_posix.c

index 28198451166514ddcbd1000ad82f7863a79027a7..ac4c1a1cb34c22a37f0ffc610963f15c240eaad4 100644 (file)
@@ -134,6 +134,12 @@ bool run_posix_ls_wildcard_test(int dummy)
        const char *symlnk_dst_outside_share = "/etc/passwd";
        struct posix_test_entry entries[] = {
                {
+                       .name = file,
+                       .target = NULL,
+                       .expected = file,
+                       .attr_win = FILE_ATTRIBUTE_ARCHIVE,
+                       .attr_lin = FILE_ATTRIBUTE_ARCHIVE,
+               }, {
                        .name = symlnk_dangling,
                        .target = symlnk_dst_dangling,
                        .expected = symlnk_dangling,
@@ -210,6 +216,9 @@ bool run_posix_ls_wildcard_test(int dummy)
        fnum = (uint16_t)-1;
 
        for (i = 0; entries[i].name != NULL; i++) {
+               if (entries[i].target == NULL) {
+                       continue;
+               }
                status = cli_posix_symlink(cli_unix,
                                           entries[i].target,
                                           entries[i].name);
@@ -229,6 +238,9 @@ bool run_posix_ls_wildcard_test(int dummy)
                goto out;
        }
 
+       if (!posix_test_entry_check(state, file, true, 0)) {
+               goto out;
+       }
        if (!posix_test_entry_check(state, symlnk_dangling, false, 0)) {
                goto out;
        }
@@ -250,6 +262,9 @@ bool run_posix_ls_wildcard_test(int dummy)
                goto out;
        }
 
+       if (!posix_test_entry_check(state, file, true, 0)) {
+               goto out;
+       }
        if (!posix_test_entry_check(state,
                                    symlnk_dangling,
                                    true,
@@ -310,6 +325,12 @@ bool run_posix_ls_single_test(int dummy)
        const char *symlnk_dst_outside_share = "/etc/passwd";
        struct posix_test_entry entries[] = {
                {
+                       .name = file,
+                       .target = NULL,
+                       .expected = file,
+                       .attr_win = FILE_ATTRIBUTE_ARCHIVE,
+                       .attr_lin = FILE_ATTRIBUTE_ARCHIVE,
+               }, {
                        .name = symlnk_dangling,
                        .target = symlnk_dst_dangling,
                        .expected = symlnk_dangling,
@@ -412,6 +433,9 @@ bool run_posix_ls_single_test(int dummy)
        fnum = (uint16_t)-1;
 
        for (i = 0; entries[i].name != NULL; i++) {
+               if (entries[i].target == NULL) {
+                       continue;
+               }
                status = cli_posix_symlink(cli_unix,
                                           entries[i].target,
                                           entries[i].name);
@@ -425,10 +449,14 @@ bool run_posix_ls_single_test(int dummy)
        printf("Doing Windows ls single\n");
        state->flavour = WINDOWS;
 
+       cli_list(cli_win, file, 0, posix_ls_fn, state);
        cli_list(cli_win, symlnk_dangling, 0, posix_ls_fn, state);
        cli_list(cli_win, symlnk_outside_share, 0, posix_ls_fn, state);
        cli_list(cli_win, symlnk_in_share, 0, posix_ls_fn, state);
 
+       if (!posix_test_entry_check(state, file, true, 0)) {
+               goto out;
+       }
        if (!posix_test_entry_check(state, symlnk_dangling, false, 0)) {
                goto out;
        }
@@ -444,10 +472,14 @@ bool run_posix_ls_single_test(int dummy)
        printf("Doing POSIX ls single\n");
        state->flavour = LINUX;
 
+       cli_list(cli_unix, file, 0, posix_ls_fn, state);
        cli_list(cli_unix, symlnk_dangling, 0, posix_ls_fn, state);
        cli_list(cli_unix, symlnk_outside_share, 0, posix_ls_fn, state);
        cli_list(cli_unix, symlnk_in_share, 0, posix_ls_fn, state);
 
+       if (!posix_test_entry_check(state, file, true, 0)) {
+               goto out;
+       }
        if (!posix_test_entry_check(state,
                                    symlnk_dangling,
                                    true,