s3: smbd: VFS: All the places that are currently calling vfs_stat_smb_fname() and...
authorJeremy Allison <jra@samba.org>
Fri, 1 May 2015 20:09:36 +0000 (13:09 -0700)
committerRalph Böhme <slow@samba.org>
Tue, 5 May 2015 12:01:25 +0000 (14:01 +0200)
They are all post-stream name processing.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
source3/modules/nfs4_acls.c
source3/modules/vfs_acl_common.c
source3/modules/vfs_acl_tdb.c
source3/modules/vfs_recycle.c
source3/modules/vfs_solarisacl.c
source3/modules/vfs_xattr_tdb.c

index adc9b378b777005e28ff4deec697fdd44cb169ea..f7daa8d58395b99b288c33bb91f9c9a637df6f99 100644 (file)
@@ -316,9 +316,9 @@ static int smbacl4_GetFileOwner(struct connection_struct *conn,
        memset(psbuf, 0, sizeof(SMB_STRUCT_STAT));
 
        /* Get the stat struct for the owner info. */
        memset(psbuf, 0, sizeof(SMB_STRUCT_STAT));
 
        /* Get the stat struct for the owner info. */
-       if (vfs_stat_smb_fname(conn, filename, psbuf) != 0)
+       if (vfs_stat_smb_basename(conn, filename, psbuf) != 0)
        {
        {
-               DEBUG(8, ("vfs_stat_smb_fname failed with error %s\n",
+               DEBUG(8, ("vfs_stat_smb_basename failed with error %s\n",
                        strerror(errno)));
                return -1;
        }
                        strerror(errno)));
                return -1;
        }
index 920c811de5e57494ab84a1f6d9a2e5ee31d072f1..625e7cb672ea79478fd43251cdbb2dc9c93c5821 100644 (file)
@@ -620,7 +620,24 @@ static NTSTATUS get_nt_acl_internal(vfs_handle_struct *handle,
                        }
                        psbuf = &fsp->fsp_name->st;
                } else {
                        }
                        psbuf = &fsp->fsp_name->st;
                } else {
-                       int ret = vfs_stat_smb_fname(handle->conn,
+                       /*
+                        * https://bugzilla.samba.org/show_bug.cgi?id=11249
+                        *
+                        * We are currently guaranteed that 'name' here is
+                        * a smb_fname->base_name, which *cannot* contain
+                        * a stream name (':'). vfs_stat_smb_fname() splits
+                        * a name into a base name + stream name, which
+                        * when we get here we know we've already done.
+                        * So we have to call the stat or lstat VFS
+                        * calls directly here. Else, a base_name that
+                        * contains a ':' (from a demangled name) will
+                        * get split again.
+                        *
+                        * FIXME.
+                        * This uglyness will go away once smb_fname
+                        * is fully plumbed through the VFS.
+                        */
+                       int ret = vfs_stat_smb_basename(handle->conn,
                                                name,
                                                &sbuf);
                        if (ret == -1) {
                                                name,
                                                &sbuf);
                        if (ret == -1) {
index 8ee4bd5460f547ab88db34d47a4a88bc6566a729..e02993bdcc8c7d5ba69bb413d4b21aed0c57a865 100644 (file)
@@ -159,7 +159,7 @@ static NTSTATUS get_acl_blob(TALLOC_CTX *ctx,
                status = vfs_stat_fsp(fsp);
                sbuf = fsp->fsp_name->st;
        } else {
                status = vfs_stat_fsp(fsp);
                sbuf = fsp->fsp_name->st;
        } else {
-               int ret = vfs_stat_smb_fname(handle->conn, name, &sbuf);
+               int ret = vfs_stat_smb_basename(handle->conn, name, &sbuf);
                if (ret == -1) {
                        status = map_nt_error_from_unix(errno);
                }
                if (ret == -1) {
                        status = map_nt_error_from_unix(errno);
                }
@@ -282,12 +282,7 @@ static int rmdir_acl_tdb(vfs_handle_struct *handle, const char *path)
        struct db_context *db = acl_db;
        int ret = -1;
 
        struct db_context *db = acl_db;
        int ret = -1;
 
-       if (lp_posix_pathnames()) {
-               ret = vfs_lstat_smb_fname(handle->conn, path, &sbuf);
-       } else {
-               ret = vfs_stat_smb_fname(handle->conn, path, &sbuf);
-       }
-
+       ret = vfs_stat_smb_basename(handle->conn, path, &sbuf);
        if (ret == -1) {
                return -1;
        }
        if (ret == -1) {
                return -1;
        }
@@ -347,12 +342,7 @@ static int sys_acl_set_file_tdb(vfs_handle_struct *handle,
        struct db_context *db = acl_db;
        int ret = -1;
 
        struct db_context *db = acl_db;
        int ret = -1;
 
-       if (lp_posix_pathnames()) {
-               ret = vfs_lstat_smb_fname(handle->conn, path, &sbuf);
-       } else {
-               ret = vfs_stat_smb_fname(handle->conn, path, &sbuf);
-       }
-
+       ret = vfs_stat_smb_basename(handle->conn, path, &sbuf);
        if (ret == -1) {
                return -1;
        }
        if (ret == -1) {
                return -1;
        }
index 00d7f34f2f72cbecd16bcb6057120f42dbd502ce..9af78fd5aa5e9f26803bb78e2e51831df1f4e996 100644 (file)
@@ -188,7 +188,7 @@ static bool recycle_directory_exist(vfs_handle_struct *handle, const char *dname
 {
        SMB_STRUCT_STAT st;
 
 {
        SMB_STRUCT_STAT st;
 
-       if (vfs_stat_smb_fname(handle->conn, dname, &st) == 0) {
+       if (vfs_stat_smb_basename(handle->conn, dname, &st) == 0) {
                if (S_ISDIR(st.st_ex_mode)) {
                        return True;
                }
                if (S_ISDIR(st.st_ex_mode)) {
                        return True;
                }
index 9b3c4f60a56858dba0fcf0481020a7786ffde75b..efd2d75e64a607d1c25712ab74b1d70cef039694 100644 (file)
@@ -167,7 +167,7 @@ int solarisacl_sys_acl_set_file(vfs_handle_struct *handle,
         * that has not been specified in "type" from the file first 
         * and concatenate it with the acl provided.
         */
         * that has not been specified in "type" from the file first 
         * and concatenate it with the acl provided.
         */
-       if (vfs_stat_smb_fname(handle->conn, name, &s) != 0) {
+       if (vfs_stat_smb_basename(handle->conn, name, &s) != 0) {
                DEBUG(10, ("Error in stat call: %s\n", strerror(errno)));
                goto done;
        }
                DEBUG(10, ("Error in stat call: %s\n", strerror(errno)));
                goto done;
        }
index 63a12fd75dd8c9b38376628ca54a9ab0c30de97e..66c19f8094af46e2638c40bba41b62b3ab17e130 100644 (file)
@@ -414,7 +414,7 @@ static int xattr_tdb_rmdir(vfs_handle_struct *handle, const char *path)
                                        TALLOC_FREE(frame); return -1;
                                });
 
                                        TALLOC_FREE(frame); return -1;
                                });
 
-       if (vfs_stat_smb_fname(handle->conn, path, &sbuf) == -1) {
+       if (vfs_stat_smb_basename(handle->conn, path, &sbuf) == -1) {
                TALLOC_FREE(frame);
                return -1;
        }
                TALLOC_FREE(frame);
                return -1;
        }