From 7e70afbe2ac856fe010b94a5d028d4fa79cfe2da Mon Sep 17 00:00:00 2001 From: Greg Farnum Date: Mon, 22 Mar 2010 11:28:11 -0700 Subject: [PATCH] mon: the MDS messages use caps->check_privileges instead of the macro --- src/mon/MDSMonitor.cc | 15 +++++++++++++++ src/mon/Monitor.cc | 2 -- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/mon/MDSMonitor.cc b/src/mon/MDSMonitor.cc index 60a238997b752..408d7c1b841f8 100644 --- a/src/mon/MDSMonitor.cc +++ b/src/mon/MDSMonitor.cc @@ -158,6 +158,13 @@ bool MDSMonitor::preprocess_beacon(MMDSBeacon *m) version_t seq = m->get_seq(); MDSMap::mds_info_t info; + //check privileges, ignore if fails + if ( !m->caps->check_privileges(PAXOS_MDSMAP, MON_CAP_X)) { + dout(0) << "received MMDSBeacon from entity with insufficient privileges " + << *m->caps << dendl; + goto out; + } + if (ceph_fsid_compare(&m->get_fsid(), &mon->monmap->fsid)) { dout(0) << "preprocess_beacon on fsid " << m->get_fsid() << " != " << mon->monmap->fsid << dendl; goto out; @@ -240,6 +247,14 @@ bool MDSMonitor::preprocess_beacon(MMDSBeacon *m) bool MDSMonitor::preprocess_offload_targets(MMDSLoadTargets* m) { dout(10) << "preprocess_offload_targets " << *m << " from " << m->get_orig_source() << dendl; + + //check privileges, ignore message if fails + if(!m->caps->check_privileges(PAXOS_MDSMAP, MON_CAP_X)) { + dout(0) << "got MMDSLoadTargets from entity with insufficient caps " + << *m->caps << dendl; + return true; + } + __u64 gid = m->global_id; if (mdsmap.mds_info.count(gid) && m->targets == mdsmap.mds_info[gid].export_targets) diff --git a/src/mon/Monitor.cc b/src/mon/Monitor.cc index b834475bd562a..eb0ceea9e032d 100644 --- a/src/mon/Monitor.cc +++ b/src/mon/Monitor.cc @@ -633,8 +633,6 @@ do { \ // MDSs case MSG_MDS_BEACON: case MSG_MDS_OFFLOAD_TARGETS: - ALLOW_MESSAGES_FROM(CEPH_ENTITY_TYPE_MDS); - ALLOW_CAPS(PAXOS_MDSMAP, MON_CAP_RW); fill_caps(m); paxos_service[PAXOS_MDSMAP]->dispatch((PaxosServiceMessage*)m); break; -- 2.39.5