From: Pritha Srivastava Date: Fri, 16 Apr 2021 08:28:27 +0000 (+0530) Subject: rgw: fix for mfa resync crash when supplied with only one totp_pin. X-Git-Tag: v16.2.6~106^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F42652%2Fhead;p=ceph.git rgw: fix for mfa resync crash when supplied with only one totp_pin. The fix returns an appropriate error message. fixes: https://tracker.ceph.com/issues/50394 Signed-off-by: Pritha Srivastava (cherry picked from commit 1b943419c45a9b17be71668bd023aeb814171b2c) --- diff --git a/src/rgw/rgw_admin.cc b/src/rgw/rgw_admin.cc index a57e2cacd7be..451e49526fb7 100644 --- a/src/rgw/rgw_admin.cc +++ b/src/rgw/rgw_admin.cc @@ -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= --totp-pin=)" << std::endl; + return EINVAL; } rados::cls::otp::otp_info_t config;