VfsCatalog::VfsCatalog(const std::string& host, const std::string& prefix, const std::string &allow, const std::string &deny, const std::string allowWrite, const std::string denyWrite) throw (DmException): Catalog(),
- hostName_(host)
+ hostName_(host), umask_(022)
{
this->allowRegex = vfsCompileRegex("Allow", allow);
this->denyRegex = vfsCompileRegex("Deny", deny);
if (code == ENOENT) {
// Cleanup mode
- mode = (mode & ~S_IFMT) | S_IFREG;
+ mode = (mode & ~S_IFMT & ~this->umask_) | S_IFREG;
// Effective gid
if (parent.stat.st_mode & S_ISGID) {
mode_t VfsCatalog::umask(mode_t mask) throw ()
{
+ mode_t prev;
+
if (vfsCheckPermissions("", S_IREAD))
vfsThrow(EACCES, "not enough permissions for '%s'", clientName.c_str());
- return ::umask(mask);
+ prev = this->umask_;
+ this->umask_ = mask;
+ return prev;
}
lpath = getLocalPath(path);
// Clean up unwanted bits, set bits
- mode = (mode & ~S_IFMT) | S_IFDIR;
+ mode = (mode & ~S_IFMT & ~this->umask_) | S_IFDIR;
// Effective gid
if (parent.stat.st_mode & S_ISGID) {
const SecurityContext* secCtx_;
std::string hostName_;
std::string prefix_;
+ mode_t umask_;
private:
regex_t *allowRegex, *denyRegex, *allowWriteRegex, *denyWriteRegex;