mirror of
https://gitlab.com/cryptsetup/cryptsetup.git
synced 2025-12-16 05:10:03 +01:00
Add --debug-json switch and log level.
The JSON structures should not be printed by default to debug log. This flag introduces new debug level that prints JSON structures and keeps default debug output separate.
This commit is contained in:
@@ -166,7 +166,7 @@ static int PBKDF2_digest_store(struct crypt_device *cd,
|
||||
if (jobj_digests)
|
||||
json_object_object_add_by_uint(jobj_digests, digest, jobj_digest);
|
||||
|
||||
JSON_DBG(cd, jobj_digest, "Digest JSON");
|
||||
JSON_DBG(cd, jobj_digest, "Digest JSON:");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -233,7 +233,7 @@ int LUKS2_generate_hdr(
|
||||
json_object_object_add(jobj_config, "json_size", json_object_new_uint64(metadata_size - LUKS2_HDR_BIN_LEN));
|
||||
json_object_object_add(jobj_config, "keyslots_size", json_object_new_uint64(keyslots_size));
|
||||
|
||||
JSON_DBG(cd, hdr->jobj, "Header JSON");
|
||||
JSON_DBG(cd, hdr->jobj, "Header JSON:");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -56,10 +56,9 @@ void hexprint_base64(struct crypt_device *cd, json_object *jobj,
|
||||
|
||||
void JSON_DBG(struct crypt_device *cd, json_object *jobj, const char *desc)
|
||||
{
|
||||
/* FIXME: make this conditional and disable for stable release. */
|
||||
if (desc)
|
||||
log_dbg(cd, "%s:", desc);
|
||||
log_dbg(cd, "%s", json_object_to_json_string_ext(jobj,
|
||||
crypt_log(cd, CRYPT_LOG_DEBUG_JSON, desc);
|
||||
crypt_log(cd, CRYPT_LOG_DEBUG_JSON, json_object_to_json_string_ext(jobj,
|
||||
JSON_C_TO_STRING_PRETTY | JSON_C_TO_STRING_NOSLASHESCAPE));
|
||||
}
|
||||
|
||||
|
||||
@@ -440,7 +440,7 @@ static int luks2_keyslot_update_json(struct crypt_device *cd,
|
||||
/* update 'af' hash */
|
||||
json_object_object_add(jobj_af, "hash", json_object_new_string(params->af.luks1.hash));
|
||||
|
||||
JSON_DBG(cd, jobj_keyslot, "Keyslot JSON");
|
||||
JSON_DBG(cd, jobj_keyslot, "Keyslot JSON:");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user