]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3: smbd: Only pass fsp to set_unix_posix_acl(). No longer uses smb_fname.
authorJeremy Allison <jra@samba.org>
Tue, 18 Jun 2019 22:18:47 +0000 (15:18 -0700)
committerJeremy Allison <jra@samba.org>
Mon, 24 Jun 2019 18:49:10 +0000 (18:49 +0000)
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
source3/smbd/posix_acls.c
source3/smbd/proto.h
source3/smbd/trans2.c

index 4fab04d5cf6219360bc267551db4a509fde56514..fcdabc1e0150c074059117509de625a3280a131d 100644 (file)
@@ -4615,18 +4615,16 @@ static NTSTATUS remove_posix_acl(connection_struct *conn,
 
 NTSTATUS set_unix_posix_acl(connection_struct *conn,
                        files_struct *fsp,
-                       const struct smb_filename *smb_fname,
                        uint16_t num_acls,
                        const char *pdata)
 {
        SMB_ACL_T file_acl = NULL;
-       const char *fname = smb_fname->base_name;
        int ret;
        NTSTATUS status;
 
        if (!num_acls) {
                /* Remove the ACL from the file. */
-               return remove_posix_acl(conn, fsp, smb_fname);
+               return remove_posix_acl(conn, fsp, fsp->fsp_name);
        }
 
        file_acl = create_posix_acl_from_wire(conn,
@@ -4637,34 +4635,18 @@ NTSTATUS set_unix_posix_acl(connection_struct *conn,
                return map_nt_error_from_unix(errno);
        }
 
-       if (fsp && fsp->fh->fd != -1) {
-               /* The preferred way - use an open fd. */
-               ret = SMB_VFS_SYS_ACL_SET_FD(fsp, file_acl);
-               if (ret == -1) {
-                       status = map_nt_error_from_unix(errno);
-                       DBG_INFO("acl_set_file failed on %s (%s)\n",
-                               fname,
-                               strerror(errno));
-                       TALLOC_FREE(file_acl);
-                       return status;
-               }
-       } else {
-               ret = SMB_VFS_SYS_ACL_SET_FILE(conn,
-                                       smb_fname,
-                                       SMB_ACL_TYPE_ACCESS,
-                                       file_acl);
-               if (ret == -1) {
-                       status = map_nt_error_from_unix(errno);
-                       DBG_INFO("acl_set_file failed on %s (%s)\n",
-                               fname,
-                               strerror(errno));
-                       TALLOC_FREE(file_acl);
-                       return status;
-               }
+       ret = SMB_VFS_SYS_ACL_SET_FD(fsp, file_acl);
+       if (ret == -1) {
+               status = map_nt_error_from_unix(errno);
+               DBG_INFO("acl_set_file failed on %s (%s)\n",
+                       fsp_str_dbg(fsp),
+                       strerror(errno));
+               TALLOC_FREE(file_acl);
+               return status;
        }
 
        DBG_DEBUG("set acl for file %s\n",
-               fname);
+               fsp_str_dbg(fsp));
 
        TALLOC_FREE(file_acl);
        return NT_STATUS_OK;
index 2c8e33430c9dd5a96d6bceedb1937326faf55ad9..4e5f82d0cdd6d2f39ff3beee18eebe71d3eb991c 100644 (file)
@@ -811,7 +811,6 @@ NTSTATUS set_unix_posix_default_acl(connection_struct *conn,
                                const struct smb_filename *smb_fname,
                                uint16_t num_def_acls, const char *pdata);
 NTSTATUS set_unix_posix_acl(connection_struct *conn, files_struct *fsp,
-                               const struct smb_filename *smb_fname,
                                uint16_t num_acls,
                                const char *pdata);
 NTSTATUS get_nt_acl_no_snum( TALLOC_CTX *ctx, const char *fname,
index 9f2b888889c82c177b47a45386a26c19fa6640de..cc5af63201faf87e8d66ccad78eef58a777642d1 100644 (file)
@@ -7464,7 +7464,6 @@ static NTSTATUS smb_set_posix_acl(connection_struct *conn,
        if (valid_file_acls) {
                status = set_unix_posix_acl(conn,
                                        fsp,
-                                       fsp->fsp_name,
                                        num_file_acls,
                                        pdata);
                if (!NT_STATUS_IS_OK(status)) {