s3: smbd: Modify vfs_stat_smb_basename() to take a const struct smb_filename * instea...
authorJeremy Allison <jra@samba.org>
Sat, 19 Mar 2016 05:17:30 +0000 (22:17 -0700)
committerJeremy Allison <jra@samba.org>
Thu, 24 Mar 2016 21:57:17 +0000 (22:57 +0100)
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Uri Simchoni <uri@samba.org>
source3/modules/nfs4_acls.c
source3/modules/vfs_acl_common.c
source3/modules/vfs_acl_tdb.c
source3/modules/vfs_streams_xattr.c
source3/modules/vfs_xattr_tdb.c
source3/smbd/proto.h
source3/smbd/trans2.c
source3/smbd/vfs.c

index 349b26b..8756285 100644 (file)
@@ -274,7 +274,7 @@ static int smbacl4_GetFileOwner(struct connection_struct *conn,
        ZERO_STRUCTP(psbuf);
 
        /* Get the stat struct for the owner info. */
-       if (vfs_stat_smb_basename(conn, smb_fname->base_name, psbuf) != 0)
+       if (vfs_stat_smb_basename(conn, smb_fname, psbuf) != 0)
        {
                DEBUG(8, ("vfs_stat_smb_basename failed with error %s\n",
                        strerror(errno)));
index c907b0f..98e1b8e 100644 (file)
@@ -641,7 +641,7 @@ static NTSTATUS get_nt_acl_internal(vfs_handle_struct *handle,
                         * is fully plumbed through the VFS.
                         */
                        int ret = vfs_stat_smb_basename(handle->conn,
-                                               smb_fname->base_name,
+                                               smb_fname,
                                                &sbuf);
                        if (ret == -1) {
                                TALLOC_FREE(frame);
index e2d0cb8..e4c8462 100644 (file)
@@ -160,7 +160,7 @@ static NTSTATUS get_acl_blob(TALLOC_CTX *ctx,
                sbuf = fsp->fsp_name->st;
        } else {
                int ret = vfs_stat_smb_basename(handle->conn,
-                               smb_fname->base_name,
+                               smb_fname,
                                &sbuf);
                if (ret == -1) {
                        status = map_nt_error_from_unix(errno);
@@ -285,7 +285,7 @@ static int rmdir_acl_tdb(vfs_handle_struct *handle,
        struct db_context *db = acl_db;
        int ret = -1;
 
-       ret = vfs_stat_smb_basename(handle->conn, smb_fname->base_name, &sbuf);
+       ret = vfs_stat_smb_basename(handle->conn, smb_fname, &sbuf);
        if (ret == -1) {
                return -1;
        }
index 8313464..d9eb2e1 100644 (file)
@@ -842,7 +842,7 @@ static NTSTATUS streams_xattr_streaminfo(vfs_handle_struct *handle,
                ret = SMB_VFS_FSTAT(fsp, &sbuf);
        } else {
                ret = vfs_stat_smb_basename(handle->conn,
-                               smb_fname->base_name,
+                               smb_fname,
                                &sbuf);
        }
 
index aa3bd82..c40f1e1 100644 (file)
@@ -416,7 +416,7 @@ static int xattr_tdb_rmdir(vfs_handle_struct *handle,
                                });
 
        if (vfs_stat_smb_basename(handle->conn,
-                               smb_fname->base_name,
+                               smb_fname,
                                &sbuf) == -1) {
                TALLOC_FREE(frame);
                return -1;
index 776e91d..6f402ab 100644 (file)
@@ -1213,7 +1213,8 @@ NTSTATUS check_reduced_name(connection_struct *conn, const char *fname);
 NTSTATUS check_reduced_name_with_privilege(connection_struct *conn,
                        const char *fname,
                        struct smb_request *smbreq);
-int vfs_stat_smb_basename(struct connection_struct *conn, const char *fname,
+int vfs_stat_smb_basename(struct connection_struct *conn,
+                       const struct smb_filename *smb_fname_in,
                        SMB_STRUCT_STAT *psbuf);
 NTSTATUS vfs_stat_fsp(files_struct *fsp);
 NTSTATUS vfs_chown_fsp(files_struct *fsp, uid_t uid, gid_t gid);
index 65c2cb0..69276f5 100644 (file)
@@ -69,7 +69,7 @@ static NTSTATUS refuse_symlink(connection_struct *conn,
                pst = &fsp->fsp_name->st;
        } else {
                int ret = vfs_stat_smb_basename(conn,
-                               smb_fname->base_name,
+                               smb_fname,
                                &sbuf);
                if (ret == -1) {
                        return map_nt_error_from_unix(errno);
index 972cea4..b58becc 100644 (file)
@@ -1315,15 +1315,17 @@ NTSTATUS check_reduced_name(connection_struct *conn, const char *fname)
  *
  * Called when we know stream name parsing has already been done.
  */
-int vfs_stat_smb_basename(struct connection_struct *conn, const char *fname,
-                      SMB_STRUCT_STAT *psbuf)
+int vfs_stat_smb_basename(struct connection_struct *conn,
+                       const struct smb_filename *smb_fname_in,
+                       SMB_STRUCT_STAT *psbuf)
 {
        struct smb_filename smb_fname = {
-                       .base_name = discard_const_p(char, fname)
+               .base_name = discard_const_p(char, smb_fname_in->base_name),
+               .flags = smb_fname_in->flags
        };
        int ret;
 
-       if (lp_posix_pathnames()) {
+       if (smb_fname.flags & SMB_FILENAME_POSIX_PATH) {
                ret = SMB_VFS_LSTAT(conn, &smb_fname);
        } else {
                ret = SMB_VFS_STAT(conn, &smb_fname);