aboutsummaryrefslogtreecommitdiffstats
path: root/src/m_email/EMailSecurityView.cpp
diff options
context:
space:
mode:
authorsaturneric <[email protected]>2026-09-12 20:11:52 +0200
committersaturneric <[email protected]>2026-09-12 20:11:52 +0200
commit727634acc3d7413fa12c6492341e899008a69452 (patch)
treeaad2c069ad3d07601a6773761dde758ef653c652 /src/m_email/EMailSecurityView.cpp
parentfeat(email): show analysis cards for failed operations (diff)
downloadmodules-727634acc3d7413fa12c6492341e899008a69452.tar.gz
modules-727634acc3d7413fa12c6492341e899008a69452.zip
fix(email): harden email operation error handling
- validate GPG result pointers before dereferencing them - preserve UTF-8 bytes during signing, encryption, and verification - reset cancellation state after each IMAP operation - report unexpected worker exceptions instead of terminating threads - detach blocked threads safely during shutdown - prevent missing signatures from appearing fully valid - correct signature validity highlighting for problematic signatures - restore Qt translation extraction and preserve send dialogs on tab closure
Diffstat (limited to 'src/m_email/EMailSecurityView.cpp')
-rw-r--r--src/m_email/EMailSecurityView.cpp16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/m_email/EMailSecurityView.cpp b/src/m_email/EMailSecurityView.cpp
index 304fd73..34a560a 100644
--- a/src/m_email/EMailSecurityView.cpp
+++ b/src/m_email/EMailSecurityView.cpp
@@ -47,7 +47,11 @@ constexpr int kColItem = 0;
constexpr int kColValue = 1;
// Mirrors GpgFrontend::GpgKeyStatus, which GFGpgKeyBrief::usability reports.
-enum KeyUsability : int {
+//
+// Deliberately untyped: lupdate stops attributing tr() calls to the enclosing
+// class once it meets an enum with an explicit underlying type in this file,
+// so every string below one would silently drop out of the catalogues.
+enum KeyUsability {
kUSABLE = 0,
kEXPIRING_SOON = 1,
kEXPIRED = 2,
@@ -99,7 +103,15 @@ auto DescribeValidity(int validity) -> QString {
}
}
-auto ValidityIsGood(int validity) -> bool { return validity <= 2; }
+auto ValidityIsGood(int validity) -> bool {
+ // 0 is kFULLY_VALID and 2 is kVALID_NOT_FULLY_TRUSTED -- both are genuine
+ // signatures. 1 is kVALID_WITH_ISSUES, which is NOT one:
+ // GpgVerifyResultAnalyse sets it exactly when gpgme reports GPGME_SIGSUM_RED,
+ // meaning the signature is bad. It used to fall inside a "validity <= 2" test
+ // and so was painted like a clean signature, contradicting the "valid, with
+ // issues" label beside it -- and the colour is what gets read at a glance.
+ return validity == 0 || validity == 2;
+}
} // namespace