From 2f994ff8b4f95ec9611ed6e1d0bcf26b8d0a03a4 Mon Sep 17 00:00:00 2001 From: Yehuda Sadeh Date: Wed, 28 Oct 2009 15:51:07 -0700 Subject: [PATCH] auth: check caps before allowing osdmap, mdsmap subscription --- src/mon/Monitor.cc | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/mon/Monitor.cc b/src/mon/Monitor.cc index 8f9790dab89db..29f9f8414c93b 100644 --- a/src/mon/Monitor.cc +++ b/src/mon/Monitor.cc @@ -699,20 +699,23 @@ void Monitor::handle_subscribe(MMonSubscribe *m) s->until = g_clock.now(); s->until += g_conf.mon_subscribe_interval; - for (map::iterator p = m->what.begin(); p != m->what.end(); p++) { if (!p->second.onetime) reply = true; session_map.add_update_sub(s, p->first, p->second.have, p->second.onetime); - - if (p->first == "mdsmap") - mdsmon()->check_sub(s->sub_map["mdsmap"]); - else if (p->first == "osdmap") - osdmon()->check_sub(s->sub_map["osdmap"]); - else if (p->first == "monmap") + if (p->first == "mdsmap") { + if ((int)s->caps.get_caps(PAXOS_MDSMAP) & (MON_CAP_R)) { + mdsmon()->check_sub(s->sub_map["mdsmap"]); + } + } else if (p->first == "osdmap") { + if ((int)s->caps.get_caps(PAXOS_OSDMAP) & (MON_CAP_R)) { + osdmon()->check_sub(s->sub_map["osdmap"]); + } + } else if (p->first == "monmap") { check_sub(s->sub_map["monmap"]); + } } // ??? -- 2.39.5