|
|
648606 |
diff -up rpm-4.11.3/lib/rpmchecksig.c.orig rpm-4.11.3/lib/rpmchecksig.c
|
|
|
648606 |
--- rpm-4.11.3/lib/rpmchecksig.c.orig 2013-11-22 11:31:31.000000000 +0100
|
|
|
648606 |
+++ rpm-4.11.3/lib/rpmchecksig.c 2017-03-15 18:18:20.688251955 +0100
|
|
|
648606 |
@@ -242,8 +242,8 @@ static void formatResult(rpmTagVal sigta
|
|
|
648606 |
free(msg);
|
|
|
648606 |
}
|
|
|
648606 |
|
|
|
648606 |
-static int rpmpkgVerifySigs(rpmKeyring keyring, rpmQueryFlags flags,
|
|
|
648606 |
- FD_t fd, const char *fn)
|
|
|
648606 |
+int rpmpkgVerifySigs(rpmKeyring keyring, rpmQueryFlags flags, FD_t fd,
|
|
|
648606 |
+ const char *fn)
|
|
|
648606 |
{
|
|
|
648606 |
|
|
|
648606 |
char *buf = NULL;
|
|
|
648606 |
diff -up rpm-4.11.3/lib/rpmcli.h.orig rpm-4.11.3/lib/rpmcli.h
|
|
|
648606 |
--- rpm-4.11.3/lib/rpmcli.h.orig 2014-02-05 14:04:02.000000000 +0100
|
|
|
648606 |
+++ rpm-4.11.3/lib/rpmcli.h 2017-03-15 18:18:20.689251950 +0100
|
|
|
648606 |
@@ -254,6 +254,17 @@ int showVerifyPackage(QVA_t qva, rpmts t
|
|
|
648606 |
*/
|
|
|
648606 |
int rpmVerifySignatures(QVA_t qva, rpmts ts, FD_t fd, const char * fn);
|
|
|
648606 |
|
|
|
648606 |
+/**
|
|
|
648606 |
+ * Check package and header signatures.
|
|
|
648606 |
+ * @param keyring keyring handle
|
|
|
648606 |
+ * @param flags flags to control what to verify
|
|
|
648606 |
+ * @param fd package file handle
|
|
|
648606 |
+ * @param fn package file name
|
|
|
648606 |
+ * @return 0 on success, 1 on failure
|
|
|
648606 |
+ */
|
|
|
648606 |
+int rpmpkgVerifySigs(rpmKeyring keyring, rpmQueryFlags flags, FD_t fd,
|
|
|
648606 |
+ const char *fn);
|
|
|
648606 |
+
|
|
|
648606 |
/** \ingroup rpmcli
|
|
|
648606 |
* Verify package install.
|
|
|
648606 |
* @todo hack: RPMQV_ALL can pass char ** arglist = NULL, not char * arg. Union?
|
|
|
648606 |
diff -up rpm-4.11.3/python/rpmts-py.c.orig rpm-4.11.3/python/rpmts-py.c
|
|
|
648606 |
--- rpm-4.11.3/python/rpmts-py.c.orig 2014-02-05 14:04:02.000000000 +0100
|
|
|
648606 |
+++ rpm-4.11.3/python/rpmts-py.c 2017-03-15 18:18:20.689251950 +0100
|
|
|
648606 |
@@ -7,6 +7,8 @@
|
|
|
648606 |
#include <rpm/rpmpgp.h>
|
|
|
648606 |
#include <rpm/rpmdb.h>
|
|
|
648606 |
#include <rpm/rpmbuild.h>
|
|
|
648606 |
+#include <rpm/rpmcli.h>
|
|
|
648606 |
+#include <rpm/rpmkeyring.h>
|
|
|
648606 |
|
|
|
648606 |
#include "header-py.h"
|
|
|
648606 |
#include "rpmds-py.h" /* XXX for rpmdsNew */
|
|
|
648606 |
@@ -671,6 +672,24 @@ exit:
|
|
|
648606 |
return mio;
|
|
|
648606 |
}
|
|
|
648606 |
|
|
|
648606 |
+static PyObject *
|
|
|
648606 |
+rpmts_VerifySigs(rpmtsObject * s, PyObject * args)
|
|
|
648606 |
+{
|
|
|
648606 |
+ rpmfdObject *fdo = NULL;
|
|
|
648606 |
+ char *fn = NULL;
|
|
|
648606 |
+ rpmQueryFlags flags = (VERIFY_DIGEST|VERIFY_SIGNATURE);
|
|
|
648606 |
+ int rc = 1;
|
|
|
648606 |
+
|
|
|
648606 |
+ if (!PyArg_ParseTuple(args, "O&s|i:VerifySigs", rpmfdFromPyObject, &fdo,
|
|
|
648606 |
+ &fn, &flags))
|
|
|
648606 |
+ return NULL;
|
|
|
648606 |
+
|
|
|
648606 |
+ rpmKeyring keyring = rpmtsGetKeyring(s->ts, 1);
|
|
|
648606 |
+ rc = rpmpkgVerifySigs(keyring, flags, rpmfdGetFd(fdo), fn);
|
|
|
648606 |
+ rpmKeyringFree(keyring);
|
|
|
648606 |
+ return PyBool_FromLong(rc == 0);
|
|
|
648606 |
+}
|
|
|
648606 |
+
|
|
|
648606 |
static struct PyMethodDef rpmts_methods[] = {
|
|
|
648606 |
{"addInstall", (PyCFunction) rpmts_AddInstall, METH_VARARGS,
|
|
|
648606 |
NULL },
|
|
|
648606 |
@@ -729,6 +748,14 @@ Remove all elements from the transaction
|
|
|
648606 |
{"dbIndex", (PyCFunction) rpmts_index, METH_VARARGS|METH_KEYWORDS,
|
|
|
648606 |
"ts.dbIndex(TagN) -> ii\n\
|
|
|
648606 |
- Create a key iterator for the default transaction rpmdb.\n" },
|
|
|
648606 |
+ {"_verifySigs", (PyCFunction) rpmts_VerifySigs, METH_VARARGS,
|
|
|
648606 |
+ "ts._verifySigs(fdno, fn, [flags]) -- Verify package signature\n\n"
|
|
|
648606 |
+ "Returns True if it verifies, False otherwise.\n\n"
|
|
|
648606 |
+ "Args:\n"
|
|
|
648606 |
+ " fdno : file descriptor of the package to verify\n"
|
|
|
648606 |
+ " fn : package file name (just for logging purposes)\n"
|
|
|
648606 |
+ " flags : bitfield to control what to verify\n"
|
|
|
648606 |
+ " (default is rpm.VERIFY_SIGNATURE | rpm.VERIFY_DIGEST)"},
|
|
|
648606 |
{NULL, NULL} /* sentinel */
|
|
|
648606 |
};
|
|
|
648606 |
|