[projects/pld-ftp-admin] sign: count a signature rpm cannot verify as not ours
arekm
arekm at pld-linux.org
Tue Oct 27 10:55:47 CET 2026
commit 7269875102a95247666a93978d6264b395f4d07c
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date: Sat Oct 24 18:31:06 2026 +0200
sign: count a signature rpm cannot verify as not ours
is_signed() let the rpm error through when a package was signed by a
key missing from the rpm database, or its signature was broken, so
pfa-signpkg, pfa-checksign and pfa-mvpkg died with the trees still
locked. Such a package now counts as not signed by sign_key, and the
key id from the config also matches when written in capitals.
modules/sign.py | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
---
diff --git a/modules/sign.py b/modules/sign.py
index 66520f1..2879ecd 100644
--- a/modules/sign.py
+++ b/modules/sign.py
@@ -30,14 +30,21 @@ def is_signed(rpm_file):
ts = rpm.ts()
ts.setVSFlags(rpm.RPMVSF_NODSAHEADER)
fdno = os.open(rpm_file, os.O_RDONLY)
- hdr = ts.hdrFromFdno(fdno)
- os.close(fdno)
+ try:
+ hdr = ts.hdrFromFdno(fdno)
+ except rpm.error:
+ # a bad signature, or one by a key missing from the rpm database:
+ # either way not a valid signature by sign_key
+ return False
+ finally:
+ os.close(fdno)
sigid = getSigInfo(hdr)
if sigid == None:
return None
- return sign_key == sigid[-len(sign_key):]
+ # rpm prints key ids in lowercase
+ return sigid.lower().endswith(sign_key.lower())
def signpkgs(files, password, force=False):
if not os.path.isfile('/usr/bin/gpg'):
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/projects/pld-ftp-admin.git/commitdiff/9da94db07ea316d05f5466d10ac4e10519ad6d46
More information about the pld-cvs-commit
mailing list