summaryrefslogtreecommitdiffstats
path: root/tool
diff options
context:
space:
mode:
authorJustus Winter <justus@sequoia-pgp.org>2019-09-03 17:09:23 +0200
committerJustus Winter <justus@sequoia-pgp.org>2019-09-03 17:21:26 +0200
commit38f59d8384e775da91e94d2040722a3cdfad9f44 (patch)
treec442a8fcaed48807be2f8852db4cf49e66c744f5 /tool
parentddfedbe4eb3baf2e3751b82b7c86f2f8519a9467 (diff)
tool: Hexdump unknown and invalid subpackets.
Diffstat (limited to 'tool')
-rw-r--r--tool/src/commands/dump.rs38
1 files changed, 28 insertions, 10 deletions
diff --git a/tool/src/commands/dump.rs b/tool/src/commands/dump.rs
index e88851ea..8c01e3ed 100644
--- a/tool/src/commands/dump.rs
+++ b/tool/src/commands/dump.rs
@@ -693,11 +693,24 @@ impl PacketDumper {
-> Result<()> {
use self::SubpacketValue::*;
+ let hexdump_unknown = |output: &mut dyn io::Write, buf| -> Result<()> {
+ let mut hd = hex::Dumper::new(output, self.indentation_for_hexdump(
+ &format!("{} ", i), 0));
+ hd.write_labeled(buf, |_, _| None)?;
+ Ok(())
+ };
+
match s.value {
- Unknown(ref b) =>
- write!(output, "{} Unknown: {:?}", i, b)?,
- Invalid(ref b) =>
- write!(output, "{} Invalid: {:?}", i, b)?,
+ Unknown(ref b) => {
+ writeln!(output, "{} {:?}{}:", i, s.tag,
+ if s.critical { " (critical)" } else { "" })?;
+ hexdump_unknown(output, b)?;
+ },
+ Invalid(ref b) => {
+ writeln!(output, "{} {:?}{}:", i, s.tag,
+ if s.critical { " (critical)" } else { "" })?;
+ hexdump_unknown(output, b)?;
+ },
SignatureCreationTime(ref t) =>
write!(output, "{} Signature creation time: {}", i,
time::strftime(TIMEFMT, t).unwrap())?,
@@ -780,17 +793,22 @@ impl PacketDumper {
write!(output, "{} Intended Recipient: {}", i, fp)?,
}
- if s.critical {
- write!(output, " (critical)")?;
- }
- writeln!(output)?;
-
match s.value {
+ Unknown(_) | Invalid(_) => (),
EmbeddedSignature(ref sig) => {
+ if s.critical {
+ write!(output, " (critical)")?;
+ }
+ writeln!(output)?;
let indent = format!("{} ", i);
self.dump_packet(output, &indent, None, sig, None, None)?;
},
- _ => (),
+ _ => {
+ if s.critical {
+ write!(output, " (critical)")?;
+ }
+ writeln!(output)?;
+ }
}
Ok(())