Commit 1d084a41 authored by Ondrej Kozina's avatar Ondrej Kozina Committed by Milan Broz

Add support for optional flags section in LUKS2 segments dump.

parent c4198986
......@@ -1534,7 +1534,7 @@ static void hdr_dump_segments(struct crypt_device *cd, json_object *hdr_jobj)
{
char segment[16];
json_object *jobj_segments, *jobj_segment, *jobj1, *jobj2;
int i;
int i, j, flags;
uint64_t value;
log_std(cd, "Data segments:\n");
......@@ -1570,6 +1570,17 @@ static void hdr_dump_segments(struct crypt_device *cd, json_object *hdr_jobj)
json_object_object_get_ex(jobj1, "type", &jobj2))
log_std(cd, "\tintegrity: %s\n", json_object_get_string(jobj2));
if (json_object_object_get_ex(jobj_segment, "flags", &jobj1) &&
(flags = (int)json_object_array_length(jobj1)) > 0) {
jobj2 = json_object_array_get_idx(jobj1, 0);
log_std(cd, "\tflags : %s", json_object_get_string(jobj2));
for (j = 1; j < flags; j++) {
jobj2 = json_object_array_get_idx(jobj1, j);
log_std(cd, ", %s", json_object_get_string(jobj2));
}
log_std(cd, "\n");
}
log_std(cd, "\n");
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment