From: Joao Eduardo Luis Date: Wed, 22 Oct 2014 18:30:08 +0000 (+0100) Subject: mon: Monitor: MMonGetMap doesn't require caps X-Git-Tag: v0.87~13^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F2777%2Fhead;p=ceph.git mon: Monitor: MMonGetMap doesn't require caps We are dropping the requirement for MON_CAP_R for MMonGetMap. Reason is simple enough: clients may need to contact the monitors and obtain the latest monmap before authenticating. This happens, for instance, when a client calls MonClient::get_monmap_privately(). The osd uses this function during mkfs, prior to initializing a keyring or even so much as existing. Fixes: #9859 Signed-off-by: Joao Eduardo Luis --- diff --git a/src/mon/Monitor.cc b/src/mon/Monitor.cc index a9f10bd7fd34..52df6f012d34 100644 --- a/src/mon/Monitor.cc +++ b/src/mon/Monitor.cc @@ -3179,6 +3179,17 @@ void Monitor::dispatch(MonSession *s, Message *m, const bool src_is_mon) handle_ping(static_cast(m)); break; + /* MMonGetMap may be used by clients to obtain a monmap *before* + * authenticating with the monitor. We need to handle these without + * checking caps because, even on a cluster without cephx, we only set + * session caps *after* the auth handshake. A good example of this + * is when a client calls MonClient::get_monmap_privately(), which does + * not authenticate when obtaining a monmap. + */ + case CEPH_MSG_MON_GET_MAP: + handle_mon_get_map(static_cast(m)); + break; + default: dealt_with = false; break; @@ -3249,10 +3260,6 @@ void Monitor::dispatch(MonSession *s, Message *m, const bool src_is_mon) switch (m->get_type()) { // misc - case CEPH_MSG_MON_GET_MAP: - handle_mon_get_map(static_cast(m)); - break; - case CEPH_MSG_MON_GET_VERSION: handle_get_version(static_cast(m)); break;