diff options
-rw-r--r-- | netfs/daemon/daemonVolume.cpp | 1 | ||||
-rw-r--r-- | netfs/unittests/testCore.cpp | 12 |
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 ) |