RPM Package Manager, CVS Repository
http://rpm5.org/cvs/
____________________________________________________________________________
Server: rpm5.org Name: Jeff Johnson
Root: /v/rpm/cvs Email: jbj@rpm5.org
Module: rpm Date: 30-Dec-2007 15:33:07
Branch: HEAD Handle: 2007123014330601
Modified files:
rpm CHANGES TODO
rpm/lib depends.c poptALL.c rpmns.c rpmns.h
rpm/rpmio argv.c
Log:
- add a (unused) flags arg to rpmnsProbeSignature.
- change rpmnsProbeSignature to return rpmRC (note: success is 0 now).
- add --rpmnsdebug to see rpmnsProbeSignature() spew.
- permit URI's in signature(...) arguments.
- fix: argvSplit was doing ltrim and skipping spans of seperators.
Summary:
Revision Changes Path
1.2040 +5 -0 rpm/CHANGES
1.105 +1 -0 rpm/TODO
1.377 +9 -14 rpm/lib/depends.c
2.70 +2 -0 rpm/lib/poptALL.c
1.10 +14 -12 rpm/lib/rpmns.c
1.12 +5 -3 rpm/lib/rpmns.h
1.11 +4 -4 rpm/rpmio/argv.c
____________________________________________________________________________
patch -p0 <<'@@ .'
Index: rpm/CHANGES
============================================================================
$ cvs diff -u -r1.2039 -r1.2040 CHANGES
--- rpm/CHANGES 30 Dec 2007 11:27:01 -0000 1.2039
+++ rpm/CHANGES 30 Dec 2007 14:33:06 -0000 1.2040
@@ -1,4 +1,9 @@
5.0b3 -> 5.0b4:
+ - jbj: add a (unused) flags arg to rpmnsProbeSignature.
+ - jbj: change rpmnsProbeSignature to return rpmRC (note: success is 0 now).
+ - jbj: add --rpmnsdebug to see rpmnsProbeSignature() spew.
+ - jbj: permit URI's in signature(...) arguments.
+ - jbj: fix: argvSplit was doing ltrim and skipping spans of seperators.
- rse: improve RPM Lua function util.rsubst(): perform repeated substitutions and honor prolog/epilog parts
- jbj: re-add all the debugging spew under --rpmnsdebug for now.
- jbj: functional signature(...) name space probe.
@@ .
patch -p0 <<'@@ .'
Index: rpm/TODO
============================================================================
$ cvs diff -u -r1.104 -r1.105 TODO
--- rpm/TODO 29 Dec 2007 18:32:02 -0000 1.104
+++ rpm/TODO 30 Dec 2007 14:33:06 -0000 1.105
@@ -162,3 +162,4 @@
command line, each to end up in binary *.rpm's to show more of build
time options
- jbj: rewrite pgpReadPkts to return array of clearsign'd segments instead.
+ - jbj: teach argvSplit about escaped seperator characters.
@@ .
patch -p0 <<'@@ .'
Index: rpm/lib/depends.c
============================================================================
$ cvs diff -u -r1.376 -r1.377 depends.c
--- rpm/lib/depends.c 29 Dec 2007 21:34:21 -0000 1.376
+++ rpm/lib/depends.c 30 Dec 2007 14:33:06 -0000 1.377
@@ -823,26 +823,21 @@
if (NSType == RPMNS_TYPE_SIGNATURE) {
const char * EVR = rpmdsEVR(dep);
- char * fn = xstrdup(Name);
- char * sigfn = NULL;
- char * pubfn = ((EVR && *EVR) ? xstrdup(EVR) : NULL);
- char * pubid = NULL;
+ ARGV_t avN = NULL;
+ ARGV_t avEVR = NULL;
+ rpmRC res;
/* Split /fn:/sig */
- if ((sigfn = strrchr(fn, ':')) != NULL)
- *sigfn++ = '\0';
+ xx = argvSplit(&avN, Name, ":");
/* Split /pub:id */
- if (pubfn) {
- if ((pubid = strrchr(pubfn, ':')) != NULL)
- *pubid++ = '\0';
- }
+ xx = (EVR && *EVR) ? argvSplit(&avEVR, EVR, ":") : argvAdd(&avEVR, "");
- xx = rpmnsProbeSignature(ts, fn, sigfn, pubfn, pubid);
- rc = (xx ? 0 : 1);
+ res = rpmnsProbeSignature(ts, avN[0], avN[1], avEVR[0], avEVR[1], 0);
+ rc = (res == RPMRC_OK ? 0 : 1);
- fn = _free(fn);
- pubfn = _free(pubfn);
+ avN = argvFree(avN);
+ avEVR = argvFree(avEVR);
if (Flags & RPMSENSE_MISSINGOK)
goto unsatisfied;
@@ .
patch -p0 <<'@@ .'
Index: rpm/lib/poptALL.c
============================================================================
$ cvs diff -u -r2.69 -r2.70 poptALL.c
--- rpm/lib/poptALL.c 28 Dec 2007 11:46:59 -0000 2.69
+++ rpm/lib/poptALL.c 30 Dec 2007 14:33:06 -0000 2.70
@@ -493,6 +493,8 @@
N_("debug rpmio I/O"), NULL},
{ "rpmmgdebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_rpmmg_debug, -1,
NULL, NULL},
+ { "rpmnsdebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_rpmns_debug, -1,
+ NULL, NULL},
{ "rpmpsdebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_rpmps_debug, -1,
NULL, NULL},
{ "rpmsqdebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_rpmsq_debug, -1,
@@ .
patch -p0 <<'@@ .'
Index: rpm/lib/rpmns.c
============================================================================
$ cvs diff -u -r1.9 -r1.10 rpmns.c
--- rpm/lib/rpmns.c 29 Dec 2007 21:34:21 -0000 1.9
+++ rpm/lib/rpmns.c 30 Dec 2007 14:33:06 -0000 1.10
@@ -9,6 +9,7 @@
#define _RPMPGP_INTERNAL
#include <rpmpgp.h>
+#include <rpmlib.h> /* XXX RPMRC_OK */
#define _RPMEVR_INTERNAL
#include <rpmevr.h>
#define _RPMNS_INTERNAL
@@ -255,8 +256,8 @@
return 0;
}
-int rpmnsProbeSignature(void * _ts, const char * fn, const char * sigfn,
- const char * pubfn, const char * pubid)
+rpmRC rpmnsProbeSignature(void * _ts, const char * fn, const char * sigfn,
+ const char * pubfn, const char * pubid, int flags)
{
rpmts ts = _ts;
pgpDig dig = rpmtsDig(ts);
@@ -266,7 +267,7 @@
size_t sigpktlen = 0;
DIGEST_CTX ctx = NULL;
int printing = 0;
- int rc = 0;
+ rpmRC rc = RPMRC_FAIL; /* assume failure */
int xx;
if (_rpmns_debug)
@@ -327,7 +328,7 @@
goto exit;
}
} else {
- if ((xx = pgpFindPubkey(dig)) != RPMRC_OK) {
+ if ((rc = pgpFindPubkey(dig)) != RPMRC_OK) {
if (_rpmns_debug)
fprintf(stderr, "==> pgpFindPubkey ret %d\n", xx);
goto exit;
@@ -457,16 +458,16 @@
/* Load the message digest. */
switch(sigp->pubkey_algo) {
default:
- xx = 1;
+ rc = RPMRC_FAIL;
break;
case PGPPUBKEYALGO_DSA:
- xx = pgpImplSetDSA(ctx, dig, sigp);
+ rc = (pgpImplSetDSA(ctx, dig, sigp) ? RPMRC_FAIL : RPMRC_OK);
break;
case PGPPUBKEYALGO_RSA:
- xx = pgpImplSetRSA(ctx, dig, sigp);
+ rc = (pgpImplSetRSA(ctx, dig, sigp) ? RPMRC_FAIL : RPMRC_OK);
break;
}
- if (xx) {
+ if (rc != RPMRC_OK) {
if (_rpmns_debug)
fprintf(stderr, "==> can't load pubkey_algo(%u)\n", sigp->pubkey_algo);
goto exit;
@@ -475,13 +476,13 @@
/* Verify the signature. */
switch(sigp->pubkey_algo) {
default:
- rc = 0;
+ rc = RPMRC_FAIL;
break;
case PGPPUBKEYALGO_DSA:
- rc = pgpImplVerifyDSA(dig);
+ rc = (pgpImplVerifyDSA(dig) ? RPMRC_OK : RPMRC_FAIL);
break;
case PGPPUBKEYALGO_RSA:
- rc = pgpImplVerifyRSA(dig);
+ rc = (pgpImplVerifyRSA(dig) ? RPMRC_OK : RPMRC_FAIL);
break;
}
@@ -492,7 +493,8 @@
rpmtsCleanDig(ts);
if (_rpmns_debug)
-fprintf(stderr, "============================ verify: rc %d\n", rc);
+fprintf(stderr, "============================ verify: %s\n",
+ (rc == RPMRC_OK ? "OK" : "FAIL"));
return rc;
}
@@ .
patch -p0 <<'@@ .'
Index: rpm/lib/rpmns.h
============================================================================
$ cvs diff -u -r1.11 -r1.12 rpmns.h
--- rpm/lib/rpmns.h 29 Dec 2007 20:18:47 -0000 1.11
+++ rpm/lib/rpmns.h 30 Dec 2007 14:33:06 -0000 1.12
@@ -123,12 +123,14 @@
* @param sigfn binary/pem encoded signature file (NULL iff clearsign)
* @param pubfn binary/pem encoded pubkey file (NULL uses rpmdb keyring)
* @param pubid pubkey fingerprint hex string (NULL disables check)
- * @return 1 if verified, 0 if not verified
+ * @param flags (unused)
+ * @return RPMRC_OK if verified, RPMRC_FAIL if not verified
*/
-int rpmnsProbeSignature(void * _ts, const char * fn,
+rpmRC rpmnsProbeSignature(void * _ts, const char * fn,
/*@null@*/ const char * sigfn,
/*@null@*/ const char * pubfn,
- /*@null@*/ const char * pubid)
+ /*@null@*/ const char * pubid,
+ int flags)
/*@*/;
#ifdef __cplusplus
@@ .
patch -p0 <<'@@ .'
Index: rpm/rpmio/argv.c
============================================================================
$ cvs diff -u -r1.10 -r1.11 argv.c
--- rpm/rpmio/argv.c 14 Dec 2007 11:22:08 -0000 1.10
+++ rpm/rpmio/argv.c 30 Dec 2007 14:33:07 -0000 1.11
@@ -225,11 +225,11 @@
argv = xmalloc( (argc + 1) * sizeof(*argv));
- for (c = 0, s = dest; s < t; s+= strlen(s) + 1) {
- if (*s == '\0')
+ for (c = 0, s = dest; s < t; s += strlen(s) + 1) {
+ /* XXX Skip repeated seperators (i.e. whitespace). */
+ if (seps == whitespace && s[0] == '\0')
continue;
- argv[c] = xstrdup(s);
- c++;
+ argv[c++] = xstrdup(s);
}
argv[c] = NULL;
*argvp = argv;
@@ .
Received on Sun Dec 30 15:33:07 2007