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 23:33:07
Branch: HEAD Handle: 2007123022330700
Modified files:
rpm CHANGES
rpm/lib genpgp.sh rpmns.c
Log:
- jbj: fix: calculate clearsign'd text digests correctly.
Summary:
Revision Changes Path
1.2043 +1 -0 rpm/CHANGES
2.8 +11 -3 rpm/lib/genpgp.sh
1.12 +13 -10 rpm/lib/rpmns.c
____________________________________________________________________________
patch -p0 <<'@@ .'
Index: rpm/CHANGES
============================================================================
$ cvs diff -u -r1.2042 -r1.2043 CHANGES
--- rpm/CHANGES 30 Dec 2007 18:38:53 -0000 1.2042
+++ rpm/CHANGES 30 Dec 2007 22:33:07 -0000 1.2043
@@ -1,4 +1,5 @@
5.0b3 -> 5.0b4:
+ - jbj: fix: calculate clearsign'd text digests correctly.
- jbj: fix: display RPMRC_NOKEY failures explicitly.
- jbj: rip --predefine entirely, add comment re macro added both global/CLI.
- jbj: link tpgp against rpmnsProbeSignature() instead.
@@ .
patch -p0 <<'@@ .'
Index: rpm/lib/genpgp.sh
============================================================================
$ cvs diff -u -r2.7 -r2.8 genpgp.sh
--- rpm/lib/genpgp.sh 29 Dec 2007 19:38:44 -0000 2.7
+++ rpm/lib/genpgp.sh 30 Dec 2007 22:33:07 -0000 2.8
@@ -22,10 +22,18 @@
%commit
GO_SYSIN_DD
-str="This is the plaintext"
-echo "This is the plaintext" > plaintext
+str="test"
+
+# Note carefully the trailing white space on 1st line below: "${str} "
+# $ od -c plaintext
+# 0000000 t e s t \n t e s t
+# 0000020 \n
+# 0000021
+cat << GO_SYSIN_DD > plaintext
+${str}
+${str}
+GO_SYSIN_DD
-echo "static const char * plaintext = \"$str\";"
echo "static const char * plaintextfn = \"plaintext\";"
$gpg --detach-sign -u DSApub --output - plaintext > DSA.sig
@@ .
patch -p0 <<'@@ .'
Index: rpm/lib/rpmns.c
============================================================================
$ cvs diff -u -r1.11 -r1.12 rpmns.c
--- rpm/lib/rpmns.c 30 Dec 2007 18:38:53 -0000 1.11
+++ rpm/lib/rpmns.c 30 Dec 2007 22:33:07 -0000 1.12
@@ -418,7 +418,6 @@
if (!strncmp((char *)b, clrtxt, strlen(clrtxt))) {
const char * be = (char *) (b + blen);
const char * t;
- const char * te;
/* Skip to '\n\n' start-of-plaintext */
t = (char *) b;
@@ -428,15 +427,19 @@
goto exit;
t++;
- /* Skip to start-of-signature */
- te = t;
- while (te && te < be && strncmp(te, sigtxt, strlen(sigtxt)))
- te = strchr(te, '\n') + 1;
- if (!(te && te < be))
- goto exit;
- te--; /* hmmm, one too far? does clearsign snip last \n? */
-
- xx = rpmDigestUpdate(ctx, t, (te - t));
+ /* Clearsign digest rtrims " \t\r\n", inserts "\r\n" inter-lines. */
+ while (t < be) {
+ const char * teol;
+ const char * te;
+ if ((teol = strchr(t, '\n')) == NULL)
+ break;
+ for (te = teol; te > t && strchr(" \t\r\n", te[-1]); te--)
+ ;
+ xx = rpmDigestUpdate(ctx, t, (te - t));
+ if (!strncmp((t = teol + 1), sigtxt, strlen(sigtxt)))
+ break;
+ xx = rpmDigestUpdate(ctx, "\r\n", sizeof("\r\n")-1);
+ }
} else
xx = rpmDigestUpdate(ctx, b, blen);
@@ .
Received on Sun Dec 30 23:33:08 2007