r20618: Fix a bug in bad_path handling that also exists in 3.0.23: For reply_unlink
authorVolker Lendecke <vlendec@samba.org>
Mon, 8 Jan 2007 21:08:31 +0000 (21:08 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 19:37:15 +0000 (14:37 -0500)
under Linux we returned NT_STATUS_NOT_A_DIRECTORY. This is because in the
bad_path==True condition lstat(2) returns ENOTDIR and not ENOENT.

Not sure if we want to necessarily replicate the INVALID_PARAMETER here, but
this is what W2k3 does.

Jeremy, I tried to call you, but you were not around. So I'll leave it up to
you to merge this.

Volker
(This used to be commit 838afa8f7d2b10460725c1f0b519ce54fb84de88)

source4/torture/raw/samba3misc.c

index 66462ca5b17a744f2734906f72f804aa0f92be33..695abfbb8ac5506fa842e25c37a2d9952954af9e 100644 (file)
@@ -496,6 +496,22 @@ BOOL torture_samba3_badpath(struct torture_context *torture)
        status = smbcli_setatr(cli_dos->tree, invname, 0, 0);
        CHECK_STATUS(status, NT_STATUS_DOS(ERRDOS, ERRbadfile));
 
+       status = smbcli_unlink(cli_nt->tree, invpath);
+       CHECK_STATUS(status, NT_STATUS_OBJECT_PATH_NOT_FOUND);
+       status = smbcli_unlink(cli_dos->tree, invpath);
+       CHECK_STATUS(status, NT_STATUS_DOS(ERRDOS, ERRbadpath));
+
+       /*
+        * W2k3 returns INVALID_PARAMETER for a wildcard unlink if the
+        * directory does not exist. They seem to use the t2ffirst, this also
+        * returns INVALID_PARAMETER under this condition.
+        */
+
+       status = smbcli_unlink(cli_nt->tree, "test.txt\\*.*");
+       CHECK_STATUS(status, NT_STATUS_INVALID_PARAMETER);
+       status = smbcli_unlink(cli_dos->tree, "test.txt\\*.*");
+       CHECK_STATUS(status, NT_STATUS_DOS(ERRDOS, ERRinvalidparam));
+
        /*
         * reply_search returns STATUS_NO_MORE_FILES on invalid path
         */
@@ -622,11 +638,6 @@ BOOL torture_samba3_badpath(struct torture_context *torture)
 #endif
        }
 
-       status = smbcli_unlink(cli_nt->tree, invpath);
-       CHECK_STATUS(status, NT_STATUS_OBJECT_PATH_NOT_FOUND);
-       status = smbcli_unlink(cli_dos->tree, invpath);
-       CHECK_STATUS(status, NT_STATUS_DOS(ERRDOS, ERRbadpath));
-
        status = smbcli_mkdir(cli_nt->tree, invpath);
        CHECK_STATUS(status, NT_STATUS_OBJECT_PATH_NOT_FOUND);
        status = smbcli_mkdir(cli_dos->tree, invpath);