summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2015-06-13 16:20:40 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2015-06-13 16:20:40 +0100
commit43f844df65f5cf61bdc9a0e5b2b2421a5adf1b17 (patch)
tree47d011bb029b4cd81e5d4d0a28c541fe20ca287f
parentAdd explicit instaniation of template members functions too (diff)
downloadnetfs-43f844df65f5cf61bdc9a0e5b2b2421a5adf1b17.tar.bz2
netfs-43f844df65f5cf61bdc9a0e5b2b2421a5adf1b17.tar.xz
netfs-43f844df65f5cf61bdc9a0e5b2b2421a5adf1b17.zip
Defend against and don't make calls to open with O_CREAT set when re-establishing a session
-rw-r--r--netfs/daemon/daemonVolume.cpp3
-rw-r--r--netfs/fuse/fuseApp.cpp2
2 files changed, 4 insertions, 1 deletions
diff --git a/netfs/daemon/daemonVolume.cpp b/netfs/daemon/daemonVolume.cpp
index 0556d9a..afc0d36 100644
--- a/netfs/daemon/daemonVolume.cpp
+++ b/netfs/daemon/daemonVolume.cpp
@@ -249,6 +249,9 @@ VolumeServer::open(const NetFS::ReqEnv & re, const std::string & path, Ice::Int
errno = 0;
boost::filesystem::path p(resolvePath(path));
tp.AssertRead(p);
+ if (flags & O_CREAT) {
+ throw NetFS::SystemError(EINVAL);
+ }
int fd = ::open(p.string().c_str(), flags);
if (fd == -1) {
throw NetFS::SystemError(errno);
diff --git a/netfs/fuse/fuseApp.cpp b/netfs/fuse/fuseApp.cpp
index fdcce57..940d0e6 100644
--- a/netfs/fuse/fuseApp.cpp
+++ b/netfs/fuse/fuseApp.cpp
@@ -117,7 +117,7 @@ NetFS::FuseApp::connectHandles()
of.second->remote->ice_ping();
}
catch (const Ice::ObjectNotExistException &) {
- of.second->remote = volume->open(reqEnv(), of.second->path, of.second->flags);
+ of.second->remote = volume->open(reqEnv(), of.second->path, of.second->flags & !O_CREAT);
}
}
for (const OpenDirs::value_type & of : openDirs) {