summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2017-10-25 12:44:06 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2017-12-16 20:40:24 +0000
commitbc9a1a8e96c47fde637107db8782174858b16935 (patch)
tree1f8e1e8b2239c8c2e1fcbfc6a6e48ed00b2f37cf
parentImprove exception usage around configuration lookups and simplify that code (diff)
downloadnetfs-bc9a1a8e96c47fde637107db8782174858b16935.tar.bz2
netfs-bc9a1a8e96c47fde637107db8782174858b16935.tar.xz
netfs-bc9a1a8e96c47fde637107db8782174858b16935.zip
Relax mode checking in rmdir as it is actually too strict
See d41485f12e8b72d6d01165d461966e22bb5d1331
-rw-r--r--netfs/daemon/daemonVolume.cpp1
-rw-r--r--netfs/unittests/testCore.cpp12
2 files changed, 11 insertions, 2 deletions
diff --git a/netfs/daemon/daemonVolume.cpp b/netfs/daemon/daemonVolume.cpp
index 2c2d670..e1295d6 100644
--- a/netfs/daemon/daemonVolume.cpp
+++ b/netfs/daemon/daemonVolume.cpp
@@ -302,7 +302,6 @@ VolumeServer::rmdir(const NetFS::ReqEnv & re, const std::string & path, const Ic
ModeCheck mc(re, root, userLookup, groupLookup);
errno = 0;
boost::filesystem::path p(resolvePath(path));
- mc.AssertWrite(p);
mc.AssertWriteParent(p);
if (::rmdir(p.c_str()) != 0) {
throw NetFS::SystemError(errno);
diff --git a/netfs/unittests/testCore.cpp b/netfs/unittests/testCore.cpp
index 880a503..6bf443f 100644
--- a/netfs/unittests/testCore.cpp
+++ b/netfs/unittests/testCore.cpp
@@ -290,14 +290,24 @@ BOOST_AUTO_TEST_CASE( access )
BOOST_REQUIRE_EQUAL(fuse->access("/dir", R_OK), -EACCES);
BOOST_REQUIRE_EQUAL(fuse->access("/dir", W_OK), -EACCES);
BOOST_REQUIRE_EQUAL(fuse->access("/dir", X_OK), -EACCES);
+ // Child permissions (directories)
+ BOOST_REQUIRE_EQUAL(fuse->chmod("/dir", 0700), 0);
+ BOOST_REQUIRE_EQUAL(fuse->mkdir("/dir/yes", 0000), 0);
+ BOOST_REQUIRE_EQUAL(fuse->getattr("/dir/yes", &st), 0);
+ BOOST_REQUIRE_EQUAL(st.st_mode, 0000 | S_IFDIR);
BOOST_REQUIRE_EQUAL(fuse->chmod("/dir", 0500), 0);
BOOST_REQUIRE_EQUAL(fuse->getattr("/dir", &st), 0);
BOOST_REQUIRE_EQUAL(st.st_mode, 0500 | S_IFDIR);
- BOOST_REQUIRE_EQUAL(fuse->rmdir("/dir"), -EACCES);
+ BOOST_REQUIRE_EQUAL(fuse->mkdir("/dir/no", 0700), -EACCES);
+ BOOST_REQUIRE_EQUAL(fuse->getattr("/dir/no", &st), -ENOENT);
+ BOOST_REQUIRE_EQUAL(fuse->rmdir("/dir/yes"), -EACCES);
BOOST_REQUIRE_EQUAL(fuse->chmod("/dir", 0700), 0);
BOOST_REQUIRE_EQUAL(fuse->getattr("/dir", &st), 0);
BOOST_REQUIRE_EQUAL(st.st_mode, 0700 | S_IFDIR);
+ BOOST_REQUIRE_EQUAL(fuse->rmdir("/dir/yes"), 0);
+ BOOST_REQUIRE_EQUAL(fuse->getattr("/dir/yes", &st), -ENOENT);
BOOST_REQUIRE_EQUAL(fuse->rmdir("/dir"), 0);
+ BOOST_REQUIRE_EQUAL(fuse->getattr("/dir", &st), -ENOENT);
}
BOOST_AUTO_TEST_CASE( mknod )