|
|
239748 |
From 134b095b0833956cadfc02a9a1e7ca1344cd5aaa Mon Sep 17 00:00:00 2001
|
|
|
239748 |
From: Demi Marie Obenour <demi@invisiblethingslab.com>
|
|
|
239748 |
Date: Tue, 27 Apr 2021 21:07:19 -0400
|
|
|
239748 |
Subject: [PATCH] Pass the package to rpmkeys stdin
|
|
|
239748 |
|
|
|
239748 |
This avoids having to compute the expected stdout value, which will
|
|
|
239748 |
always be the constant "-: digests signatures OK\n".
|
|
|
239748 |
---
|
|
|
239748 |
dnf/rpm/miscutils.py | 10 ++++++----
|
|
|
239748 |
1 file changed, 6 insertions(+), 4 deletions(-)
|
|
|
239748 |
|
|
|
239748 |
diff --git a/dnf/rpm/miscutils.py b/dnf/rpm/miscutils.py
|
|
|
239748 |
index 7e33d4c..5f2621c 100644
|
|
|
239748 |
--- a/dnf/rpm/miscutils.py
|
|
|
239748 |
+++ b/dnf/rpm/miscutils.py
|
|
|
239748 |
@@ -29,7 +29,8 @@ from shutil import which
|
|
|
239748 |
logger = logging.getLogger('dnf')
|
|
|
239748 |
|
|
|
239748 |
|
|
|
239748 |
-def _verifyPkgUsingRpmkeys(package, installroot):
|
|
|
239748 |
+def _verifyPkgUsingRpmkeys(package, installroot, fdno):
|
|
|
239748 |
+ os.lseek(fdno, 0, os.SEEK_SET)
|
|
|
239748 |
rpmkeys_binary = '/usr/bin/rpmkeys'
|
|
|
239748 |
if not os.path.isfile(rpmkeys_binary):
|
|
|
239748 |
rpmkeys_binary = which("rpmkeys")
|
|
|
239748 |
@@ -40,15 +41,16 @@ def _verifyPkgUsingRpmkeys(package, installroot):
|
|
|
239748 |
logger.critical(_('Cannot find rpmkeys executable to verify signatures.'))
|
|
|
239748 |
return 0
|
|
|
239748 |
|
|
|
239748 |
- args = ('rpmkeys', '--checksig', '--root', installroot, '--define', '_pkgverify_level all', '--', package)
|
|
|
239748 |
+ args = ('rpmkeys', '--checksig', '--root', installroot, '--define', '_pkgverify_level all', '-')
|
|
|
239748 |
with subprocess.Popen(
|
|
|
239748 |
args=args,
|
|
|
239748 |
executable=rpmkeys_binary,
|
|
|
239748 |
env={'LC_ALL': 'C'},
|
|
|
239748 |
+ stdin=fdno,
|
|
|
239748 |
stdout=subprocess.PIPE,
|
|
|
239748 |
cwd='/') as p:
|
|
|
239748 |
data, err = p.communicate()
|
|
|
239748 |
- if p.returncode != 0 or data != (package.encode('ascii', 'strict') + b': digests signatures OK\n'):
|
|
|
239748 |
+ if p.returncode != 0 or data != b'-: digests signatures OK\n':
|
|
|
239748 |
return 0
|
|
|
239748 |
else:
|
|
|
239748 |
return 1
|
|
|
239748 |
@@ -85,7 +87,7 @@ def checkSig(ts, package):
|
|
|
239748 |
|
|
|
239748 |
if siginfo == '(none)':
|
|
|
239748 |
value = 4
|
|
|
239748 |
- elif "Key ID" in siginfo and _verifyPkgUsingRpmkeys(package, ts.ts.rootDir):
|
|
|
239748 |
+ elif "Key ID" in siginfo and _verifyPkgUsingRpmkeys(package, ts.ts.rootDir, fdno):
|
|
|
239748 |
value = 0
|
|
|
239748 |
else:
|
|
|
239748 |
raise ValueError('Unexpected return value %r from hdr.sprintf when checking signature.' % siginfo)
|
|
|
239748 |
--
|
|
|
239748 |
libgit2 1.0.1
|
|
|
239748 |
|