]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
msg/async,auth: add AuthConnectionMeta to Protocol
authorSage Weil <sage@redhat.com>
Wed, 16 Jan 2019 20:57:13 +0000 (14:57 -0600)
committerSage Weil <sage@redhat.com>
Thu, 7 Feb 2019 12:53:03 +0000 (06:53 -0600)
This will hold all of the authentication-related state in an easy-to-find
section that can be accessed via a Connection* or by the protocol stack
(as needed).

Signed-off-by: Sage Weil <sage@redhat.com>
src/auth/Auth.h
src/msg/Connection.h
src/msg/async/AsyncConnection.cc
src/msg/async/AsyncConnection.h
src/msg/async/Protocol.h

index 69c488af776fb02d79202676db9ac1c2b2620f4c..307afdd9cfbec68402b9b6eb99ba2eabd16ffca6 100644 (file)
@@ -148,6 +148,13 @@ struct AuthAuthorizerChallenge {
   virtual ~AuthAuthorizerChallenge() {}
 };
 
+struct AuthConnectionMeta {
+  uint32_t auth_method = CEPH_AUTH_UNKNOWN;
+  CryptoKey session_key;
+  CryptoKey connection_secret;
+  std::unique_ptr<AuthAuthorizer> authorizer;
+  std::unique_ptr<AuthAuthorizerChallenge> authorizer_challenge;
+};
 
 /*
  * Key management
index 90d3459c1dac7e79ba05907ed5d2d00e0c45dd66..b9bddc2c6606222cd5fd7e6a7bb429fe5b2dddca 100644 (file)
@@ -103,6 +103,10 @@ public:
     return msgr;
   }
 
+  virtual AuthConnectionMeta *get_auth_meta() {
+    return nullptr;
+  }
+
   /**
    * Queue the given Message to send out on the given Connection.
    * Success in this function does not guarantee Message delivery, only
index 92b0df9cfb7632554e8f3a3da1ad2214fd6a0d65..7e81dfd37bdb1eda1f2c6351db3cd7cd7f31544c 100644 (file)
@@ -445,6 +445,11 @@ bool AsyncConnection::is_connected() {
   return protocol->is_connected();
 }
 
+AuthConnectionMeta *AsyncConnection::get_auth_meta()
+{
+  return &protocol->auth_meta;
+}
+
 void AsyncConnection::connect(const entity_addrvec_t &addrs, int type,
                               entity_addr_t &target) {
 
index 3edd30cf96fc0a870d0eb71f9962fa1086088e11..d96b8da20af78d86d4c37885ef8b1d5f0badf761 100644 (file)
@@ -132,9 +132,11 @@ class AsyncConnection : public Connection {
     policy.lossy = true;
   }
 
- entity_addr_t get_peer_socket_addr() const override {
-   return target_addr;
- }
+  entity_addr_t get_peer_socket_addr() const override {
+    return target_addr;
+  }
+
+  AuthConnectionMeta *get_auth_meta() override;
 
  private:
   enum {
index 8eecb7c2e5fcaac9f39de5fadf26bda54957a67d..cf9005b1b6684e3aeddf98b03bc4d55ac9601292 100644 (file)
@@ -79,6 +79,8 @@ protected:
   AsyncConnection *connection;
   AsyncMessenger *messenger;
   CephContext *cct;
+public:
+  AuthConnectionMeta auth_meta;
 
 public:
   Protocol(int type, AsyncConnection *connection);
@@ -102,6 +104,10 @@ public:
   virtual void read_event() = 0;
   virtual void write_event() = 0;
   virtual bool is_queued() = 0;
+
+  virtual AuthConnectionMeta *get_auth_meta() {
+    return nullptr;
+  }
 };
 
 #endif /* _MSG_ASYNC_PROTOCOL_ */