RPM Package Manager, CVS Repository http://rpm5.org/cvs/ ____________________________________________________________________________
Server: rpm5.org Name: Jeff Johnson Root: /v/rpm/cvs Email: [EMAIL PROTECTED] Module: rpm Date: 28-Dec-2007 20:54:51 Branch: HEAD Handle: 2007122819545100 Modified files: rpm/lib genpgp.sh tpgp.c Log: - jbj: parse pubkeys. Summary: Revision Changes Path 2.3 +1 -1 rpm/lib/genpgp.sh 2.3 +38 -2 rpm/lib/tpgp.c ____________________________________________________________________________ patch -p0 <<'@@ .' Index: rpm/lib/genpgp.sh ============================================================================ $ cvs diff -u -r2.2 -r2.3 genpgp.sh --- rpm/lib/genpgp.sh 28 Dec 2007 19:05:21 -0000 2.2 +++ rpm/lib/genpgp.sh 28 Dec 2007 19:54:51 -0000 2.3 @@ -35,7 +35,7 @@ $gpg --detach-sign -a -u RSApub --output - plaintext > RSA.sig $gpg --clearsign -u RSApub --output - plaintext > RSA.pem -$gpg --export -a -u RSApub > RSA.pubkey +$gpg --export -a -u RSApub > RSA.pub echo "static const char * RSAsig = \"RSA.sig\";" echo "static const char * RSApem = \"RSA.pem\";" @@ . patch -p0 <<'@@ .' Index: rpm/lib/tpgp.c ============================================================================ $ cvs diff -u -r2.2 -r2.3 tpgp.c --- rpm/lib/tpgp.c 28 Dec 2007 19:05:21 -0000 2.2 +++ rpm/lib/tpgp.c 28 Dec 2007 19:54:51 -0000 2.3 @@ -9,6 +9,7 @@ #include "system.h" #include <rpmio.h> +#include <rpmmacro.h> #define _RPMPGP_INTERNAL #define _RPMBC_INTERNAL @@ -28,17 +29,52 @@ int rpmCheckPgpSignatureOnFile(const char * fn, const char * sigfn, const char * pubfn, const char * pubfingerprint) { + const char * _fn = NULL; + const char * _sigfn = NULL; + const unsigned char * sigpkt = NULL; + size_t sigpktlen = 0; + const char * _pubfn = NULL; + const unsigned char * pubpkt = NULL; + size_t pubpktlen = 0; + int rc = 0; + int xx; if (_debug) fprintf(stderr, "==> check(%s, %s, %s, %s)\n", fn, sigfn, pubfn, pubfingerprint); - return 1; + + _fn = rpmExpand(fn, NULL); + +#ifdef NOTYET + _sigfn = rpmExpand(sigfn, NULL); + xx = pgpReadPkts(_sigfn, &sigpkt, &sigpktlen); + if (xx != PGPARMOR_SIGNATURE) { +fprintf(stderr, "==> pgpReadPkts(%s) SIG %p[%u] ret %d\n", _sigfn, sigpkt, sigpktlen, xx); + goto exit; + } +#endif + + _pubfn = rpmExpand(pubfn, NULL); + xx = pgpReadPkts(_pubfn, &pubpkt, &pubpktlen); + if (xx != PGPARMOR_PUBKEY) { +fprintf(stderr, "==> pgpReadPkts(%s) PUB %p[%u] ret %d\n", _pubfn, pubpkt, pubpktlen, xx); + goto exit; + } + + rc = 1; + +exit: + pubpkt = _free(pubpkt); + _pubfn = _free(_pubfn); + sigpkt = _free(sigpkt); + _sigfn = _free(_sigfn); + _fn = _free(_fn); + return rc; } static int doit(const char * sigtype) { pgpDig dig; - int printing = -1; int rc = 0; dig = pgpDigNew(0); @@ . ______________________________________________________________________ RPM Package Manager http://rpm5.org CVS Sources Repository rpm-cvs@rpm5.org