]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
functional test of mds cap path restriction
authorJashan Kamboj <jashank42@gmail.com>
Fri, 10 Jul 2015 18:30:28 +0000 (00:00 +0530)
committerSage Weil <sage@redhat.com>
Thu, 1 Oct 2015 13:39:31 +0000 (09:39 -0400)
Signed-off-by: Jashan Kamboj <jashank42@gmail.com>
qa/workunits/fs/test_path_caps.sh [new file with mode: 0755]

diff --git a/qa/workunits/fs/test_path_caps.sh b/qa/workunits/fs/test_path_caps.sh
new file mode 100755 (executable)
index 0000000..57c6af7
--- /dev/null
@@ -0,0 +1,34 @@
+#!/bin/sh -ex
+
+mkdir mnt.admin mnt.foo
+
+./ceph-fuse -n client.admin mnt.admin
+mkdir mnt.admin/foo mnt.admin/bar
+
+./ceph auth get-or-create client.foo mon 'allow r' mds 'allow r, allow rw path=/foo' osd 'allow rwx' >> keyring
+./ceph-fuse -n client.foo mnt.foo
+
+cleanup()
+{
+       rm -rf mnt.admin/foo mnt.admin/bar
+       fusermount -u mnt.foo
+       fusermount -u mnt.admin
+       rmdir mnt.admin mnt.foo
+}
+
+trap cleanup INT TERM EXIT
+
+expect_false()
+{
+       if "$@"; then return 1;
+       else return 0;
+       fi
+}
+
+# things in /foo/ are allowed
+mkdir mnt.foo/foo/x
+mkdir mnt.foo/foo/y
+
+# everything else is not
+expect_false mkdir mnt.foo/bar/x
+expect_false mkdir mnt.foo/food
\ No newline at end of file