Set uid and gid
This commit is contained in:
parent
4fcf700dab
commit
6e5c10d60e
|
@ -9,6 +9,8 @@ import std.array;
|
||||||
import std.string;
|
import std.string;
|
||||||
import std.stdio;
|
import std.stdio;
|
||||||
|
|
||||||
|
import core.sys.posix.unistd;
|
||||||
|
|
||||||
import dfuse.fuse;
|
import dfuse.fuse;
|
||||||
|
|
||||||
import dtagfs.tagprovider;
|
import dtagfs.tagprovider;
|
||||||
|
@ -18,6 +20,9 @@ class FileSystem : Operations
|
||||||
private string _source;
|
private string _source;
|
||||||
private TagProvider[] _tagProviders;
|
private TagProvider[] _tagProviders;
|
||||||
|
|
||||||
|
private uid_t _uid;
|
||||||
|
private gid_t _gid;
|
||||||
|
|
||||||
private string[][string] _tagCache;
|
private string[][string] _tagCache;
|
||||||
|
|
||||||
this(string source, TagProvider[] tagProviders)
|
this(string source, TagProvider[] tagProviders)
|
||||||
|
@ -25,6 +30,9 @@ class FileSystem : Operations
|
||||||
_source = source;
|
_source = source;
|
||||||
_tagProviders = tagProviders;
|
_tagProviders = tagProviders;
|
||||||
|
|
||||||
|
_uid = getuid();
|
||||||
|
_gid = getgid();
|
||||||
|
|
||||||
cacheTags();
|
cacheTags();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,9 +55,12 @@ class FileSystem : Operations
|
||||||
|
|
||||||
override void getattr(const(char)[] path, ref stat_t stat)
|
override void getattr(const(char)[] path, ref stat_t stat)
|
||||||
{
|
{
|
||||||
|
stat.st_uid = _uid;
|
||||||
|
stat.st_gid = _gid;
|
||||||
|
|
||||||
if(path == "/" || isTag(path.baseName))
|
if(path == "/" || isTag(path.baseName))
|
||||||
{
|
{
|
||||||
stat.st_mode = S_IFDIR | octal!500;
|
stat.st_mode = S_IFDIR | octal!555;
|
||||||
stat.st_size = 0;
|
stat.st_size = 0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -58,7 +69,7 @@ class FileSystem : Operations
|
||||||
auto file = findFile(path.baseName);
|
auto file = findFile(path.baseName);
|
||||||
lstat(toStringz(file), &stat);
|
lstat(toStringz(file), &stat);
|
||||||
|
|
||||||
stat.st_mode = S_IFREG | octal!400;
|
stat.st_mode = S_IFREG | octal!444;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue