For "fs authorize" command, AuthMonitor.cc checks if permissions is "r"
or begins with "rw". This check is redundant now.
AuthMonitor::valid_caps() runs MDSAuthCaps.parse() which now runs same
check for the MDS caps, regardless of the command.
Signed-off-by: Rishabh Dave <ridave@redhat.com>
(cherry picked from commit
8e1e322054ea14eb5e59969439c0ea27885503ab)
def test_auth_get_or_create_key(self):
for mdscap in self.MDSCAPS:
self._negtestcmd('auth get-or-create-key', mdscap)
+
+ def test_fs_authorize(self):
+ for wrong_perm in ('w', 'wr'):
+ self.negtest_ceph_cmd(
+ args=(f'fs authorize {self.fs.name} {self.CLIENT_NAME} / '
+ f'{wrong_perm}'), retval=self.EXPECTED_ERRNO,
+ errmsgs=self.EXPECTED_ERRMSG)
++it;
}
- if (cap != "r" && cap.compare(0, 2, "rw")) {
- ss << "Permission flags must start with 'r' or 'rw'.";
- err = -EINVAL;
- goto done;
- }
if (cap.compare(0, 2, "rw") == 0)
osd_cap_wanted = "rw";