lru.lru_touch(dn);
}
-int Client::chmod(const char *relpath, mode_t mode)
+int Client::chmod(const char *relpath, mode_t mode, const UserPerm& perms)
{
Mutex::Locker lock(client_lock);
tout(cct) << "chmod" << std::endl;
tout(cct) << mode << std::endl;
filepath path(relpath);
InodeRef in;
- int r = path_walk(path, &in);
+ int r = path_walk(path, &in, perms);
if (r < 0)
return r;
struct stat attr;
attr.st_mode = mode;
- return _setattr(in, &attr, CEPH_SETATTR_MODE);
+ return _setattr(in, &attr, CEPH_SETATTR_MODE, perms);
}
-int Client::fchmod(int fd, mode_t mode)
+int Client::fchmod(int fd, mode_t mode, const UserPerm& perms)
{
Mutex::Locker lock(client_lock);
tout(cct) << "fchmod" << std::endl;
#endif
struct stat attr;
attr.st_mode = mode;
- return _setattr(f->inode, &attr, CEPH_SETATTR_MODE);
+ return _setattr(f->inode, &attr, CEPH_SETATTR_MODE, perms);
}
-int Client::lchmod(const char *relpath, mode_t mode)
+int Client::lchmod(const char *relpath, mode_t mode, const UserPerm& perms)
{
Mutex::Locker lock(client_lock);
tout(cct) << "lchmod" << std::endl;
filepath path(relpath);
InodeRef in;
// don't follow symlinks
- int r = path_walk(path, &in, false);
+ int r = path_walk(path, &in, perms, false);
if (r < 0)
return r;
struct stat attr;
attr.st_mode = mode;
- return _setattr(in, &attr, CEPH_SETATTR_MODE);
+ return _setattr(in, &attr, CEPH_SETATTR_MODE, perms);
}
int Client::chown(const char *relpath, int uid, int gid)
int setattr(const char *relpath, struct stat *attr, int mask, const UserPerm& perms);
int fsetattr(int fd, struct stat *attr, int mask, const UserPerm& perms);
- int chmod(const char *path, mode_t mode);
- int fchmod(int fd, mode_t mode);
- int lchmod(const char *path, mode_t mode);
+ int chmod(const char *path, mode_t mode, const UserPerm& perms);
+ int fchmod(int fd, mode_t mode, const UserPerm& perms);
+ int lchmod(const char *path, mode_t mode, const UserPerm& perms);
int chown(const char *path, int uid, int gid);
int fchown(int fd, int uid, int gid);
int lchown(const char *path, int uid, int gid);
struct stat st;
for (int i=0; i<count; i++) {
client->lstat("test", &st);
- client->chmod("test", 0777);
+ client->chmod("test", 0777, perms);
}
}
did_run_me();
} else if (strcmp(op, "chmod") == 0) {
const char *a = t.get_string(buf, p);
int64_t b = t.get_int();
- client->chmod(a, b);
+ client->chmod(a, b, perms);
} else if (strcmp(op, "chown") == 0) {
const char *a = t.get_string(buf, p);
int64_t b = t.get_int();
if (contents.empty())
op = CEPH_MDS_OP_READDIR;
else
- r = client->chmod( get_random_sub(), rand() & 0755 );
+ r = client->chmod(get_random_sub(), rand() & 0755, perms);
}
if (op == CEPH_MDS_OP_CHOWN) {
}
client->close(fd);
- //client->chmod(f.c_str(), mode & 0777);
+ //client->chmod(f.c_str(), mode & 0777, perms);
client->chown(f.c_str(), uid, gid);
struct utimbuf ut;
{
if (!cmount->is_mounted())
return -ENOTCONN;
- return cmount->get_client()->chmod(path, mode);
+ UserPerm perms = cmount->get_client()->pick_my_perms();
+ return cmount->get_client()->chmod(path, mode, perms);
}
extern "C" int ceph_fchmod(struct ceph_mount_info *cmount, int fd, mode_t mode)
{
if (!cmount->is_mounted())
return -ENOTCONN;
- return cmount->get_client()->fchmod(fd, mode);
+ UserPerm perms = cmount->get_client()->pick_my_perms();
+ return cmount->get_client()->fchmod(fd, mode, perms);
}
extern "C" int ceph_chown(struct ceph_mount_info *cmount, const char *path,
int uid, int gid)