From e90d3f842e28965a4189be49284fc13052739c09 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Thu, 26 Oct 2017 20:08:35 +0100 Subject: Improve permissions tests on rename --- netfs/unittests/testCore.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/netfs/unittests/testCore.cpp b/netfs/unittests/testCore.cpp index fbca658..56c695e 100644 --- a/netfs/unittests/testCore.cpp +++ b/netfs/unittests/testCore.cpp @@ -372,10 +372,14 @@ BOOST_AUTO_TEST_CASE( renameToDir ) memset(&fi, 0, sizeof(fi)); BOOST_REQUIRE_EQUAL(fuse->create("/file", 0600, &fi), 0); BOOST_REQUIRE_EQUAL(fuse->release("/file", &fi), 0); - BOOST_REQUIRE_EQUAL(fuse->mkdir("/dir", 0000), 0); - BOOST_REQUIRE_EQUAL(fuse->rename("/file", "/dir/file"), -EACCES); - BOOST_REQUIRE_EQUAL(fuse->chmod("/dir", 0700), 0); + BOOST_REQUIRE_EQUAL(fuse->mkdir("/dir", 0700), 0); BOOST_REQUIRE_EQUAL(fuse->rename("/file", "/dir"), -EISDIR); + disableWriteOnDir(fuse, "/dir"); + BOOST_REQUIRE_EQUAL(fuse->rename("/file", "/dir/file"), -EACCES); + enableWriteOnDir(fuse, "/dir"); + disableWriteOnDir(fuse, "/"); + BOOST_REQUIRE_EQUAL(fuse->rename("/file", "/dir/file"), -EACCES); + enableWriteOnDir(fuse, "/"); BOOST_REQUIRE_EQUAL(fuse->rename("/file", "/dir/file"), 0); BOOST_REQUIRE_EQUAL(fuse->unlink("/file"), -ENOENT); BOOST_REQUIRE_EQUAL(fuse->unlink("/dir/file"), 0); -- cgit v1.2.3