mirror of
https://github.com/ceph/ceph
synced 2025-03-11 02:39:05 +00:00
mds/MDSAuthCap: drop leading / in paths
Signed-off-by: Sage Weil <sage@redhat.com>
This commit is contained in:
parent
0b557d56a2
commit
622fe9f181
@ -103,26 +103,26 @@ TEST(MDSAuthCaps, AllowAll) {
|
||||
|
||||
ASSERT_TRUE(cap.parse(g_ceph_context, "allow *", NULL));
|
||||
ASSERT_TRUE(cap.allow_all());
|
||||
ASSERT_TRUE(cap.is_capable("/foo/bar", 0, 0, 0777, 0, MAY_READ | MAY_WRITE));
|
||||
ASSERT_TRUE(cap.is_capable("foo/bar", 0, 0, 0777, 0, MAY_READ | MAY_WRITE));
|
||||
}
|
||||
|
||||
TEST(MDSAuthCaps, AllowUid) {
|
||||
MDSAuthCaps cap;
|
||||
ASSERT_TRUE(cap.parse(g_ceph_context, "allow * uid=10", NULL));
|
||||
ASSERT_FALSE(cap.allow_all());
|
||||
ASSERT_TRUE(cap.is_capable("/foo", 0, 0, 0777, 10, MAY_READ | MAY_WRITE));
|
||||
ASSERT_FALSE(cap.is_capable("/foo", 0, 0, 0777, -1, MAY_READ | MAY_WRITE));
|
||||
ASSERT_FALSE(cap.is_capable("/foo", 0, 0, 0777, 0, MAY_READ | MAY_WRITE));
|
||||
ASSERT_TRUE(cap.is_capable("foo", 0, 0, 0777, 10, MAY_READ | MAY_WRITE));
|
||||
ASSERT_FALSE(cap.is_capable("foo", 0, 0, 0777, -1, MAY_READ | MAY_WRITE));
|
||||
ASSERT_FALSE(cap.is_capable("foo", 0, 0, 0777, 0, MAY_READ | MAY_WRITE));
|
||||
}
|
||||
|
||||
TEST(MDSAuthCaps, AllowPath) {
|
||||
MDSAuthCaps cap;
|
||||
ASSERT_TRUE(cap.parse(g_ceph_context, "allow * path=/sandbox", NULL));
|
||||
ASSERT_FALSE(cap.allow_all());
|
||||
ASSERT_TRUE(cap.is_capable("/sandbox/foo", 0, 0, 0777, 0, MAY_READ | MAY_WRITE));
|
||||
ASSERT_TRUE(cap.is_capable("/sandbox", 0, 0, 0777, 0, MAY_READ | MAY_WRITE));
|
||||
ASSERT_FALSE(cap.is_capable("/sandboxed", 0, 0, 0777, 0, MAY_READ | MAY_WRITE));
|
||||
ASSERT_FALSE(cap.is_capable("/foo", 0, 0, 0777, 0, MAY_READ | MAY_WRITE));
|
||||
ASSERT_TRUE(cap.is_capable("sandbox/foo", 0, 0, 0777, 0, MAY_READ | MAY_WRITE));
|
||||
ASSERT_TRUE(cap.is_capable("sandbox", 0, 0, 0777, 0, MAY_READ | MAY_WRITE));
|
||||
ASSERT_FALSE(cap.is_capable("sandboxed", 0, 0, 0777, 0, MAY_READ | MAY_WRITE));
|
||||
ASSERT_FALSE(cap.is_capable("foo", 0, 0, 0777, 0, MAY_READ | MAY_WRITE));
|
||||
}
|
||||
|
||||
TEST(MDSAuthCaps, OutputParsed) {
|
||||
|
Loading…
Reference in New Issue
Block a user