]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
auth/KeyRing: do not decode a copy of bl
authorKefu Chai <kchai@redhat.com>
Wed, 2 Jun 2021 03:59:16 +0000 (11:59 +0800)
committerKefu Chai <kchai@redhat.com>
Wed, 2 Jun 2021 03:59:18 +0000 (11:59 +0800)
i checked all the code paths calling into KeyRing::decode(), none of
them relies on the behavior that the bl is not mutated after the
iterator is decoded.

actually, it is more intuitive to always move the iterator forward when
decoding the encoded keyring in the bufferlist.

Signed-off-by: Kefu Chai <kchai@redhat.com>
src/auth/KeyRing.cc

index 6686fa9f51af418361172bdf491622a68bc9474b..d2e4cd391cf9e63893725fdbf41a2b5a2158bcc2 100644 (file)
@@ -203,8 +203,7 @@ void KeyRing::decode_plaintext(bufferlist::const_iterator& bli)
 
 void KeyRing::decode(bufferlist::const_iterator& bl)
 {
-  auto start_pos = bl;
-  decode_plaintext(start_pos);
+  decode_plaintext(bl);
 }
 
 int KeyRing::load(CephContext *cct, const std::string &filename)