]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: Monitor: purge old permission checking format on handle_command()
authorJoao Eduardo Luis <joao.luis@inktank.com>
Sun, 28 Jul 2013 17:51:49 +0000 (18:51 +0100)
committerJoao Eduardo Luis <joao.luis@inktank.com>
Tue, 6 Aug 2013 20:59:33 +0000 (13:59 -0700)
Signed-off-by: Joao Eduardo Luis <joao.luis@inktank.com>
src/mon/Monitor.cc

index 20a799f3e52fad9ac049986e8dd5bc49bb702e30..4fc0c999340bd990f6b9ec75e29f0f6ffa33dfd6 100644 (file)
@@ -2004,10 +2004,6 @@ void Monitor::handle_command(MMonCommand *m)
     return;
   }
 
-  bool access_cmd;
-  bool access_r;
-  bool access_all;
-
   string module;
   string err;
 
@@ -2020,10 +2016,6 @@ void Monitor::handle_command(MMonCommand *m)
   get_str_vec(prefix, fullcmd);
   module = fullcmd[0];
 
-  access_cmd = _allowed_command(session, cmdmap);
-  access_r = (session->is_capable("mon", MON_CAP_R) || access_cmd);
-  access_all = (session->caps.is_allow_all() || access_cmd);
-
   if (!_allowed_command(session, module, prefix, cmdmap)) {
     dout(1) << __func__ << " access denied" << dendl;
     reply_command(m, -EACCES, "access denied", 0);
@@ -2056,11 +2048,6 @@ void Monitor::handle_command(MMonCommand *m)
   }
 
   if (module == "config-key") {
-    if (!access_all) {
-      r = -EACCES;
-      rs = "access denied";
-      goto out;
-    }
     config_key_service->dispatch(m);
     return;
   }
@@ -2092,11 +2079,6 @@ void Monitor::handle_command(MMonCommand *m)
   }
 
   if (prefix == "compact") {
-    if (!access_all) {
-      r = -EACCES;
-      rs = "access denied";
-      goto out;
-    }
     dout(1) << "triggering manual compaction" << dendl;
     utime_t start = ceph_clock_now(g_ceph_context);
     store->compact();
@@ -2109,11 +2091,6 @@ void Monitor::handle_command(MMonCommand *m)
     r = 0;
   }
   else if (prefix == "injectargs") {
-    if (!access_all) {
-      r = -EACCES;
-      rs = "access denied";
-      goto out;
-    }
     vector<string> injected_args;
     cmd_getval(g_ceph_context, cmdmap, "injected_args", injected_args);
     if (!injected_args.empty()) {
@@ -2133,12 +2110,6 @@ void Monitor::handle_command(MMonCommand *m)
   } else if (prefix == "status" ||
             prefix == "health" ||
             prefix == "df") {
-    if (!access_r) {
-      r = -EACCES;
-      rs = "access denied";
-      goto out;
-    }
-
     string detail;
     cmd_getval(g_ceph_context, cmdmap, "detail", detail);
 
@@ -2189,11 +2160,6 @@ void Monitor::handle_command(MMonCommand *m)
     rs = "";
     r = 0;
   } else if (prefix == "report") {
-    if (!access_r) {
-      r = -EACCES;
-      rs = "access denied";
-      goto out;
-    }
 
     // this must be formatted, in its current form
     if (!f)
@@ -2232,11 +2198,6 @@ void Monitor::handle_command(MMonCommand *m)
     rs = ss2.str();
     r = 0;
   } else if (prefix == "quorum_status") {
-    if (!access_r) {
-      r = -EACCES;
-      rs = "access denied";
-      goto out;
-    }
     // make sure our map is readable and up to date
     if (!is_leader() && !is_peon()) {
       dout(10) << " waiting for quorum" << dendl;
@@ -2248,11 +2209,6 @@ void Monitor::handle_command(MMonCommand *m)
     rs = "";
     r = 0;
   } else if (prefix == "mon_status") {
-    if (!access_r) {
-      r = -EACCES;
-      rs = "access denied";
-      goto out;
-    }
     _mon_status(f.get(), ds);
     rdata.append(ds);
     rs = "";
@@ -2273,11 +2229,6 @@ void Monitor::handle_command(MMonCommand *m)
     rs = ds.str();
     r = 0;
   } else if (prefix == "heap") {
-    if (!access_all) {
-      r = -EACCES;
-      rs = "access denied";
-      goto out;
-    }
     if (!ceph_using_tcmalloc())
       rs = "tcmalloc not enabled, can't use heap profiler commands\n";
     else {
@@ -2292,11 +2243,6 @@ void Monitor::handle_command(MMonCommand *m)
       r = 0;
     }
   } else if (prefix == "quorum") {
-    if (!access_all) {
-      r = -EACCES;
-      rs = "access denied";
-      goto out;
-    }
     string quorumcmd;
     cmd_getval(g_ceph_context, cmdmap, "quorumcmd", quorumcmd);
     if (quorumcmd == "exit") {
@@ -2310,9 +2256,6 @@ void Monitor::handle_command(MMonCommand *m)
       rs = "started responding to quorum, initiated new election";
       r = 0;
     }
-  } else if (!access_cmd) {
-    r = -EACCES;
-    rs = "access denied";
   }
 
  out: