]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
auth: fix a crash issue due to CryptoHandler::create() failed
authorDunrong Huang <riegamaths@gmail.com>
Wed, 25 Nov 2015 11:03:03 +0000 (19:03 +0800)
committerDunrong Huang <riegamaths@gmail.com>
Sat, 28 Nov 2015 15:48:23 +0000 (23:48 +0800)
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 <riegamaths@gmail.com>
src/auth/Crypto.cc

index 5386319d60875e6c44279550963016c501891a29..000a5b4739dcaf597f4bd2ae3fc628675d33ca27 100644 (file)
@@ -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;