]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: fix for mfa resync crash when supplied with only one totp_pin. 42652/head
authorPritha Srivastava <prsrivas@redhat.com>
Fri, 16 Apr 2021 08:28:27 +0000 (13:58 +0530)
committerCory Snyder <csnyder@iland.com>
Wed, 4 Aug 2021 16:09:34 +0000 (12:09 -0400)
The fix returns an appropriate error message.

fixes: https://tracker.ceph.com/issues/50394

Signed-off-by: Pritha Srivastava <prsrivas@redhat.com>
(cherry picked from commit 1b943419c45a9b17be71668bd023aeb814171b2c)

src/rgw/rgw_admin.cc

index a57e2cacd7bed8ea932f2bf70413e3e89c5d7a6c..451e49526fb74218ba274e6db42e2d914cbe4bd9 100644 (file)
@@ -2753,8 +2753,6 @@ static int scan_totp(CephContext *cct, ceph::real_time& now, rados::cls::otp::ot
                      time_t *pofs)
 {
 #define MAX_TOTP_SKEW_HOURS (24 * 7)
-  ceph_assert(pins.size() == 2);
-
   time_t start_time = ceph::real_clock::to_time_t(now);
   time_t time_ofs = 0, time_ofs_abs = 0;
   time_t step_size = totp.step_size;
@@ -9121,6 +9119,7 @@ next:
 
     if (totp_pin.size() != 2) {
       cerr << "ERROR: missing two --totp-pin params (--totp-pin=<first> --totp-pin=<second>)" << std::endl;
+      return EINVAL;
     }
 
     rados::cls::otp::otp_info_t config;