]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
msg/async: move get_auth_allowed into ProtocolV2.cc
authorSage Weil <sage@redhat.com>
Fri, 11 Jan 2019 21:46:20 +0000 (15:46 -0600)
committerSage Weil <sage@redhat.com>
Thu, 7 Feb 2019 12:53:02 +0000 (06:53 -0600)
We're the only user, and no Dispatchers override.

Signed-off-by: Sage Weil <sage@redhat.com>
src/msg/Dispatcher.h
src/msg/Messenger.cc
src/msg/Messenger.h
src/msg/async/ProtocolV2.cc
src/msg/async/ProtocolV2.h

index 1050308558931f824a20b517988eadb41e35a30d..fef5e3203ffa4e7f8c0004ce483df1421b8d430d 100644 (file)
@@ -203,14 +203,6 @@ public:
    * @{
    */
 
-  /**
-   * Return the allowed authentication methods for peer
-   **/
-  virtual int ms_get_auth_allowed_methods(
-    uint32_t peer_type, std::vector<uint32_t> &allowed_methods) {
-    return 0;
-  }
-
   /**
    * handle successful authentication (msgr2)
    *
index 68825c5f8efa3382e9d728f4d3d0ea83251304bc..d697402b4d193a5df03f251e2962863c2ecd6426 100644 (file)
@@ -116,37 +116,6 @@ int Messenger::bindv(const entity_addrvec_t& addrs)
   return bind(addrs.legacy_addr());
 }
 
-void Messenger::ms_deliver_get_auth_allowed_methods(
-    int peer_type, std::vector<uint32_t> &allowed_methods)
-{
-  for (const auto &dispatcher : dispatchers) {
-    if (dispatcher->ms_get_auth_allowed_methods(peer_type, allowed_methods))
-      return;
-  }
-  if (allowed_methods.empty()) {
-    if (get_mytype() == CEPH_ENTITY_TYPE_MON &&
-        peer_type != CEPH_ENTITY_TYPE_MON) {
-      allowed_methods.push_back(CEPH_AUTH_NONE);
-      return;
-    }
-    std::string method;
-    if (!cct->_conf->auth_supported.empty()) {
-      method = cct->_conf->auth_supported;
-    } else if (peer_type == CEPH_ENTITY_TYPE_OSD ||
-               peer_type == CEPH_ENTITY_TYPE_MDS ||
-               peer_type == CEPH_ENTITY_TYPE_MON ||
-               peer_type == CEPH_ENTITY_TYPE_MGR) {
-      method = cct->_conf->auth_cluster_required;
-    } else {
-      method = cct->_conf->auth_client_required;
-    }
-    AuthMethodList auth_list(cct, method);
-    for (auto pt : auth_list.get_supported_set()) {
-      allowed_methods.push_back(pt);
-    }
-  }
-}
-
 bool Messenger::ms_deliver_verify_authorizer(
   Connection *con,
   int peer_type,
index 500430d21afab2fc4c5ca52cab35e121d58bea98..7134db851da9dd975d3287a3668274712668b9b4 100644 (file)
@@ -758,12 +758,6 @@ public:
     }
   }
 
-  /**
-   * Get allowed authentication methods for a specific peer type
-   **/
-  void ms_deliver_get_auth_allowed_methods(
-      int peer_type, std::vector<uint32_t> &allowed_methods);
-
   /**
    * Get the AuthAuthorizer for a new outgoing Connection.
    *
index 8a96a27486992a8610b06ca8de2e66ac647fb739..6bdbff596422d6900073123feb75f11f1bf3481e 100644 (file)
@@ -41,6 +41,34 @@ struct SHA256SignatureError : public std::exception {
 
 struct DecryptionError : public std::exception {};
 
+void ProtocolV2::get_auth_allowed_methods(
+  int peer_type, std::vector<uint32_t> &allowed_methods)
+{
+  // FIXME: this is for legacy MAuth-based authentication
+  if (messenger->get_mytype() == CEPH_ENTITY_TYPE_MON &&
+      peer_type != CEPH_ENTITY_TYPE_MON) {
+    allowed_methods.push_back(CEPH_AUTH_NONE);
+    return;
+  }
+
+  std::string method;
+  if (!cct->_conf->auth_supported.empty()) {
+    method = cct->_conf->auth_supported;
+  } else if (peer_type == CEPH_ENTITY_TYPE_OSD ||
+            peer_type == CEPH_ENTITY_TYPE_MDS ||
+            peer_type == CEPH_ENTITY_TYPE_MON ||
+            peer_type == CEPH_ENTITY_TYPE_MGR) {
+    method = cct->_conf->auth_cluster_required;
+  } else {
+    method = cct->_conf->auth_client_required;
+  }
+  AuthMethodList auth_list(cct, method);
+  for (auto pt : auth_list.get_supported_set()) {
+    allowed_methods.push_back(pt);
+  }
+}
+
+
 void ProtocolV2::run_continuation(CtPtr continuation) {
   try {
     CONTINUATION_RUN(continuation)
@@ -2515,8 +2543,8 @@ CtPtr ProtocolV2::handle_auth_request(char *payload, uint32_t length) {
                  << dendl;
 
   std::vector<uint32_t> allowed_methods;
-  messenger->ms_deliver_get_auth_allowed_methods(connection->peer_type,
-                                                 allowed_methods);
+  get_auth_allowed_methods(connection->peer_type,
+                          allowed_methods);
 
   bool found = std::find(allowed_methods.begin(), allowed_methods.end(),
                          auth_request.method()) != allowed_methods.end();
index 5ac7f72c7006e7ebe0bcd085096556b68f54e417..c849bd50654b4aa460b5ff860ba0712f275e0ae8 100644 (file)
@@ -112,6 +112,9 @@ private:
 
   bool keepalive;
 
+  void get_auth_allowed_methods(
+    int peer_type, std::vector<uint32_t> &allowed_methods);
+
   ostream &_conn_prefix(std::ostream *_dout);
   void run_continuation(Ct<ProtocolV2> *continuation);
   void calc_signature(const char *in, uint32_t length, char *out);