Skip to content

Commit 38b2428

Browse files
mschwenke-ddnvlendec
authored andcommitted
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 <mschwenke@ddn.com> Reviewed-by: Volker Lendecke <vl@samba.org> Autobuild-User(master): Volker Lendecke <vl@samba.org> Autobuild-Date(master): Mon Feb 9 12:21:08 UTC 2026 on atb-devel-224
1 parent 59ef918 commit 38b2428

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

ctdb/server/ctdb_vacuum.c

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -362,9 +362,18 @@ static void fetch_record_migrate_callback(struct ctdb_client_call_state *state)
362362
goto done;
363363
}
364364

365-
D_INFO("Vacuum Fetch record, key=%.*s\n",
366-
(int)fetch->key.dsize,
367-
fetch->key.dptr);
365+
if (DEBUGLEVEL >= DBGLVL_INFO) {
366+
char *keystr = hex_encode_talloc(
367+
fetch,
368+
(unsigned char *)fetch->key.dptr,
369+
fetch->key.dsize);
370+
371+
D_INFO(DEBUGLEVEL >= DBGLVL_DEBUG ?
372+
"Vacuum Fetch record, key=%s\n" :
373+
"Vacuum Fetch record, key=%.20s\n",
374+
keystr ? keystr : "<UNKNOWN>");
375+
TALLOC_FREE(keystr);
376+
}
368377

369378
(void) ctdb_local_schedule_for_deletion(fetch_queue->ctdb_db,
370379
&hdr,

0 commit comments

Comments
 (0)