summaryrefslogtreecommitdiff
path: root/netfs/daemonMisc.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'netfs/daemonMisc.cpp')
-rw-r--r--netfs/daemonMisc.cpp34
1 files changed, 21 insertions, 13 deletions
diff --git a/netfs/daemonMisc.cpp b/netfs/daemonMisc.cpp
index 9327fad..4fa6eaf 100644
--- a/netfs/daemonMisc.cpp
+++ b/netfs/daemonMisc.cpp
@@ -13,16 +13,18 @@ MiscServer::MiscServer(DaemonGlobalStatePtr dgs) :
}
Ice::Int
-MiscServer::access(const std::string & path, Ice::Int mode, const Ice::Current &)
+MiscServer::access(Ice::Long tok, const std::string & path, Ice::Int mode, const Ice::Current &)
{
- return ::access(path.c_str(), mode);
+ SessionPtr sess(dgs->getSession(tok));
+ return ::access((sess->exportCfg->root / path).string().c_str(), mode);
}
NetFSComms::Attr
-MiscServer::getattr(const std::string & path, const Ice::Current &)
+MiscServer::getattr(Ice::Long tok, const std::string & path, const Ice::Current &)
{
+ SessionPtr sess(dgs->getSession(tok));
struct stat s;
- if (::stat(path.c_str(), &s) != 0) {
+ if (::stat((sess->exportCfg->root / path).string().c_str(), &s) != 0) {
throw NetFSComms::SystemError(errno);
}
NetFSComms::Attr a;
@@ -43,8 +45,9 @@ MiscServer::getattr(const std::string & path, const Ice::Current &)
}
void
-MiscServer::symlink(const std::string & path1, const std::string & path2, const Ice::Current &)
+MiscServer::symlink(Ice::Long tok, const std::string & path1, const std::string & path2, const Ice::Current &)
{
+ SessionPtr sess(dgs->getSession(tok));
errno = 0;
if (::symlink(path1.c_str(), path2.c_str()) != 0) {
throw NetFSComms::SystemError(errno);
@@ -53,8 +56,9 @@ MiscServer::symlink(const std::string & path1, const std::string & path2, const
}
void
-MiscServer::link(const std::string & path1, const std::string & path2, const Ice::Current &)
+MiscServer::link(Ice::Long tok, const std::string & path1, const std::string & path2, const Ice::Current &)
{
+ SessionPtr sess(dgs->getSession(tok));
errno = 0;
if (::link(path1.c_str(), path2.c_str()) != 0) {
throw NetFSComms::SystemError(errno);
@@ -63,8 +67,9 @@ MiscServer::link(const std::string & path1, const std::string & path2, const Ice
}
void
-MiscServer::rename(const std::string & from, const std::string & to, const Ice::Current &)
+MiscServer::rename(Ice::Long tok, const std::string & from, const std::string & to, const Ice::Current &)
{
+ SessionPtr sess(dgs->getSession(tok));
errno = 0;
if (::rename(from.c_str(), to.c_str()) != 0) {
throw NetFSComms::SystemError(errno);
@@ -73,11 +78,12 @@ MiscServer::rename(const std::string & from, const std::string & to, const Ice::
}
std::string
-MiscServer::readlink(const std::string & path, const Ice::Current &)
+MiscServer::readlink(Ice::Long tok, const std::string & path, const Ice::Current &)
{
+ SessionPtr sess(dgs->getSession(tok));
errno = 0;
char buf[PATH_MAX];
- ssize_t rc = ::readlink(path.c_str(), buf, PATH_MAX);
+ ssize_t rc = ::readlink((sess->exportCfg->root / path).string().c_str(), buf, PATH_MAX);
if (rc == -1) {
throw NetFSComms::SystemError(errno);
}
@@ -85,20 +91,22 @@ MiscServer::readlink(const std::string & path, const Ice::Current &)
}
void
-MiscServer::chmod(const std::string & path, Ice::Int mode, const Ice::Current &)
+MiscServer::chmod(Ice::Long tok, const std::string & path, Ice::Int mode, const Ice::Current &)
{
+ SessionPtr sess(dgs->getSession(tok));
errno = 0;
- if (::chmod(path.c_str(), mode) != 0) {
+ if (::chmod((sess->exportCfg->root / path).string().c_str(), mode) != 0) {
throw NetFSComms::SystemError(errno);
}
// s.replicatedRequest = true;
}
void
-MiscServer::chown(const std::string & path, Ice::Int uid, Ice::Int gid, const Ice::Current &)
+MiscServer::chown(Ice::Long tok, const std::string & path, Ice::Int uid, Ice::Int gid, const Ice::Current &)
{
+ SessionPtr sess(dgs->getSession(tok));
errno = 0;
- if (::chown(path.c_str(), uid, gid) != 0) {
+ if (::chown((sess->exportCfg->root / path).string().c_str(), uid, gid) != 0) {
throw NetFSComms::SystemError(errno);
}
// s.replicatedRequest = true;