mirror of
https://github.com/mailscope/kumomta.git
synced 2026-09-07 02:58:56 +00:00
remove duplicate quick-error dep; move to thiserror in dkim
This commit is contained in:
Generated
+2
-8
@@ -2551,11 +2551,11 @@ dependencies = [
|
||||
"once_cell",
|
||||
"openssl",
|
||||
"openssl-sys",
|
||||
"quick-error 2.0.1",
|
||||
"regex",
|
||||
"sha-1",
|
||||
"sha2",
|
||||
"textwrap",
|
||||
"thiserror",
|
||||
"tokio",
|
||||
"tracing",
|
||||
]
|
||||
@@ -4228,12 +4228,6 @@ version = "1.2.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0"
|
||||
|
||||
[[package]]
|
||||
name = "quick-error"
|
||||
version = "2.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a993555f31e5a609f617c12db6250dedcac1b0a85076912c436e6fc9b2c8e6a3"
|
||||
|
||||
[[package]]
|
||||
name = "quote"
|
||||
version = "0.6.13"
|
||||
@@ -4571,7 +4565,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "52e44394d2086d010551b14b53b1f24e31647570cd1deb0379e2c21b329aba00"
|
||||
dependencies = [
|
||||
"hostname",
|
||||
"quick-error 1.2.3",
|
||||
"quick-error",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
||||
@@ -25,10 +25,10 @@ once_cell = "1.17"
|
||||
foreign-types = "0.3"
|
||||
openssl = { workspace=true }
|
||||
openssl-sys = { workspace=true }
|
||||
quick-error = "2.0.1"
|
||||
sha-1 = { version = "0.10", features = ["oid"] }
|
||||
sha2 = { version = "0.10", features = ["oid"] }
|
||||
textwrap = "0.16"
|
||||
thiserror = "1.0"
|
||||
tracing = "0.1"
|
||||
hickory-resolver = {workspace=true}
|
||||
|
||||
|
||||
+55
-81
@@ -1,3 +1,5 @@
|
||||
use thiserror::Error;
|
||||
|
||||
/// DKIM error status
|
||||
#[derive(Debug, Copy, Clone, Eq, PartialEq)]
|
||||
pub enum Status {
|
||||
@@ -5,87 +7,59 @@ pub enum Status {
|
||||
Tempfail,
|
||||
}
|
||||
|
||||
quick_error! {
|
||||
#[derive(Debug, PartialEq, Clone)]
|
||||
/// DKIM errors
|
||||
pub enum DKIMError {
|
||||
UnsupportedHashAlgorithm(value: String) {
|
||||
display("unsupported hash algorithm: {}", value)
|
||||
}
|
||||
UnsupportedCanonicalizationType(value: String) {
|
||||
display("unsupported canonicalization: {}", value)
|
||||
}
|
||||
SignatureSyntaxError(err: String) {
|
||||
display("signature syntax error: {}", err)
|
||||
}
|
||||
SignatureMissingRequiredTag(name: &'static str) {
|
||||
display("signature missing required tag ({})", name)
|
||||
}
|
||||
IncompatibleVersion {
|
||||
display("incompatible version")
|
||||
}
|
||||
DomainMismatch {
|
||||
display("domain mismatch")
|
||||
}
|
||||
FromFieldNotSigned {
|
||||
display("From field not signed")
|
||||
}
|
||||
SignatureExpired {
|
||||
display("signature expired")
|
||||
}
|
||||
UnacceptableSignatureHeader {
|
||||
display("unacceptable signature header")
|
||||
}
|
||||
UnsupportedQueryMethod {
|
||||
display("unsupported query method")
|
||||
}
|
||||
KeyUnavailable(err: String) {
|
||||
display("key unavailable: {}", err)
|
||||
}
|
||||
UnknownInternalError(err: String) {
|
||||
display("internal error: {}", err)
|
||||
}
|
||||
NoKeyForSignature {
|
||||
display("no key for signature")
|
||||
}
|
||||
KeySyntaxError {
|
||||
display("key syntax error")
|
||||
}
|
||||
KeyIncompatibleVersion {
|
||||
display("key incompatible version")
|
||||
}
|
||||
InappropriateKeyAlgorithm {
|
||||
display("inappropriate key algorithm")
|
||||
}
|
||||
SignatureDidNotVerify {
|
||||
display("signature did not verify")
|
||||
}
|
||||
BodyHashDidNotVerify {
|
||||
display("body hash did not verify")
|
||||
}
|
||||
MalformedBody {
|
||||
display("malformed email body")
|
||||
}
|
||||
FailedToSign(err: String) {
|
||||
display("failed sign: {}", err)
|
||||
}
|
||||
BuilderError(err: &'static str) {
|
||||
display("failed to build object: {}", err)
|
||||
}
|
||||
HeaderSerializeError(err: String) {
|
||||
display("failed to serialize DKIM header: {err}")
|
||||
}
|
||||
PrivateKeyLoadError(err: String) {
|
||||
display("failed to load private key: {err}")
|
||||
}
|
||||
MailParsingError(err: mailparsing::MailParsingError) {
|
||||
from()
|
||||
display("failed to parse message: {err:#}")
|
||||
}
|
||||
CanonicalLineEndingsRequired {
|
||||
display("Canonical CRLF line endings are required for correct signing and verification")
|
||||
}
|
||||
}
|
||||
#[derive(Debug, PartialEq, Clone, Error)]
|
||||
/// DKIM errors
|
||||
pub enum DKIMError {
|
||||
#[error("unsupported hash algorithm: {0}")]
|
||||
UnsupportedHashAlgorithm(String),
|
||||
#[error("unsupported canonicalization: {0}")]
|
||||
UnsupportedCanonicalizationType(String),
|
||||
#[error("signature syntax error: {0}")]
|
||||
SignatureSyntaxError(String),
|
||||
#[error("signature missing required tag ({0})")]
|
||||
SignatureMissingRequiredTag(&'static str),
|
||||
#[error("incompatible version")]
|
||||
IncompatibleVersion,
|
||||
#[error("domain mismatch")]
|
||||
DomainMismatch,
|
||||
#[error("From field not signed")]
|
||||
FromFieldNotSigned,
|
||||
#[error("signature expired")]
|
||||
SignatureExpired,
|
||||
#[error("unacceptable signature header")]
|
||||
UnacceptableSignatureHeader,
|
||||
#[error("unsupported query method")]
|
||||
UnsupportedQueryMethod,
|
||||
#[error("key unavailable: {0}")]
|
||||
KeyUnavailable(String),
|
||||
#[error("internal error: {0}")]
|
||||
UnknownInternalError(String),
|
||||
#[error("no key for signature")]
|
||||
NoKeyForSignature,
|
||||
#[error("key syntax error")]
|
||||
KeySyntaxError,
|
||||
#[error("key incompatible version")]
|
||||
KeyIncompatibleVersion,
|
||||
#[error("inappropriate key algorithm")]
|
||||
InappropriateKeyAlgorithm,
|
||||
#[error("signature did not verify")]
|
||||
SignatureDidNotVerify,
|
||||
#[error("body hash did not verify")]
|
||||
BodyHashDidNotVerify,
|
||||
#[error("malformed email body")]
|
||||
MalformedBody,
|
||||
#[error("failed sign: {0}")]
|
||||
FailedToSign(String),
|
||||
#[error("failed to build object: {0}")]
|
||||
BuilderError(&'static str),
|
||||
#[error("failed to serialize DKIM header: {0}")]
|
||||
HeaderSerializeError(String),
|
||||
#[error("failed to load private key: {0}")]
|
||||
PrivateKeyLoadError(String),
|
||||
#[error("failed to parse message: {0:#}")]
|
||||
MailParsingError(#[from] mailparsing::MailParsingError),
|
||||
#[error("Canonical CRLF line endings are required for correct signing and verification")]
|
||||
CanonicalLineEndingsRequired,
|
||||
}
|
||||
|
||||
impl DKIMError {
|
||||
|
||||
@@ -12,9 +12,6 @@ use openssl::pkey_ctx::PkeyCtx;
|
||||
use openssl::rsa::{Padding, Rsa};
|
||||
use std::collections::BTreeMap;
|
||||
|
||||
#[macro_use]
|
||||
extern crate quick_error;
|
||||
|
||||
pub mod canonicalization;
|
||||
pub mod dns;
|
||||
mod errors;
|
||||
|
||||
Reference in New Issue
Block a user