return Client::_listxattr(f->inode.get(), list, size, perms);
}
-int Client::removexattr(const char *path, const char *name)
+int Client::removexattr(const char *path, const char *name,
+ const UserPerm& perms)
{
Mutex::Locker lock(client_lock);
InodeRef in;
- int r = Client::path_walk(path, &in, true);
+ int r = Client::path_walk(path, &in, perms, true);
if (r < 0)
return r;
- return _removexattr(in, name);
+ return _removexattr(in, name, perms);
}
-int Client::lremovexattr(const char *path, const char *name)
+int Client::lremovexattr(const char *path, const char *name,
+ const UserPerm& perms)
{
Mutex::Locker lock(client_lock);
InodeRef in;
- int r = Client::path_walk(path, &in, false);
+ int r = Client::path_walk(path, &in, perms, false);
if (r < 0)
return r;
- return _removexattr(in, name);
+ return _removexattr(in, name, perms);
}
-int Client::fremovexattr(int fd, const char *name)
+int Client::fremovexattr(int fd, const char *name, const UserPerm& perms)
{
Mutex::Locker lock(client_lock);
Fh *f = get_filehandle(fd);
if (!f)
return -EBADF;
- return _removexattr(f->inode, name);
+ return _removexattr(f->inode, name, perms);
}
int Client::setxattr(const char *path, const char *name, const void *value,
return _setxattr(in, name, value, size, flags, perms);
}
-int Client::_removexattr(Inode *in, const char *name, int uid, int gid)
+int Client::_removexattr(Inode *in, const char *name, const UserPerm& perms)
{
if (in->snapid != CEPH_NOSNAP) {
return -EROFS;
req->set_filepath2(name);
req->set_inode(in);
- int res = make_request(req, uid, gid);
+ int res = make_request(req, perms);
trim_cache();
ldout(cct, 3) << "_removexattr(" << in->ino << ", \"" << name << "\") = " << res << dendl;
return res;
}
-int Client::_removexattr(InodeRef &in, const char *name)
+int Client::_removexattr(InodeRef &in, const char *name, const UserPerm& perms)
{
if (cct->_conf->client_permissions) {
- int r = xattr_permission(in.get(), name, MAY_WRITE);
+ int r = xattr_permission(in.get(), name, MAY_WRITE, perms);
if (r < 0)
return r;
}
- UserPerm perms(0, 0); // FIXME
return _removexattr(in.get(), name, perms);
}
int flags, const UserPerm& perms);
int _setxattr(InodeRef &in, const char *name, const void *value, size_t len,
int flags, const UserPerm& perms);
- int _removexattr(Inode *in, const char *nm, int uid=-1, int gid=-1);
- int _removexattr(Inode *in, const char *nm, const UserPerm& perms) {
- return _removexattr(in, nm, perms.uid(), perms.gid());
- }
- int _removexattr(InodeRef &in, const char *nm);
+ int _removexattr(Inode *in, const char *nm, const UserPerm& perms);
+ int _removexattr(InodeRef &in, const char *nm, const UserPerm& perms);
int _open(Inode *in, int flags, mode_t mode, Fh **fhp, int uid, int gid);
int _renew_caps(Inode *in);
int _create(Inode *in, const char *name, int flags, mode_t mode, InodeRef *inp, Fh **fhp,
int listxattr(const char *path, char *list, size_t size, const UserPerm& perms);
int llistxattr(const char *path, char *list, size_t size, const UserPerm& perms);
int flistxattr(int fd, char *list, size_t size, const UserPerm& perms);
- int removexattr(const char *path, const char *name);
- int lremovexattr(const char *path, const char *name);
- int fremovexattr(int fd, const char *name);
+ int removexattr(const char *path, const char *name, const UserPerm& perms);
+ int lremovexattr(const char *path, const char *name, const UserPerm& perms);
+ int fremovexattr(int fd, const char *name, const UserPerm& perms);
int setxattr(const char *path, const char *name, const void *value,
size_t size, int flags, const UserPerm& perms);
int lsetxattr(const char *path, const char *name, const void *value,
{
if (!cmount->is_mounted())
return -ENOTCONN;
- return cmount->get_client()->removexattr(path, name);
+ UserPerm perms = cmount->get_client()->pick_my_perms();
+ return cmount->get_client()->removexattr(path, name, perms);
}
extern "C" int ceph_lremovexattr(struct ceph_mount_info *cmount, const char *path, const char *name)
{
if (!cmount->is_mounted())
return -ENOTCONN;
- return cmount->get_client()->lremovexattr(path, name);
+ UserPerm perms = cmount->get_client()->pick_my_perms();
+ return cmount->get_client()->lremovexattr(path, name, perms);
}
extern "C" int ceph_fremovexattr(struct ceph_mount_info *cmount, int fd, const char *name)
{
if (!cmount->is_mounted())
return -ENOTCONN;
- return cmount->get_client()->fremovexattr(fd, name);
+ UserPerm perms = cmount->get_client()->pick_my_perms();
+ return cmount->get_client()->fremovexattr(fd, name, perms);
}
extern "C" int ceph_setxattr(struct ceph_mount_info *cmount, const char *path, const char *name, const void *value, size_t size, int flags)