s3:smbd: file_struct: seperate POSIX directory rename cap from POSIX open
authorRalph Boehme <slow@samba.org>
Thu, 22 Jan 2015 09:00:15 +0000 (10:00 +0100)
committerJeremy Allison <jra@samba.org>
Tue, 1 Dec 2015 19:45:20 +0000 (20:45 +0100)
We need more fine grained control over which POSIX semantics we'd like
to enable per file handle. Currently POSIX_FLAGS_OPEN is a kitchensink
for all kinds of stuff like:

- POSIX unlink
- POSIX byte-range locks
- POSIX rename
- delayed writetime update
- more...

For CIFS UNIX extensions we use POSIX_FLAGS_ALL so semantics are
preserved. OS X clients will enable POSIX rename via AAPL.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/include/vfs.h
source3/smbd/reply.c

index 56a90493c2f5a142187a4cea76c3413fb0372156..d839be466703a8023ebefc95e0e086a91e63015a 100644 (file)
@@ -301,9 +301,11 @@ typedef struct files_struct {
 } files_struct;
 
 #define FSP_POSIX_FLAGS_OPEN           0x01
+#define FSP_POSIX_FLAGS_RENAME         0x02
 
 #define FSP_POSIX_FLAGS_ALL                    \
-       (FSP_POSIX_FLAGS_OPEN)
+       (FSP_POSIX_FLAGS_OPEN |                 \
+        FSP_POSIX_FLAGS_RENAME)
 
 struct vuid_cache_entry {
        struct auth_session_info *session_info;
index 2e5e521d1be3ce91db9ccc0fc83ecfa2316377ec..7c011ccdecba9ac3e833640e14fc95a559d2c932 100644 (file)
@@ -2669,7 +2669,7 @@ static NTSTATUS can_rename(connection_struct *conn, files_struct *fsp,
        }
 
        if (S_ISDIR(fsp->fsp_name->st.st_ex_mode)) {
-               if (fsp->posix_flags & FSP_POSIX_FLAGS_OPEN) {
+               if (fsp->posix_flags & (FSP_POSIX_FLAGS_OPEN|FSP_POSIX_FLAGS_RENAME)) {
                        return NT_STATUS_OK;
                }