From: Radoslaw Zarzynski Date: Sun, 27 Jan 2019 19:28:40 +0000 (+0100) Subject: msg/async: ensure consistency between con_mode and session_security. X-Git-Tag: v14.1.1~157^2~52 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=8245a291899e1a0ece351ccca858825fc7e819ce;p=ceph.git msg/async: ensure consistency between con_mode and session_security. Signed-off-by: Radoslaw Zarzynski --- diff --git a/src/msg/async/ProtocolV2.cc b/src/msg/async/ProtocolV2.cc index 7bec0e69fff..30e61934408 100644 --- a/src/msg/async/ProtocolV2.cc +++ b/src/msg/async/ProtocolV2.cc @@ -1061,7 +1061,8 @@ uint32_t ProtocolV2::calculate_payload_size( AuthStreamHandler *stream_handler, uint32_t length) { - if (stream_handler) { + if (auth_meta.is_mode_secure()) { + ceph_assert(stream_handler != nullptr); return stream_handler->calculate_payload_size(length); } else { return length; @@ -1069,17 +1070,19 @@ uint32_t ProtocolV2::calculate_payload_size( } void ProtocolV2::authencrypt_payload(bufferlist &payload) { - // using tx - if (session_security.tx) { + if (auth_meta->is_mode_secure()) { + // using tx + ceph_assert(session_security.tx); session_security.tx->authenticated_encrypt(payload); - // padding will be always present - ceph_assert_always(payload.length() > 0); + ceph_assert(payload.length() > 0); } } void ProtocolV2::authdecrypt_payload(char *payload, uint32_t &length) { - // using rx - if (session_security.rx) { + if (auth_meta->is_mode_secure()) { + ceph_assert(session_security.rx); + // using rx + ceph_assert(length > 0); session_security.rx->authenticated_decrypt(payload, length); } }