This is an automated email from the git hooks/post-receive script.

guillem pushed a commit to branch main
in repository dpkg.

View the commit online:
https://git.dpkg.org/cgit/dpkg/dpkg.git/commit/?id=2cf1500bc823c39243aa2757c5d70e1871b02fcd

commit 2cf1500bc823c39243aa2757c5d70e1871b02fcd (HEAD -> main)
Author: Guillem Jover <[email protected]>
AuthorDate: Wed Jun 4 03:17:22 2025 +0200

    Dpkg::OpenPGP: Add own error for missing keyrings in verify functions
    
    To be able to provide better error messages, use a new error code so
    that we distinguish between no signature and missing keyrings.
---
 scripts/Dpkg/OpenPGP/Backend/Sequoia.pm | 4 ++--
 scripts/Dpkg/OpenPGP/ErrorCodes.pm      | 3 +++
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/scripts/Dpkg/OpenPGP/Backend/Sequoia.pm 
b/scripts/Dpkg/OpenPGP/Backend/Sequoia.pm
index 52050ea09..521cdeeb1 100644
--- a/scripts/Dpkg/OpenPGP/Backend/Sequoia.pm
+++ b/scripts/Dpkg/OpenPGP/Backend/Sequoia.pm
@@ -122,7 +122,7 @@ sub inline_verify
     my ($self, $inlinesigned, $data, @certs) = @_;
 
     return OPENPGP_MISSING_CMD unless ($self->{cmdv} || $self->{cmd});
-    return OPENPGP_NO_SIG if @certs == 0;
+    return OPENPGP_MISSING_KEYRINGS if @certs == 0;
 
     # XXX: sqv does not support --signer-file. See:
     #   <https://gitlab.com/sequoia-pgp/sequoia-sqv/-/issues/11>.
@@ -166,7 +166,7 @@ sub verify
     my ($self, $data, $sig, @certs) = @_;
 
     return OPENPGP_MISSING_CMD unless ($self->{cmdv} || $self->{cmd});
-    return OPENPGP_NO_SIG if @certs == 0;
+    return OPENPGP_MISSING_KEYRINGS if @certs == 0;
 
     # XXX: sqv does not support --signer-file. See:
     #   <https://gitlab.com/sequoia-pgp/sequoia-sqv/-/issues/11>.
diff --git a/scripts/Dpkg/OpenPGP/ErrorCodes.pm 
b/scripts/Dpkg/OpenPGP/ErrorCodes.pm
index 0a63cfa96..180a930ee 100644
--- a/scripts/Dpkg/OpenPGP/ErrorCodes.pm
+++ b/scripts/Dpkg/OpenPGP/ErrorCodes.pm
@@ -53,6 +53,7 @@ our @EXPORT = qw(
     OPENPGP_MISSING_CMD
     OPENPGP_NEEDS_KEYSTORE
     OPENPGP_CMD_CANNOT_SIGN
+    OPENPGP_MISSING_KEYRINGS
 
     openpgp_errorcode_to_string
 );
@@ -88,6 +89,7 @@ use constant {
     OPENPGP_MISSING_CMD => -1,
     OPENPGP_NEEDS_KEYSTORE => -2,
     OPENPGP_CMD_CANNOT_SIGN => -3,
+    OPENPGP_MISSING_KEYRINGS => -4,
 };
 
 my %code2error = (
@@ -111,6 +113,7 @@ my %code2error = (
     OPENPGP_MISSING_CMD() => N_('missing OpenPGP implementation'),
     OPENPGP_NEEDS_KEYSTORE() => N_('specified key needs a keystore'),
     OPENPGP_CMD_CANNOT_SIGN() => N_('OpenPGP backend command cannot sign'),
+    OPENPGP_MISSING_KEYRINGS() => N_('missing OpenPGP keyrings'),
 );
 
 sub openpgp_errorcode_to_string

-- 
Dpkg.Org's dpkg

Reply via email to