bufferlist rdata;
string rs;
int r = -EINVAL;
- rs = "unrecognized subsystem";
+ rs = "unrecognized command";
if (!m->cmd.empty()) {
if (m->cmd[0] == "mds") {
if (!session->caps.get_allow_all() && !_allowed_command(session, m->cmd)) {
r = -EACCES;
+ rs = "access denied";
goto out;
}
mdsmon()->dispatch(m);
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);
if (m->cmd[0] == "pg") {
if (!session->caps.get_allow_all() && !_allowed_command(session, m->cmd)) {
r = -EACCES;
+ rs = "access denied";
goto out;
}
pgmon()->dispatch(m);
if (m->cmd[0] == "mon") {
if (!session->caps.get_allow_all() && !_allowed_command(session, m->cmd)) {
r = -EACCES;
+ rs = "access denied";
goto out;
}
monmon()->dispatch(m);
if (m->cmd[0] == "log") {
if (!session->caps.get_allow_all() && !_allowed_command(session, m->cmd)) {
r = -EACCES;
+ rs = "access denied";
goto out;
}
stringstream ss;
if (m->cmd[0] == "stop_cluster") {
if (!session->caps.get_allow_all() && !_allowed_command(session, m->cmd)) {
r = -EACCES;
+ rs = "access denied";
goto out;
}
stop_cluster();
if (m->cmd[0] == "injectargs") {
if (!session->caps.get_allow_all() && !_allowed_command(session, m->cmd)) {
r = -EACCES;
+ rs = "access denied";
goto out;
}
if (m->cmd.size() == 2) {
if (m->cmd[0] == "status") {
if (!session->caps.get_allow_all() && !_allowed_command(session, m->cmd)) {
r = -EACCES;
+ rs = "access denied";
goto out;
}
// reply with the status for all the components
if (m->cmd[0] == "quorum_status") {
if (!session->caps.get_allow_all() && !_allowed_command(session, m->cmd)) {
r = -EACCES;
+ rs = "access denied";
goto out;
}
// make sure our map is readable and up to date
if (m->cmd[0] == "mon_status") {
if (!session->caps.get_allow_all() && !_allowed_command(session, m->cmd)) {
r = -EACCES;
+ rs = "access denied";
goto out;
}
stringstream ss;
if (m->cmd[0] == "health") {
if (!session->caps.get_allow_all() && !_allowed_command(session, m->cmd)) {
r = -EACCES;
+ rs = "access denied";
goto out;
}
get_health(rs, (m->cmd.size() > 1) ? &rdata : NULL);
if (m->cmd[0] == "heap") {
if (!session->caps.get_allow_all() && !_allowed_command(session, m->cmd)) {
r = -EACCES;
+ rs = "access denied";
goto out;
}
if (!ceph_using_tcmalloc())
if (m->cmd[0] == "quorum") {
if (!session->caps.get_allow_all() && !_allowed_command(session, m->cmd)) {
r = -EACCES;
+ rs = "access denied";
goto out;
}
if (m->cmd[1] == "exit") {
r = -EINVAL;
}
}
- } else
- rs = "no command";
+ }
out:
if (!m->get_source().is_mon()) // don't reply to mon->mon commands