]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
Merge branch 'auth' of ceph.newdream.net:git/ceph into auth
authorSage Weil <sage@newdream.net>
Wed, 21 Oct 2009 23:23:37 +0000 (16:23 -0700)
committerSage Weil <sage@newdream.net>
Wed, 21 Oct 2009 23:23:37 +0000 (16:23 -0700)
Conflicts:
src/Makefile.am
src/auth/AuthorizeServer.h
src/mon/Monitor.cc

1  2 
src/Makefile.am
src/mon/Monitor.cc
src/mon/Monitor.h
src/osd/OSD.cc
src/osd/OSD.h
src/vstart.sh

diff --cc src/Makefile.am
index a2a186e4e51785e0d4edd98c8d5fb0dc68e97592,4ba886ca7139aacd74d3dbf752213d828a5c3b31..95dd5ae50f45d87474fb3dccb2df9b8e54a3f7d9
@@@ -294,7 -290,7 +294,6 @@@ libcommon_a_SOURCES = 
  libcommon_files = \
        auth/Auth.cc \
        auth/AuthClientHandler.cc \
-       auth/AuthorizeServer.cc \
 -      auth/AuthServiceManager.cc \
        auth/Crypto.cc \
        auth/ExportControl.cc \
        auth/KeyRing.cc \
@@@ -332,7 -328,6 +331,8 @@@ libcrush_a_SOURCES = 
        crush/crush.c
  
  libmon_a_SOURCES = \
 +      auth/AuthServiceHandler.cc \
++      auth/AuthorizeServer.cc \
        mon/Monitor.cc \
        mon/Paxos.cc \
        mon/PaxosService.cc \
@@@ -399,9 -393,8 +399,8 @@@ libclient_a_SOURCES = 
  # that autotools doesn't magically identify.
  noinst_HEADERS = \
        auth/Auth.h\
-       auth/AuthorizeServer.h\
        auth/AuthProtocol.h\
 -      auth/AuthServiceManager.h\
 +      auth/AuthServiceHandler.h\
        auth/KeyRing.h\
        auth/KeysServer.h\
        auth/Crypto.h\
index b9bd54dad15b96d8251161769b8a6142a09f60fb,3b1cc96cfa1b87835ce2414e0c9a7aa6d628b20a..2215c707924c4c32366dfd7725e0a2ab6452c0f7
@@@ -854,6 -758,77 +858,68 @@@ void Monitor::handle_class(MClass *m
    }
  }
  
 -void Monitor::handle_route(MRoute *m)
 -{
 -  dout(10) << "handle_route " << *m->msg << " to " << m->dest << dendl;
 -  
 -  messenger->send_message(m->msg, m->dest);
 -  m->msg = NULL;
 -  delete m;
 -}
 -
+ void Monitor::handle_authorize(MAuthorize *m)
+ {
+   dout(0) << "AuthorizeServer::handle_request() blob_size=" << m->get_auth_payload().length() << dendl;
+   int ret = 0;
+   Session *s = (Session *)m->get_connection()->get_priv();
+   s->put();
+   bufferlist response_bl;
+   bufferlist::iterator indata = m->auth_payload.begin();
+   CephXPremable pre;
+   ::decode(pre, indata);
+   dout(0) << "CephXPremable id=" << pre.trans_id << dendl;
+   ::encode(pre, response_bl);
+   // handle the request
+   try {
+     ret = do_authorize(indata, response_bl);
+   } catch (buffer::error *err) {
+     ret = -EINVAL;
+     dout(0) << "caught error when trying to handle authorize request, probably malformed request" << dendl;
+   }
+   MAuthReply *reply = new MAuthReply(&response_bl, ret);
+   messenger->send_message(reply, m->get_orig_source_inst());
+ }
+ int Monitor::do_authorize(bufferlist::iterator& indata, bufferlist& result_bl)
+ {
+   struct CephXRequestHeader cephx_header;
+   ::decode(cephx_header, indata);
+   uint16_t request_type = cephx_header.request_type & CEPHX_REQUEST_TYPE_MASK;
+   int ret;
+   dout(0) << "request_type=" << request_type << dendl;
+   switch (request_type) {
+   case CEPHX_OPEN_SESSION:
+     {
+       dout(0) << "CEPHX_OPEN_SESSION " << cephx_header.request_type << dendl;
+       AuthServiceTicketInfo auth_ticket_info;
+       bufferlist tmp_bl;
+       ret = verify_authorizer(keys_server, indata, auth_ticket_info, tmp_bl);
+       result_bl.claim_append(tmp_bl);
+     }
+     break;
+   default:
+     ret = -EINVAL;
+     break;
+   }
+   struct CephXResponseHeader header;
+   header.request_type = request_type;
+   header.status = ret;
+   ::encode(header, result_bl);
+   return ret;
+ }
  bool Monitor::ms_get_authorizer(int dest_type, bufferlist& authorizer, bool force_new)
  {
    AuthServiceTicketInfo auth_ticket_info;
Simple merge
diff --cc src/osd/OSD.cc
Simple merge
diff --cc src/osd/OSD.h
Simple merge
diff --cc src/vstart.sh
Simple merge