Skip to contentSkip to conversation

RGWUserInfo encode/decode

DISCUSSION Pete Zaitcev 2 participants 2 messages Aug 13, 2015

lore
Share & tools
lore
#0 lore raw

Hi,

I stumpbled upon a code like this in src/rgw/rgw_common.h:

struct RGWUserInfo {
map<string, RGWAccessKey> swift_keys; // not one swift_key, a whole map

  void decode(bufferlist::iterator& bl) {
    string swift_key;
    if (struct_v >= 4) ::decode(swift_key, bl);
    // that's all, folks

}
}

Looks like swift_key is never set when RGWUserInfo is deserialized. It looks like a bug on the surface, but nobody cared thus far, so maybe it's not actually a problem.

Do you happen to recall where this is used... Does radosgw-admin send a whole RGWUserInfo to RADOS, ever? It appears to go the other way, in show_user_info(), but strangely enough the tool shows Swift keys just fine.

-- Pete

#1 lore raw
Quoted 10 lines · Pete Zaitcev

Hi,

I stumpbled upon a code like this in src/rgw/rgw_common.h:

struct RGWUserInfo {
map<string, RGWAccessKey> swift_keys; // not one swift_key, a whole map

  void decode(bufferlist::iterator& bl) {
    string swift_key;
    if (struct_v >= 4) ::decode(swift_key, bl);
    // that's all, folks
Quoted 6 lines

}
}

Looks like swift_key is never set when RGWUserInfo is deserialized. It looks like a bug on the surface, but nobody cared thus far, so maybe it's not actually a problem.

It's a backward compatibility issue, we used to keep a single key as a string, later changed it into a map (decoded later). What I'd expect to see here is populating the map with the string we read here (if not empty), however, I'm pretty sure no one will hit this issue as it'd require a *real* old structure (circa 2009) that no one would have.

Quoted 5 lines

Do you happen to recall where this is used... Does radosgw-admin send a whole RGWUserInfo to RADOS, ever? It appears to go the other way, in show_user_info(), but strangely enough the tool shows Swift keys just fine.

Whenever we read user's info (e.g., when authenticating user) this is getting decoded.

Yehuda