return _setattr(in, &attr, mask, perms);
}
-int Client::utime(const char *relpath, struct utimbuf *buf)
+int Client::utime(const char *relpath, struct utimbuf *buf,
+ const UserPerm& perms)
{
Mutex::Locker lock(client_lock);
tout(cct) << "utime" << std::endl;
tout(cct) << buf->actime << 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;
stat_set_mtime_nsec(&attr, 0);
stat_set_atime_sec(&attr, buf->actime);
stat_set_atime_nsec(&attr, 0);
- return _setattr(in, &attr, CEPH_SETATTR_MTIME|CEPH_SETATTR_ATIME);
+ return _setattr(in, &attr, CEPH_SETATTR_MTIME|CEPH_SETATTR_ATIME, perms);
}
-int Client::lutime(const char *relpath, struct utimbuf *buf)
+int Client::lutime(const char *relpath, struct utimbuf *buf,
+ const UserPerm& perms)
{
Mutex::Locker lock(client_lock);
tout(cct) << "lutime" << 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;
stat_set_mtime_nsec(&attr, 0);
stat_set_atime_sec(&attr, buf->actime);
stat_set_atime_nsec(&attr, 0);
- return _setattr(in, &attr, CEPH_SETATTR_MTIME|CEPH_SETATTR_ATIME);
+ return _setattr(in, &attr, CEPH_SETATTR_MTIME|CEPH_SETATTR_ATIME, perms);
}
int Client::flock(int fd, int operation, uint64_t owner)
int fchown(int fd, uid_t new_uid, gid_t new_gid, const UserPerm& perms);
int lchown(const char *path, uid_t new_uid, gid_t new_gid,
const UserPerm& perms);
- int utime(const char *path, struct utimbuf *buf);
- int lutime(const char *path, struct utimbuf *buf);
+ int utime(const char *path, struct utimbuf *buf, const UserPerm& perms);
+ int lutime(const char *path, struct utimbuf *buf, const UserPerm& perms);
int flock(int fd, int operation, uint64_t owner);
int truncate(const char *path, loff_t size);
struct utimbuf u;
u.actime = b;
u.modtime = c;
- client->utime(a, &u);
+ client->utime(a, &u, perms);
} else if (strcmp(op, "mknod") == 0) {
const char *a = t.get_string(buf, p);
int64_t b = t.get_int();
struct utimbuf b;
memset(&b, 1, sizeof(b));
if (contents.empty())
- r = client->utime( cwd.c_str(), &b );
+ r = client->utime(cwd.c_str(), &b, perms);
else
- r = client->utime( get_random_sub(), &b );
+ r = client->utime(get_random_sub(), &b, perms);
}
*/
if (op == CEPH_MDS_OP_LINK) {
struct utimbuf ut;
ut.modtime = mtime;
ut.actime = mtime;
- client->utime(f.c_str(), &ut);
+ client->utime(f.c_str(), &ut, perms);
}
}
}
{
if (!cmount->is_mounted())
return -ENOTCONN;
- return cmount->get_client()->utime(path, buf);
+ UserPerm perms = cmount->get_client()->pick_my_perms();
+ return cmount->get_client()->utime(path, buf, perms);
}
extern "C" int ceph_flock(struct ceph_mount_info *cmount, int fd, int operation,