s3: libsmbclient: Work around bugs in SLES cifsd and Apple smbx SMB1 servers.
commitb42fb61476413b8a075647b33f967bb3fb992d20
authorJeremy Allison <jra@samba.org>
Fri, 9 May 2014 04:31:49 +0000 (8 21:31 -0700)
committerKarolin Seeger <kseeger@samba.org>
Tue, 10 Jun 2014 08:58:39 +0000 (10 10:58 +0200)
tree16ad047babc67e1f2d61adc39ddda472aca119af
parent5857b18052e25fd3c1fcee45a563bd1b339be4bb
s3: libsmbclient: Work around bugs in SLES cifsd and Apple smbx SMB1 servers.

SLES's cifsd and Apple's smbx do not correctly handle FILE_NON_DIRECTORY_FILE
which prevents recursive copies in gvfs from working correctly [1] since GVFS
tries to open the directory, expecting ENOTDIR, but it suceeds and appears as a
zero byte file.

This fix adds code to the cli_open() open code that checks if
CreateOptions was requested with FILE_NON_DIRECTORY_FILE set,
and if the attributes returned include FILE_ATTRIBUTE_DIRECTORY
we synchronously close the file handle just opened, and return
NT_STATUS_FILE_IS_A_DIRECTORY to the caller.

Depends on the previous API update to cli_ntcreate()
to add returned attributes.

Fixes bug #10587 - Opening directories on SLES's cifsd and Apple's smbx succeeds.

https://bugzilla.samba.org/show_bug.cgi?id=10587

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
(cherry picked from commit b2ce2441a35ed68c39791168217d159352b5143c)
source3/libsmb/clifile.c