]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
auth/cephx: do not require a cct for accessing config
authorKefu Chai <kchai@redhat.com>
Fri, 26 Apr 2019 01:55:59 +0000 (09:55 +0800)
committerKefu Chai <kchai@redhat.com>
Sun, 28 Apr 2019 16:12:57 +0000 (00:12 +0800)
crimson/msgr does not depend on ConfigProxy at the time of writing. we
want to decouple it from config subsystem in hope to have less cross
subsystem dependencies and speed up the compiling speed.

but, to introduce cephx to msgr, we need to enable msgr to read from
ConfigProxy at runtime. so, to avoid keeping a CephContext instance
simply for accessing the ConfigProxy reference in it, it would be more
efficient to define a free function `conf()` which hides the difference
between crimson and classic user of auth/cephx.

Signed-off-by: Kefu Chai <kchai@redhat.com>
src/auth/cephx/CephxSessionHandler.cc

index 16c1251841601811db4fc1422f5eb5ab803fe58e..6ef45eaa76f762f3d78b86456cdc486a60127859 100644 (file)
 
 #define dout_subsys ceph_subsys_auth
 
+namespace {
+#ifdef WITH_SEASTAR
+  ceph::common::ConfigProxy& conf(CephContext*) {
+    return ceph::common::local_conf();
+  }
+#else
+  ConfigProxy& conf(CephContext* cct) {
+    return cct->_conf;
+  }
+#endif
+}
+
 int CephxSessionHandler::_calc_signature(Message *m, uint64_t *psig)
 {
   const ceph_msg_header& header = m->get_header();
@@ -124,7 +136,7 @@ int CephxSessionHandler::_calc_signature(Message *m, uint64_t *psig)
 int CephxSessionHandler::sign_message(Message *m)
 {
   // If runtime signing option is off, just return success without signing.
-  if (!cct->_conf->cephx_sign_messages) {
+  if (!conf(cct)->cephx_sign_messages) {
     return 0;
   }
 
@@ -144,7 +156,7 @@ int CephxSessionHandler::sign_message(Message *m)
 int CephxSessionHandler::check_message_signature(Message *m)
 {
   // If runtime signing option is off, just return success without checking signature.
-  if (!cct->_conf->cephx_sign_messages) {
+  if (!conf(cct)->cephx_sign_messages) {
     return 0;
   }
   if ((features & CEPH_FEATURE_MSG_AUTH) == 0) {