From 87ed19e4019e17ea95b27d9c8854027969b445a3 Mon Sep 17 00:00:00 2001 From: Matt Benjamin Date: Thu, 27 Oct 2016 17:23:23 -0400 Subject: [PATCH] rgw_file: apply missed base64 try-catch Fixes a case missed in 0a4c91ec. Affects only librgw/rgw_file (i.e., RGW-NFS). Fixes: http://tracker.ceph.com/issues/17663 Signed-off-by: Matt Benjamin --- src/rgw/rgw_file.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/rgw/rgw_file.h b/src/rgw/rgw_file.h index 4cec6e7d5e95..6af23a9917e7 100644 --- a/src/rgw/rgw_file.h +++ b/src/rgw/rgw_file.h @@ -834,7 +834,13 @@ namespace rgw { } else { /* try external authenticators (ldap for now) */ rgw::LDAPHelper* ldh = rgwlib.get_ldh(); /* !nullptr */ - RGWToken token{from_base64(key.id)}; + RGWToken token; + /* boost filters and/or string_ref may throw on invalid input */ + try { + token = rgw::from_base64(key.id); + } catch(...) { + token = std::string(""); + } if (token.valid() && (ldh->auth(token.id, token.key) == 0)) { /* try to store user if it doesn't already exist */ if (rgw_get_user_info_by_uid(store, token.id, user) < 0) { -- 2.47.3