mirror of
https://github.com/ceph/ceph
synced 2024-12-18 17:37:38 +00:00
mon: apply 'r' and 'w' caps to osdmap
Signed-off-by: Sage Weil <sage@inktank.com>
This commit is contained in:
parent
880e86b29c
commit
c1c93e57b4
@ -1143,11 +1143,6 @@ void Monitor::handle_command(MMonCommand *m)
|
||||
return;
|
||||
}
|
||||
if (m->cmd[0] == "osd") {
|
||||
if (!session->caps.get_allow_all() && !_allowed_command(session, m->cmd)) {
|
||||
r = -EACCES;
|
||||
rs = "access denied";
|
||||
goto out;
|
||||
}
|
||||
osdmon()->dispatch(m);
|
||||
return;
|
||||
}
|
||||
|
@ -1441,6 +1441,15 @@ bool OSDMonitor::preprocess_command(MMonCommand *m)
|
||||
bufferlist rdata;
|
||||
stringstream ss;
|
||||
|
||||
MonSession *session = m->get_session();
|
||||
if (!session ||
|
||||
(!session->caps.get_allow_all() &&
|
||||
!session->caps.check_privileges(PAXOS_OSDMAP, MON_CAP_R) &&
|
||||
!mon->_allowed_command(session, m->cmd))) {
|
||||
mon->reply_command(m, -EACCES, "access denied", rdata, paxos->get_version());
|
||||
return true;
|
||||
}
|
||||
|
||||
vector<const char*> args;
|
||||
for (unsigned i = 1; i < m->cmd.size(); i++)
|
||||
args.push_back(m->cmd[i].c_str());
|
||||
@ -1721,6 +1730,16 @@ bool OSDMonitor::prepare_command(MMonCommand *m)
|
||||
stringstream ss;
|
||||
string rs;
|
||||
int err = -EINVAL;
|
||||
|
||||
MonSession *session = m->get_session();
|
||||
if (!session ||
|
||||
(!session->caps.get_allow_all() &&
|
||||
!session->caps.check_privileges(PAXOS_OSDMAP, MON_CAP_W) &&
|
||||
!mon->_allowed_command(session, m->cmd))) {
|
||||
mon->reply_command(m, -EACCES, "access denied", paxos->get_version());
|
||||
return true;
|
||||
}
|
||||
|
||||
if (m->cmd.size() > 1) {
|
||||
if ((m->cmd.size() == 2 && m->cmd[1] == "setcrushmap") ||
|
||||
(m->cmd.size() == 3 && m->cmd[1] == "crush" && m->cmd[2] == "set")) {
|
||||
|
Loading…
Reference in New Issue
Block a user