s3-pysmbd: Try opening as a file, then as a directory
authorAndrew Bartlett <abartlet@samba.org>
Tue, 7 Aug 2012 04:19:06 +0000 (14:19 +1000)
committerAndrew Bartlett <abartlet@samba.org>
Tue, 7 Aug 2012 06:59:21 +0000 (08:59 +0200)
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Tue Aug  7 08:59:21 CEST 2012 on sn-devel-104

source3/smbd/pysmbd.c

index 8a5bde1090f3bbc529e794895dab618646a1685c..6bef8af66d200ecd072521d9dbe03dd3ca47bbf6 100644 (file)
@@ -129,9 +129,9 @@ static NTSTATUS set_nt_acl_no_snum(const char *fname,
        flags = O_RDONLY;
 #endif
 
-       fsp->fh->fd = SMB_VFS_OPEN(conn, smb_fname, fsp, flags, 00400);
+       fsp->fh->fd = SMB_VFS_OPEN(conn, smb_fname, fsp, O_RDWR, 00400);
        if (fsp->fh->fd == -1 && errno == EISDIR) {
-               fsp->fh->fd = SMB_VFS_OPEN(conn, smb_fname, fsp, O_RDWR, 00400);
+               fsp->fh->fd = SMB_VFS_OPEN(conn, smb_fname, fsp, flags, 00400);
        }
        if (fsp->fh->fd == -1) {
                printf("open: error=%d (%s)\n", errno, strerror(errno));