Add optional paramter so cleanbin() for bufferlist can include "Base64:"
Fixes: https://tracker.ceph.com/issues/39582
Signed-off-by: David Zafman <dzafman@redhat.com>
(cherry picked from commit
eea239c03ca8aeb9a1da742b07d8627fbe2317e2)
Conflicts:
src/include/util.h : Resolved for cleanbin
src/osd/ReplicatedBackend.cc : Resolved for util.h
// If non-printable characters found then convert bufferlist to
// base64 encoded string indicating whether it did.
-string cleanbin(bufferlist &bl, bool &base64)
+string cleanbin(bufferlist &bl, bool &base64, bool show)
{
bufferlist::iterator it;
for (it = bl.begin(); it != bl.end(); ++it) {
bufferlist b64;
bl.encode_base64(b64);
string encoded(b64.c_str(), b64.length());
+ if (show)
+ encoded = "Base64:" + encoded;
base64 = true;
return encoded;
}
bool base64;
bufferlist bl;
bl.append(str);
- string result = cleanbin(bl, base64);
- if (base64)
- result = "Base64:" + result;
+ string result = cleanbin(bl, base64, true);
return result;
}
/// @param type the service type of given @p services, for example @p osd or @p mon.
void dump_services(Formatter* f, const map<string, list<string> >& services, const char* type);
-string cleanbin(bufferlist &bl, bool &b64);
+string cleanbin(bufferlist &bl, bool &b64, bool show = false);
string cleanbin(string &str);
namespace ceph::util {
#include "messages/MOSDPGPushReply.h"
#include "common/EventTrace.h"
#include "include/random.h"
+#include "include/util.h"
#define dout_context cct
#define dout_subsys ceph_subsys_osd
return 0;
}
if (r == 0 && hdrbl.length()) {
- dout(25) << "CRC header " << string(hdrbl.c_str(), hdrbl.length())
- << dendl;
+ bool encoded = false;
+ dout(25) << "CRC header " << cleanbin(hdrbl, encoded, true) << dendl;
pos.omap_hash << hdrbl;
}
}