]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
client: use UserPerm for _posix_acl_chmod
authorGreg Farnum <gfarnum@redhat.com>
Tue, 2 Aug 2016 03:16:27 +0000 (20:16 -0700)
committerGreg Farnum <gfarnum@redhat.com>
Wed, 21 Sep 2016 23:33:52 +0000 (16:33 -0700)
Signed-off-by: Greg Farnum <gfarnum@redhat.com>
src/client/Client.cc
src/client/Client.h

index 0ac4a442d111c1d512b69e48ea490fe0c7445869..50a5744bb525ad2c85ee6a98cdc8cafb579b368b 100644 (file)
@@ -6540,7 +6540,7 @@ int Client::_setattr(Inode *in, struct stat *attr, int mask,
   if (ret < 0)
    return ret;
   if (mask & CEPH_SETATTR_MODE)
-    ret = _posix_acl_chmod(in, attr->st_mode, perms.uid(), perms.gid());
+    ret = _posix_acl_chmod(in, attr->st_mode, perms);
   return ret;
 }
 
@@ -12376,12 +12376,13 @@ int Client::_posix_acl_permission(Inode *in, uid_t uid, UserGroups& groups, unsi
   return -EAGAIN;
 }
 
-int Client::_posix_acl_chmod(Inode *in, mode_t mode, int uid, int gid)
+int Client::_posix_acl_chmod(Inode *in, mode_t mode, const UserPerm& perms)
 {
   if (acl_type == NO_ACL)
     return 0;
 
-  int r = _getattr(in, CEPH_STAT_CAP_XATTR, uid, gid, in->xattr_version == 0);
+  int r = _getattr(in, CEPH_STAT_CAP_XATTR, perms.uid(), perms.gid(),
+                  in->xattr_version == 0);
   if (r < 0)
     goto out;
 
@@ -12392,8 +12393,6 @@ int Client::_posix_acl_chmod(Inode *in, mode_t mode, int uid, int gid)
       r = posix_acl_access_chmod(acl, mode);
       if (r < 0)
        goto out;
-      // FIXME
-      UserPerm perms(uid, gid);
       r = _do_setxattr(in, ACL_EA_ACCESS, acl.c_str(), acl.length(), 0, perms);
     } else {
       r = 0;
index 98874fb19a5ff115d50baa39711b35a4f4649102..87ad54f984ac898d1c435237f53405ecbae181ac 100644 (file)
@@ -1022,7 +1022,7 @@ private:
   void _update_lock_state(struct flock *fl, uint64_t owner, ceph_lock_state_t *lock_state);
 
   int _posix_acl_create(Inode *dir, mode_t *mode, bufferlist& xattrs_bl, int uid, int gid);
-  int _posix_acl_chmod(Inode *in, mode_t mode, int uid, int gid);
+  int _posix_acl_chmod(Inode *in, mode_t mode, const UserPerm& perms);
   int _posix_acl_permission(Inode *in, uid_t uid, UserGroups& groups, unsigned want);
 
   mds_rank_t _get_random_up_mds() const;