]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: simplify session peer type check
authorSage Weil <sage@inktank.com>
Thu, 7 Jun 2012 02:30:19 +0000 (19:30 -0700)
committerSage Weil <sage@inktank.com>
Tue, 12 Jun 2012 18:50:54 +0000 (11:50 -0700)
Check the authenticated peer name directly; don't store a copy in the
OSDCaps struct.  Also set the entity_name member of the session!

Signed-off-by: Sage Weil <sage@inktank.com>
src/osd/OSD.cc

index 00f32154ba15db8100998130978602484b9084f4..5a59ed76ee680b7f307661c88e1934e5402f77fe 100644 (file)
@@ -2759,14 +2759,14 @@ bool OSD::ms_verify_authorizer(Connection *con, int peer_type,
       dout(10) << " new session " << s << " con=" << s->con << " addr=" << s->con->get_peer_addr() << dendl;
     }
 
+    s->entity_name = name;
     s->caps.set_allow_all(caps_info.allow_all);
     s->caps.set_auid(auid);
-    s->caps.set_peer_type(peer_type);
  
     if (caps_info.caps.length() > 0) {
       bufferlist::iterator iter = caps_info.caps.begin();
       s->caps.parse(iter);
-      dout(10) << " session " << s << " has caps " << s->caps << dendl;
+      dout(10) << " session " << s << " " << s->entity_name << " has caps " << s->caps << dendl;
     }
     
     s->put();
@@ -2883,8 +2883,8 @@ void OSD::_dispatch(Message *m)
   case CEPH_MSG_SHUTDOWN:
     session = (Session *)m->get_connection()->get_priv();
     if (!session ||
-       session->caps.is_mon() ||
-       session->caps.is_osd()) shutdown();
+       session->entity_name.is_mon() ||
+       session->entity_name.is_osd()) shutdown();
     else dout(0) << "shutdown message from connection with insufficient privs!"
                 << m->get_connection() << dendl;
     m->put();
@@ -3160,7 +3160,7 @@ void OSD::handle_osd_map(MOSDMap *m)
   }
 
   Session *session = (Session *)m->get_connection()->get_priv();
-  if (session && !(session->caps.is_mon() || session->caps.is_osd())) {
+  if (session && !(session->entity_name.is_mon() || session->entity_name.is_osd())) {
     //not enough perms!
     m->put();
     session->put();