]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: the MDS messages use caps->check_privileges instead of the macro
authorGreg Farnum <gregf@hq.newdream.net>
Mon, 22 Mar 2010 18:28:11 +0000 (11:28 -0700)
committerGreg Farnum <gregf@hq.newdream.net>
Tue, 23 Mar 2010 18:41:51 +0000 (11:41 -0700)
src/mon/MDSMonitor.cc
src/mon/Monitor.cc

index 60a238997b752fc528e1799a6d3d1b0000e85552..408d7c1b841f8466a5c4c35022eb1515ad30a894 100644 (file)
@@ -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)
index b834475bd562ad860f5391ea7acd1e7db9286874..eb0ceea9e032def8c2666cd389c4b88dc71038e7 100644 (file)
@@ -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;