]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
auth: remove remaining globals
authorColin Patrick McCabe <cmccabe@alumni.cmu.edu>
Wed, 15 Jun 2011 20:34:08 +0000 (13:34 -0700)
committerColin Patrick McCabe <cmccabe@alumni.cmu.edu>
Mon, 20 Jun 2011 23:35:18 +0000 (16:35 -0700)
Signed-off-by: Colin McCabe <colin.mccabe@dreamhost.com>
src/auth/AuthAuthorizeHandler.h
src/auth/Crypto.cc
src/auth/Crypto.h
src/auth/cephx/CephxAuthorizeHandler.cc
src/auth/cephx/CephxAuthorizeHandler.h
src/auth/cephx/CephxClientHandler.h
src/auth/cephx/CephxKeyServer.cc
src/auth/none/AuthNoneAuthorizeHandler.cc
src/auth/none/AuthNoneAuthorizeHandler.h
src/mds/MDS.cc
src/osd/OSD.cc

index 40a87658471147280af8c1a22e5b5c19fba88f1a..6a0fe02b7f865e071501c15245a483a62d90203c 100644 (file)
 #ifndef CEPH_AUTHAUTHORIZEHANDLER_H
 #define CEPH_AUTHAUTHORIZEHANDLER_H
 
-#include "include/types.h"
-#include "common/config.h"
 #include "Auth.h"
+#include "include/types.h"
 
+class CephContext;
 class KeyRing;
 class RotatingKeyRing;
 
 struct AuthAuthorizeHandler {
   virtual ~AuthAuthorizeHandler() {}
-  virtual bool verify_authorizer(KeyStore *keys,
+  virtual bool verify_authorizer(CephContext *cct, KeyStore *keys,
                                 bufferlist& authorizer_data, bufferlist& authorizer_reply,
                                  EntityName& entity_name, uint64_t& global_id,
                                 AuthCapsInfo& caps_info, uint64_t *auid = NULL) = 0;
index 9f2a46ec5b2cb603c535a6f0efc649eb3b2e44f3..7251d09eb36f243af6f3eeba913b42aff3bb9fdf 100644 (file)
@@ -350,10 +350,10 @@ CryptoHandler *get_crypto_handler(int type)
 
 // ---------------------------------------------------
 
-int CryptoKey::set_secret(int type, bufferptr& s)
+int CryptoKey::set_secret(CephContext *cct, int type, bufferptr& s)
 {
   this->type = type;
-  created = ceph_clock_now(&g_ceph_context);
+  created = ceph_clock_now(cct);
 
   CryptoHandler *h = get_crypto_handler(type);
   if (!h)
index 18fce89d320cb9498131c7297e24cbe4134fdec6..9ebf24cbfe883eebf1066e7cac12ad267bffa6f5 100644 (file)
@@ -53,7 +53,7 @@ public:
   utime_t get_created() const { return created; }
   void print(std::ostream& out) const;
 
-  int set_secret(int type, bufferptr& s);
+  int set_secret(CephContext *cct, int type, bufferptr& s);
   bufferptr& get_secret() { return secret; }
   const bufferptr& get_secret() const { return secret; }
 
index a86af9ac19f081320660e495dc88b90cc1062476..f33399484be7222f0867a81475f23b3560ea6585 100644 (file)
@@ -5,21 +5,21 @@
 #include "CephxAuthorizeHandler.h"
 
 
-bool CephxAuthorizeHandler::verify_authorizer(KeyStore *keys,
+bool CephxAuthorizeHandler::verify_authorizer(CephContext *cct, KeyStore *keys,
                                              bufferlist& authorizer_data, bufferlist& authorizer_reply,
                                               EntityName& entity_name, uint64_t& global_id, AuthCapsInfo& caps_info, uint64_t *auid)
 {
   bufferlist::iterator iter = authorizer_data.begin();
 
   if (!authorizer_data.length()) {
-    dout(1) << "verify authorizer, authorizer_data.length()=0" << dendl;
+    ldout(cct, 1) << "verify authorizer, authorizer_data.length()=0" << dendl;
     return false;
   }
 
   CephXServiceTicketInfo auth_ticket_info;
 
-  bool isvalid = cephx_verify_authorizer(&g_ceph_context, keys, iter, auth_ticket_info, authorizer_reply);
-  dout(1) << "CephxAuthorizeHandler::verify_authorizer isvalid=" << isvalid << dendl;
+  bool isvalid = cephx_verify_authorizer(cct, keys, iter, auth_ticket_info, authorizer_reply);
+  ldout(cct, 1) << "CephxAuthorizeHandler::verify_authorizer isvalid=" << isvalid << dendl;
 
   if (isvalid) {
     caps_info = auth_ticket_info.ticket.caps;
index 44df8ba1931c5a03e1d46f7a52b1522fa4f957b9..8344b086782254dc14a1dc2f451d1dd029a9f4df 100644 (file)
 
 #include "../AuthAuthorizeHandler.h"
 
+class CephContext;
+
 struct CephxAuthorizeHandler : public AuthAuthorizeHandler {
-  bool verify_authorizer(KeyStore *keys,
+  bool verify_authorizer(CephContext *cct, KeyStore *keys,
                         bufferlist& authorizer_data, bufferlist& authorizer_reply,
                          EntityName& entity_name, uint64_t& global_id,
                         AuthCapsInfo& caps_info, uint64_t *auid = NULL);
index ba46a1833821184120ea524a6a74c0f2e74f5a82..cb878150e7f64b760357b49c55cd84c407945e64 100644 (file)
@@ -38,7 +38,7 @@ public:
       starting(false),
       server_challenge(0),
       authorizer(0),
-      tickets(&g_ceph_context),
+      tickets(cct_),
       rotating_secrets(rsecrets),
       keyring(rsecrets->get_keyring())
   {
index 87fc87bd6f9b0d64eea79354d63ad0941b0fe59c..e2e02a66ffc7e84e8c523fdec2ef5588bb5324ed 100644 (file)
@@ -261,7 +261,7 @@ bool KeyServer::generate_secret(CryptoKey& secret)
   if (crypto->create(bp) < 0)
     return false;
 
-  secret.set_secret(CEPH_CRYPTO_AES, bp);
+  secret.set_secret(cct, CEPH_CRYPTO_AES, bp);
 
   return true;
 }
index b965049a1115cf12d7d511b9dd2923ae07ae306e..37bacffa7effb001974a27cd20162a98d7809adc 100644 (file)
@@ -15,7 +15,7 @@
 #include "AuthNoneAuthorizeHandler.h"
 #include "common/debug.h"
 
-bool AuthNoneAuthorizeHandler::verify_authorizer(KeyStore *keys,
+bool AuthNoneAuthorizeHandler::verify_authorizer(CephContext *cct, KeyStore *keys,
                                                 bufferlist& authorizer_data, bufferlist& authorizer_reply,
                                                 EntityName& entity_name, uint64_t& global_id, AuthCapsInfo& caps_info,
 uint64_t *auid)
@@ -28,7 +28,7 @@ uint64_t *auid)
     ::decode(entity_name, iter);
     ::decode(global_id, iter);
   } catch (const buffer::error &err) {
-    dout(0) << "AuthNoneAuthorizeHandle::verify_authorizer() failed to decode" << dendl;
+    ldout(cct, 0) << "AuthNoneAuthorizeHandle::verify_authorizer() failed to decode" << dendl;
     return false;
   }
 
index a5eaf3b762d59b39b2e64d542a2f1c647c747798..da758709921d5fb5fca2741742bfcbbb98e9216d 100644 (file)
 
 #include "../AuthAuthorizeHandler.h"
 
+class CephContext;
+
 struct AuthNoneAuthorizeHandler : public AuthAuthorizeHandler {
-  bool verify_authorizer(KeyStore *keys,
+  bool verify_authorizer(CephContext *cct, KeyStore *keys,
                         bufferlist& authorizer_data, bufferlist& authorizer_reply,
                          EntityName& entity_name, uint64_t& global_id,
                         AuthCapsInfo& caps_info, uint64_t *auid=NULL);
index ce0f58923045211a0a51f51925764b82a522d4b2..8d0e9bb7c55a59a554d079704e4d9d55b36baca5 100644 (file)
@@ -2024,7 +2024,7 @@ bool MDS::ms_verify_authorizer(Connection *con, int peer_type,
   EntityName name;
   uint64_t global_id;
 
-  is_valid = authorize_handler->verify_authorizer(monc->rotating_secrets,
+  is_valid = authorize_handler->verify_authorizer(cct, monc->rotating_secrets,
                                                  authorizer_data, authorizer_reply, name, global_id, caps_info);
 
   if (is_valid) {
index 2c3dbfde4a4716c00fa53dd48e07ed097d7e548a..05d40f474985df23e4c1e6c7f5962eddb76c14e3 100644 (file)
@@ -2612,7 +2612,7 @@ bool OSD::ms_verify_authorizer(Connection *con, int peer_type,
   uint64_t global_id;
   uint64_t auid = CEPH_AUTH_UID_DEFAULT;
 
-  isvalid = authorize_handler->verify_authorizer(monc->rotating_secrets,
+  isvalid = authorize_handler->verify_authorizer(&g_ceph_context, monc->rotating_secrets,
                                                 authorizer_data, authorizer_reply, name, global_id, caps_info, &auid);
 
   dout(10) << "OSD::ms_verify_authorizer name=" << name << " auid=" << auid << dendl;