From: Martin Schwenke Date: Sun, 8 Feb 2026 23:03:04 +0000 (+1100) Subject: ctdb-daemon: Hex encode key before logging X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=38b2428d3765a468004265b5732cbcadfe503bb9;p=thirdparty%2Fsamba.git ctdb-daemon: Hex encode key before logging This currently causes binary data to be logged. Instead, conditionally hex encode the key in a similar style to the way it is done in dbwrap_ctdb.c:fetch_locked_internal(). In this case, the key is truncated if the debug level is less than 10.` Signed-off-by: Martin Schwenke Reviewed-by: Volker Lendecke Autobuild-User(master): Volker Lendecke Autobuild-Date(master): Mon Feb 9 12:21:08 UTC 2026 on atb-devel-224 --- diff --git a/ctdb/server/ctdb_vacuum.c b/ctdb/server/ctdb_vacuum.c index 7ff79ac5745..d896dd28910 100644 --- a/ctdb/server/ctdb_vacuum.c +++ b/ctdb/server/ctdb_vacuum.c @@ -362,9 +362,18 @@ static void fetch_record_migrate_callback(struct ctdb_client_call_state *state) goto done; } - D_INFO("Vacuum Fetch record, key=%.*s\n", - (int)fetch->key.dsize, - fetch->key.dptr); + if (DEBUGLEVEL >= DBGLVL_INFO) { + char *keystr = hex_encode_talloc( + fetch, + (unsigned char *)fetch->key.dptr, + fetch->key.dsize); + + D_INFO(DEBUGLEVEL >= DBGLVL_DEBUG ? + "Vacuum Fetch record, key=%s\n" : + "Vacuum Fetch record, key=%.20s\n", + keystr ? keystr : ""); + TALLOC_FREE(keystr); + } (void) ctdb_local_schedule_for_deletion(fetch_queue->ctdb_db, &hdr,