]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
CephxProtocol.cc: invalid authorizer data should not crash the osd
authorSamuel Just <samuel.just@dreamhost.com>
Sat, 19 Mar 2011 00:40:41 +0000 (17:40 -0700)
committerSamuel Just <samuel.just@dreamhost.com>
Sat, 19 Mar 2011 00:41:32 +0000 (17:41 -0700)
Signed-off-by: Samuel Just <samuel.just@dreamhost.com>
src/auth/cephx/CephxProtocol.cc

index 03d7a821bf8a34c7337a29e9fa63fc49f8f5c3aa..c0b2cb9ece32b0ced01db9ee0a9e5b9b20c8c3ff 100644 (file)
@@ -16,6 +16,7 @@
 #include "common/Clock.h"
 #include "common/config.h"
 #include "common/debug.h"
+#include "include/buffer.h"
 
 #define DOUT_SUBSYS auth
 #undef dout_prefix
@@ -368,18 +369,22 @@ bool cephx_verify_authorizer(KeyStore *keys,
                             CephXServiceTicketInfo& ticket_info, bufferlist& reply_bl)
 {
   __u8 authorizer_v;
-  ::decode(authorizer_v, indata);
-
   uint32_t service_id;
   uint64_t global_id;
   CryptoKey service_secret;
-
-  ::decode(global_id, indata);
-  ::decode(service_id, indata);
-
   // ticket blob
   CephXTicketBlob ticket;
-  ::decode(ticket, indata);
+
+
+  try {
+    ::decode(authorizer_v, indata);
+    ::decode(global_id, indata);
+    ::decode(service_id, indata);
+    ::decode(ticket, indata);
+  } catch (buffer::end_of_buffer e) {
+    // Unable to decode!
+    return false;
+  }
   dout(10) << "verify_authorizer decrypted service " << ceph_entity_type_name(service_id)
           << " secret_id=" << ticket.secret_id << dendl;