From: František Dvořák Date: Tue, 15 Oct 2013 11:17:00 +0000 (+0200) Subject: Check permissions when changing dir. X-Git-Url: http://scientific.zcu.cz/git/?a=commitdiff_plain;h=ab74af487aaddeed3fcf26ed61f1aabe0fa74303;p=dmlite-plugins-vfs.git Check permissions when changing dir. --- diff --git a/src/VfsNs.cpp b/src/VfsNs.cpp index d80d0e1..b9fe4b1 100644 --- a/src/VfsNs.cpp +++ b/src/VfsNs.cpp @@ -110,7 +110,14 @@ void VfsCatalog::setSecurityContext(const SecurityContext* ctx) throw (DmExcepti void VfsCatalog::changeDir(const std::string& path) throw (DmException) { + ExtendedStat meta; + + meta = this->extendedStat(path); + if (checkPermissions(this->secCtx_, meta.acl, meta.stat, S_IEXEC | S_IREAD) != 0) + vfsThrow(EACCES, "not enough permissions for '%s' on '%s'", clientName.c_str(), meta.name.c_str()); + wrapCall(chdir(path.c_str())); + syslog(LOG_DEBUG, "%s: changed to '%s'", __func__, path.c_str()); }