Test that POSIX open of a directory returns NT_STATUS_FILE_IS_A_DIRECTORY (ERRDOS...
authorJeremy Allison <jra@samba.org>
Fri, 22 May 2009 22:56:46 +0000 (15:56 -0700)
committerKarolin Seeger <kseeger@samba.org>
Tue, 26 May 2009 07:39:47 +0000 (09:39 +0200)
Jeremy.
(cherry picked from commit 935a1a89c6c027e068f79e3686396c28812f9e67)

source3/torture/torture.c

index 1f099da8bb75f5f590fcd22a7f868ae9d946b14d..b9c3e340c4c7955ef371e7aec9bf969b15100447 100644 (file)
@@ -4239,6 +4239,18 @@ static bool run_simple_posix_open_test(int dummy)
                goto out;
        }
 
+       /* What happens when we try and POSIX open a directory ? */
+       fnum1 = cli_posix_open(cli1, dname, O_RDONLY, 0);
+       if (fnum1 != -1) {
+               printf("POSIX open of directory %s succeeded, should have failed.\n", fname);
+               goto out;
+       } else {
+               if (!check_error(__LINE__, cli1, ERRDOS, EISDIR,
+                               NT_STATUS_FILE_IS_A_DIRECTORY)) {
+                       goto out;
+               }
+       }
+
        if (!cli_posix_rmdir(cli1, dname)) {
                printf("POSIX rmdir failed (%s)\n", cli_errstr(cli1));
                goto out;