From: Dunrong Huang Date: Wed, 25 Nov 2015 11:03:03 +0000 (+0800) Subject: auth: fix a crash issue due to CryptoHandler::create() failed X-Git-Tag: v0.94.7~3^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=a371c0f1d69fea131b56100492d3045c15ae072c;p=ceph.git auth: fix a crash issue due to CryptoHandler::create() failed In this case(e.g. user passes wrong key), attempts to call the CryptoKey.ckh will lead to a segfault. This patch fixes crash issue like following: Program received signal SIGSEGV, Segmentation fault. [Switching to Thread 0x7fffed10e700 (LWP 25051)] 0x00007ffff59896c6 in CryptoKey::encrypt (this=0x7fffed10d4f0, cct=0x555555829c30, in=..., out=..., error=0x7fffed10d440) at auth/cephx/../Crypto.h:110 110 return ckh->encrypt(in, out, error); (gdb) bt at auth/cephx/../Crypto.h:110 at auth/cephx/CephxProtocol.h:464 Signed-off-by: Dunrong Huang (cherry picked from commit a7f520caabf997b3753f1200f19f21830531b3f5) Signed-off-by: Brad Hubbard --- diff --git a/src/auth/Crypto.cc b/src/auth/Crypto.cc index 4f6367dc2c6d..7d7e4d507021 100644 --- a/src/auth/Crypto.cc +++ b/src/auth/Crypto.cc @@ -419,6 +419,8 @@ int CryptoKey::_set_secret(int t, const bufferptr& s) if (error.length()) { return -EIO; } + } else { + return -EOPNOTSUPP; } type = t; secret = s;