From db3ec7343ebfdd3268461fd93faf216313afa25a Mon Sep 17 00:00:00 2001 From: Greg Farnum Date: Mon, 1 Aug 2016 20:16:27 -0700 Subject: [PATCH] client: use UserPerm for _posix_acl_chmod Signed-off-by: Greg Farnum --- src/client/Client.cc | 9 ++++----- src/client/Client.h | 2 +- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/client/Client.cc b/src/client/Client.cc index 0ac4a442d111..50a5744bb525 100644 --- a/src/client/Client.cc +++ b/src/client/Client.cc @@ -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; diff --git a/src/client/Client.h b/src/client/Client.h index 98874fb19a5f..87ad54f984ac 100644 --- a/src/client/Client.h +++ b/src/client/Client.h @@ -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; -- 2.47.3