Skip to content

Commit

Permalink
Merge pull request #11671 from linuxbox2/rgw_file-17663
Browse files Browse the repository at this point in the history
rgw_file:  apply missed base64 try-catch

Reviewed-by: Yehuda Sadeh <yehuda@redhat.com>
  • Loading branch information
yehudasa committed Nov 29, 2016
2 parents 750d8cf + 87ed19e commit 515c14c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/rgw/rgw_file.h
Original file line number Diff line number Diff line change
Expand Up @@ -837,7 +837,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) {
Expand Down

0 comments on commit 515c14c

Please sign in to comment.