}
int Client::ll_lookup(Inode *parent, const char *name, struct stat *attr,
- Inode **out, int uid, int gid)
+ Inode **out, const UserPerm& perms)
{
Mutex::Locker lock(client_lock);
ldout(cct, 3) << "ll_lookup " << parent << " " << name << dendl;
int r = 0;
if (!cct->_conf->fuse_default_permissions) {
- r = may_lookup(parent, uid, gid);
+ r = may_lookup(parent, perms);
if (r < 0)
return r;
}
string dname(name);
InodeRef in;
- r = _lookup(parent, dname, CEPH_STAT_CAP_INODE_ALL, &in, uid, gid);
+ r = _lookup(parent, dname, CEPH_STAT_CAP_INODE_ALL, &in, perms);
if (r < 0) {
attr->st_ino = 0;
goto out;
Inode *ll_get_inode(ino_t ino);
Inode *ll_get_inode(vinodeno_t vino);
int ll_lookup(Inode *parent, const char *name, struct stat *attr,
- Inode **out, int uid = -1, int gid = -1);
+ Inode **out, const UserPerm& perms);
bool ll_forget(Inode *in, int count);
bool ll_put(Inode *in);
int ll_getattr(Inode *in, struct stat *st, int uid = -1, int gid = -1);
client->mkdir(prefix.c_str(), 0755, perms);
struct stat attr;
i1 = client->ll_get_inode(vinodeno_t(1, CEPH_NOSNAP));
- if (client->ll_lookup(i1, prefix.c_str(), &attr, &i2) == 0) {
+ if (client->ll_lookup(i1, prefix.c_str(), &attr, &i2, perms) == 0) {
ll_inos[1] = attr.st_ino;
dout(5) << "'root' ino is " << inodeno_t(attr.st_ino) << dendl;
client->ll_put(i1);
struct stat attr;
if (ll_inos.count(i)) {
i1 = client->ll_get_inode(vinodeno_t(ll_inos[i],CEPH_NOSNAP));
- if (client->ll_lookup(i1, name, &attr, &i2) == 0)
+ if (client->ll_lookup(i1, name, &attr, &i2, perms) == 0)
ll_inos[r] = attr.st_ino;
client->ll_put(i1);
}
struct fuse_entry_param fe;
Inode *i2, *i1 = cfuse->iget(parent); // see below
int r;
+ UserPerm perms(ctx->uid, ctx->gid);
memset(&fe, 0, sizeof(fe));
- r = cfuse->client->ll_lookup(i1, name, &fe.attr, &i2, ctx->uid, ctx->gid);
+ r = cfuse->client->ll_lookup(i1, name, &fe.attr, &i2, perms);
if (r >= 0) {
fe.ino = cfuse->make_fake_ino(fe.attr.st_ino, fe.attr.st_dev);
fe.attr.st_rdev = new_encode_dev(fe.attr.st_rdev);
struct stat *attr, Inode **out,
int uid, int gid)
{
- return (cmount->get_client())->ll_lookup(parent, name, attr, out, uid, gid);
+ UserPerm perms(uid, gid);
+ return (cmount->get_client())->ll_lookup(parent, name, attr, out, perms);
}
extern "C" int ceph_ll_put(class ceph_mount_info *cmount, Inode *in)