Fix error code when smbclient puts a file over an existing directory
authorVolker Lendecke <vl@sernet.de>
Fri, 12 Dec 2008 12:47:41 +0000 (13:47 +0100)
committerKarolin Seeger <kseeger@samba.org>
Fri, 12 Dec 2008 16:56:41 +0000 (17:56 +0100)
Windows returns NT_STATUS_FILE_IS_A_DIRECTORY, as does Samba 3.0. 3.2 and
following returned NT_STATUS_INVALID_PARAMETER which is wrong.

Before I converted reply_open_and_X to create_file() we called
open_file_ntcreate directly. Passing through open&X for a filename that exists
as a directory ends up in open_directory after having tried open_file_ntcreate.
Some check in there returns NT_STATUS_INVALID_PARAMETER. With this additional
FILE_NON_DIRECTORY_FILE flag we get the correct error message back from
create_file_unixpath before trying open_directory().

Survives make test, but as this also touches the other open variants I would
like others to review this.

Volker

source3/smbd/open.c

index 77ad1664ef0300bed60937163145fe44c0279553..1e988f65ec6a22ab49023d6b40411e3d1805713f 100644 (file)
@@ -1048,7 +1048,7 @@ bool map_open_params_to_ntcreate(const char *fname, int deny_mode, int open_func
        uint32 access_mask;
        uint32 share_mode;
        uint32 create_disposition;
-       uint32 create_options = 0;
+       uint32 create_options = FILE_NON_DIRECTORY_FILE;
 
        DEBUG(10,("map_open_params_to_ntcreate: fname = %s, deny_mode = 0x%x, "
                  "open_func = 0x%x\n",