From 551381ee99c4d76825dc370c662c632913bd9393 Mon Sep 17 00:00:00 2001 From: "Neal H. Walfield" Date: Fri, 18 Nov 2022 10:11:47 +0100 Subject: openpgp: Fix use of Error::PolicyViolation. - When rejecting a bad critical notation, `Error::PolicyViolation` was used incorrectly. The first field is the thing that is in violation of the policy, not a description. --- openpgp/src/policy.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'openpgp/src') diff --git a/openpgp/src/policy.rs b/openpgp/src/policy.rs index 03d36b02..542fa64f 100644 --- a/openpgp/src/policy.rs +++ b/openpgp/src/policy.rs @@ -1489,9 +1489,11 @@ impl<'a> Policy for StandardPolicy<'a> { .context("Policy rejected critical signature subpacket")?; if let SubpacketValue::NotationData(n) = csp.value() { if ! self.good_critical_notations.contains(&n.name()) { - return Err(Error::PolicyViolation( - format!("Policy rejected critical notation {:?}", - n.name()), None).into()); + return Err(anyhow::Error::from( + Error::PolicyViolation( + format!("Critical notation {:?}", + n.name()), None)) + .context("Policy rejected critical notation")); } } } -- cgit v1.2.3