]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commit
mon: Monitor: match command module caps against what's on MonCommands.h
authorJoao Eduardo Luis <joao@redhat.com>
Tue, 23 Sep 2014 23:33:57 +0000 (00:33 +0100)
committerJoao Eduardo Luis <joao@redhat.com>
Fri, 3 Oct 2014 15:24:19 +0000 (16:24 +0100)
commit940c4e28120667f11111c0da256b878fa35a5623
tree61f1b7d731c6cd4ab3432469fd0c0da89fb27579
parent861246158e2e3d50e799f200f7180295bf7f439e
mon: Monitor: match command module caps against what's on MonCommands.h

We were checking the command's permissions against what we perceived as
the 'module' from parsing the command's "prefix" (specified by the
client).  This caused troubles with cap checks for commands without a
submodule clearly defined, such as 'status' or 'health' (vs 'mon dump'
or 'osd pool set', which are of submodule 'mon' and 'osd' respectively).

As such, we now grab the command's submodule (right now solely for caps
checks) from the monitor's internal representation of the commands
(defined in mon/MonCommands.h and built at compile time and stashed in
'mon_commands').  Given that commands such as 'health', 'fsid' or
'status' have properly defined modules in MonCommands.h, we simply rely
on that representation for all commands.  Which is what we should have
been doing from the start anyway, because we shouldn't be relying on the
client to point us to what we want to authenticate against.

Backport: firefly

Signed-off-by: Joao Eduardo Luis <joao@redhat.com>
src/mon/Monitor.cc