Skip to content

Commit

Permalink
Merge pull request ceph#26130 from minshenglin/wip-37855
Browse files Browse the repository at this point in the history
rgw_file: use correct secret key to check auth
  • Loading branch information
mattbenjamin authored Feb 26, 2019
2 parents 59a99df + e92755c commit c5f21d2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
8 changes: 6 additions & 2 deletions src/rgw/rgw_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -771,11 +771,15 @@ struct RGWUserInfo
type(TYPE_NONE) {
}

RGWAccessKey* get_key0() {
RGWAccessKey* get_key(const string& access_key) {
if (access_keys.empty())
return nullptr;

auto k = access_keys.find(access_key);
if (k == access_keys.end())
return nullptr;
else
return &(access_keys.begin()->second);
return &(k->second);
}

void encode(bufferlist& bl) const {
Expand Down
5 changes: 2 additions & 3 deletions src/rgw/rgw_file.h
Original file line number Diff line number Diff line change
Expand Up @@ -945,9 +945,8 @@ namespace rgw {
int authorize(RGWRados* store) {
int ret = rgw_get_user_info_by_access_key(store, key.id, user);
if (ret == 0) {
RGWAccessKey* key0 = user.get_key0();
if (!key0 ||
(key0->key != key.key))
RGWAccessKey* k = user.get_key(key.id);
if (!k || (k->key != key.key))
return -EINVAL;
if (user.suspended)
return -ERR_USER_SUSPENDED;
Expand Down

0 comments on commit c5f21d2

Please sign in to comment.