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 adc9b37..f7daa8d 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. */
-       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;
        }
index 920c811..625e7cb 100644 (file)
@@ -620,7 +620,24 @@ static NTSTATUS get_nt_acl_internal(vfs_handle_struct *handle,
                        }
                        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) {
index 8ee4bd5..e02993b 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 {
-               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);
                }
@@ -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;
 
-       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;
        }
@@ -347,12 +342,7 @@ static int sys_acl_set_file_tdb(vfs_handle_struct *handle,
        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;
        }
index 00d7f34..9af78fd 100644 (file)
@@ -188,7 +188,7 @@ static bool recycle_directory_exist(vfs_handle_struct *handle, const char *dname
 {
        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;
                }
index 9b3c4f6..efd2d75 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.
         */
-       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;
        }
index 63a12fd..66c19f8 100644 (file)
@@ -414,7 +414,7 @@ static int xattr_tdb_rmdir(vfs_handle_struct *handle, const char *path)
                                        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;
        }