mirror of
https://github.com/trapexit/mergerfs.git
synced 2026-11-21 23:46:26 -05:00
restrict who can setxattr the pseudo file. closes #64
This commit is contained in:
parent
4ea49fcfbb
commit
4b204b8fba
2 changed files with 16 additions and 11 deletions
|
|
@ -282,18 +282,23 @@ namespace mergerfs
|
|||
size_t attrvalsize,
|
||||
int flags)
|
||||
{
|
||||
const config::Config &config = config::get();
|
||||
const config::Config &config = config::get();
|
||||
const struct fuse_context *fc = fuse_get_context();
|
||||
|
||||
if(fusepath == config.controlfile)
|
||||
return _setxattr_controlfile(config::get_writable(),
|
||||
attrname,
|
||||
string(attrval,attrvalsize),
|
||||
flags);
|
||||
{
|
||||
if((fc->uid != ::getuid()) && (fc->gid != ::getgid()))
|
||||
return -EPERM;
|
||||
|
||||
return _setxattr_controlfile(config::get_writable(),
|
||||
attrname,
|
||||
string(attrval,attrvalsize),
|
||||
flags);
|
||||
}
|
||||
|
||||
{
|
||||
const struct fuse_context *fc = fuse_get_context();
|
||||
const ugid::SetResetGuard ugid(fc->uid,fc->gid);
|
||||
const rwlock::ReadGuard readlock(&config.srcmountslock);
|
||||
const ugid::SetResetGuard ugid(fc->uid,fc->gid);
|
||||
const rwlock::ReadGuard readlock(&config.srcmountslock);
|
||||
|
||||
return _setxattr(*config.setxattr,
|
||||
config.srcmounts,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue