]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
auth: clean out old authorizer cruft, unneeded AuthContext
authorSage Weil <sage@newdream.net>
Thu, 22 Oct 2009 18:42:15 +0000 (11:42 -0700)
committerSage Weil <sage@newdream.net>
Thu, 22 Oct 2009 18:42:15 +0000 (11:42 -0700)
Just put timestamp in the Authorizer itself.  The other
AuthContext fields were unused.

src/auth/Auth.cc
src/auth/Auth.h

index 75d013ac1f703f5616312c21c23d93c44c09f288..b0fa084c026976a8a2aeab510817f5f6ca6b6f52 100644 (file)
@@ -171,7 +171,7 @@ bool AuthTicketsManager::verify_service_ticket_reply(CryptoKey& secret,
 bool AuthTicketHandler::build_authorizer(AuthAuthorizer& authorizer)
 {
   authorizer.session_key = session_key;
-  authorizer.ctx.timestamp = g_clock.now();
+  authorizer.timestamp = g_clock.now();
 
   dout(0) << "build_authorizer: service_id=" << service_id << dendl;
 
@@ -180,7 +180,7 @@ bool AuthTicketHandler::build_authorizer(AuthAuthorizer& authorizer)
   ::encode(ticket, authorizer.bl);
 
   AuthAuthorize msg;
-  msg.now = authorizer.ctx.timestamp;
+  msg.now = authorizer.timestamp;
   if (encode_encrypt(msg, session_key, authorizer.bl) < 0)
     return false;
 
@@ -260,27 +260,6 @@ bool verify_authorizer(KeysKeeper& keys, bufferlist::iterator& indata,
 
   return true;
 }
-#if 0
-bool AuthTicketHandler::decode_reply_authorizer(bufferlist::iterator& indata, AuthAuthorizeReply& reply)
-{
-  if (decode_decrypt(reply, session_key, indata) < 0)
-    return false;
-
-  return true;
-}
-
-/*
- * PRINCIPAL: verify reply is authentic
- */
-bool AuthTicketHandler::verify_reply_authorizer(AuthContext& ctx, AuthAuthorizeReply& reply)
-{
-  if (ctx.timestamp + 1 == reply.timestamp) {
-    return true;
-  }
-
-  return false;
-}
-#endif
 
 bool AuthAuthorizer::verify_reply(bufferlist::iterator& indata)
 {
@@ -289,7 +268,7 @@ bool AuthAuthorizer::verify_reply(bufferlist::iterator& indata)
   if (decode_decrypt(reply, session_key, indata) < 0)
     return false;
 
-  if (ctx.timestamp + 1 != reply.timestamp) {
+  if (timestamp + 1 != reply.timestamp) {
     return false;
   }
 
index 39572a1829438792e7852a32f4a9cb2c8c92f314..1ad2d7314c6406710575fdce5ef995db5fc55c88 100644 (file)
@@ -40,13 +40,6 @@ struct EntityAuth {
 };
 WRITE_CLASS_ENCODER(EntityAuth)
 
-struct AuthContext {
-  int status;
-  // int id;
-  utime_t timestamp;
-  Cond *cond;
-};
-
 /*
  * The ticket (if properly validated) authorizes the principal use
  * services as described by 'caps' during the specified validity
@@ -182,7 +175,7 @@ WRITE_CLASS_ENCODER(AuthAuthorizeReply);
 
 struct AuthAuthorizer {
   CryptoKey session_key;
-  AuthContext ctx;
+  utime_t timestamp;
 
   bufferlist bl;
 
@@ -213,10 +206,6 @@ struct AuthTicketHandler {
 #endif
   // to access the service
   bool build_authorizer(AuthAuthorizer& authorizer);
-#if 0
-  bool decode_reply_authorizer(bufferlist::iterator& indata, AuthAuthorizeReply& reply);
-  bool verify_reply_authorizer(AuthContext& ctx, AuthAuthorizeReply& reply);
-#endif
 
   bool has_key() { return has_key_flag; }
 };