zkey-cryptsetup: Support debug level CRYPT_DEBUG_JSON

With libcryptsetup version 2.1 a new debug level was introduced
to log the JSON structures when adding key slots, digests, etc
into the LUKS2 header.

Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
Ingo Franzki
2019-02-14 10:15:18 +01:00
committed by Jan Höppner
parent 951bd1ae54
commit ec9c67189e
+10 -1
View File
@@ -421,6 +421,11 @@ static void cryptsetup_log(int level, const char *msg,
case CRYPT_LOG_DEBUG:
fprintf(stderr, "%s: # %s\n", program_invocation_short_name, msg);
break;
#ifdef CRYPT_DEBUG_JSON
case CRYPT_DEBUG_JSON:
fprintf(stderr, "%s\n", msg);
break;
#endif
default:
warnx("Internal error on logging class for msg: %s", msg);
break;
@@ -2278,7 +2283,11 @@ int main(int argc, char *argv[])
crypt_set_log_callback(NULL, cryptsetup_log, NULL);
if (g.debug)
crypt_set_debug_level(-1);
#ifdef CRYPT_DEBUG_JSON
crypt_set_debug_level(CRYPT_DEBUG_JSON);
#else
crypt_set_debug_level(CRYPT_DEBUG_ALL);
#endif
if (command->open_device) {
if (g.pos_arg == NULL) {