From: Somnath Roy Date: Wed, 22 Jan 2014 18:30:32 +0000 (-0800) Subject: Pipe, cephx: Message signing under config option X-Git-Tag: v0.78~231^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F1151%2Fhead;p=ceph.git Pipe, cephx: Message signing under config option The config option was present earlier but the option is checked not in the beginning, so, it was doing some stuff. Now the config option guard is at the very beginning of the function. Signed-off-by: Somnath Roy Signed-off-by: Greg Farnum --- diff --git a/src/auth/cephx/CephxSessionHandler.cc b/src/auth/cephx/CephxSessionHandler.cc index 460e2526e10e..b2d402d2af36 100644 --- a/src/auth/cephx/CephxSessionHandler.cc +++ b/src/auth/cephx/CephxSessionHandler.cc @@ -26,14 +26,13 @@ int CephxSessionHandler::sign_message(Message *m) { - bufferlist bl_plaintext, bl_encrypted; - ceph_msg_header header = m->get_header(); - std::string error; - // If runtime signing option is off, just return success without signing. if (!cct->_conf->cephx_sign_messages) { return 0; } + bufferlist bl_plaintext, bl_encrypted; + ceph_msg_header header = m->get_header(); + std::string error; ceph_msg_footer& en_footer = m->get_footer(); @@ -71,16 +70,16 @@ int CephxSessionHandler::sign_message(Message *m) int CephxSessionHandler::check_message_signature(Message *m) { - bufferlist bl_plaintext, bl_ciphertext; - std::string sig_error; - ceph_msg_header& header = m->get_header(); - ceph_msg_footer& footer = m->get_footer(); - // If runtime signing option is off, just return success without checking signature. if (!cct->_conf->cephx_sign_messages) { return 0; } + bufferlist bl_plaintext, bl_ciphertext; + std::string sig_error; + ceph_msg_header& header = m->get_header(); + ceph_msg_footer& footer = m->get_footer(); + if ((features & CEPH_FEATURE_MSG_AUTH) == 0) { // it's fine, we didn't negotiate this feature. return 0;