diff options
author | Toomas Soome <[email protected]> | 2020-10-06 00:05:28 +0300 |
---|---|---|
committer | GitHub <[email protected]> | 2020-10-05 14:05:28 -0700 |
commit | 4e84f67a96837008735e988b84309f9b292de26f (patch) | |
tree | ebdb01429c5a66e0e741ccc2850e5de77b996d95 /cmd | |
parent | 79f0935fab1122d466f67885e84d878c107e34df (diff) |
zdb should not output binary data on terminal
The zdb is interpreting byte array as textual string in dump_zap,
but there are also binary arrays and we should not output binary
data on terminal.
Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Igor Kozhukhov <[email protected]>
Signed-off-by: Toomas Soome <[email protected]>
External-issue: https://www.illumos.org/issues/12012
External-issue: https://www.illumos.org/issues/11713
Closes #11006
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/zdb/zdb.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/cmd/zdb/zdb.c b/cmd/zdb/zdb.c index 24ce43505..dbf09a652 100644 --- a/cmd/zdb/zdb.c +++ b/cmd/zdb/zdb.c @@ -1120,7 +1120,21 @@ dump_zap(objset_t *os, uint64_t object, void *data, size_t size) (void) zap_lookup(os, object, attr.za_name, attr.za_integer_length, attr.za_num_integers, prop); if (attr.za_integer_length == 1) { - (void) printf("%s", (char *)prop); + if (strcmp(attr.za_name, + DSL_CRYPTO_KEY_MASTER_KEY) == 0 || + strcmp(attr.za_name, + DSL_CRYPTO_KEY_HMAC_KEY) == 0 || + strcmp(attr.za_name, DSL_CRYPTO_KEY_IV) == 0 || + strcmp(attr.za_name, DSL_CRYPTO_KEY_MAC) == 0 || + strcmp(attr.za_name, DMU_POOL_CHECKSUM_SALT) == 0) { + uint8_t *u8 = prop; + + for (i = 0; i < attr.za_num_integers; i++) { + (void) printf("%02x", u8[i]); + } + } else { + (void) printf("%s", (char *)prop); + } } else { for (i = 0; i < attr.za_num_integers; i++) { switch (attr.za_integer_length) { |