s3: smbd: Add uint32_t flags field to struct smb_filename.
authorJeremy Allison <jra@samba.org>
Thu, 17 Mar 2016 23:20:17 +0000 (16:20 -0700)
committerJeremy Allison <jra@samba.org>
Thu, 24 Mar 2016 21:57:16 +0000 (22:57 +0100)
Only one defined flag for now, SMB_FILENAME_POSIX_PATH.
Define as the same as FSP_POSIX_FLAGS_PATHNAMES to keep
the value consistent.

Set this inside unix_convert() when a posix path parse
is selected.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Uri Simchoni <uri@samba.org>
source3/include/vfs.h
source3/lib/filename_util.c
source3/modules/vfs_default.c
source3/smbd/filename.c

index 1c6bc2f8fa2fab11cc714386748db96f00576e34..3a86c627f8144825642e5e74c2f59d48423a5d59 100644 (file)
                const struct smb_filename * */
 /* Version 35 - Change streaminfo from const char *, to
                const struct smb_filename * */
+/* Version 35 - Add uint32_t flags to struct smb_filename */
 
 #define SMB_VFS_INTERFACE_VERSION 35
 
@@ -514,9 +515,17 @@ struct smb_filename {
        char *base_name;
        char *stream_name;
        char *original_lcomp;
+       uint32_t flags;
        SMB_STRUCT_STAT st;
 };
 
+/*
+ * smb_filename flags. Define in terms of the FSP_POSIX_FLAGS_XX
+ * to keep the numeric values consistent.
+ */
+
+#define SMB_FILENAME_POSIX_PATH                FSP_POSIX_FLAGS_PATHNAMES
+
 #define VFS_FIND(__fn__) while (handle->fns->__fn__##_fn==NULL) { \
                                handle = handle->next; \
                         }
index 61a5f012ed0d5c9e56fbbfb5bbcce53546f9f548..c2beae170af4ad9f169fd4240b3fb660cb583e9c 100644 (file)
@@ -212,6 +212,7 @@ struct smb_filename *cp_smb_filename(TALLOC_CTX *mem_ctx,
                talloc_set_name_const(out->original_lcomp,
                                      out->original_lcomp);
        }
+       out->flags = in->flags;
        out->st = in->st;
        return out;
 }
index ea7dc2caf99fc59c899e05e6069e3ba29fcdff86..23df640b415e26ea055223ef4547074493e865f4 100644 (file)
@@ -2211,6 +2211,7 @@ static NTSTATUS vfswrap_streaminfo(vfs_handle_struct *handle,
                ZERO_STRUCT(smb_fname_cp);
                smb_fname_cp.base_name = discard_const_p(char,
                                        smb_fname->base_name);
+               smb_fname_cp.flags = smb_fname->flags;
 
                if (lp_posix_pathnames()) {
                        ret = SMB_VFS_LSTAT(handle->conn, &smb_fname_cp);
index dffa71d7b671b22991ef49424ef8b8d037df3654..a1920c32207bcd30027506210cacf615a225f506 100644 (file)
@@ -273,6 +273,8 @@ NTSTATUS unix_convert(TALLOC_CTX *ctx,
                goto done;
        }
 
+       smb_fname->flags = posix_pathnames ? SMB_FILENAME_POSIX_PATH : 0;
+
        DEBUG(5, ("unix_convert called on file \"%s\"\n", orig_path));
 
        /*