Browse Source

n/gnupg2: Fixed keybox search function.

slackware-14.2
Damien Goutte-Gattat 7 years ago
parent
commit
e7d6badfd9
  1. 61
      n/gnupg2/gnupg-2.1.1-fix-keybox-search.patch
  2. 3
      n/gnupg2/gnupg2.SlackBuild

61
n/gnupg2/gnupg-2.1.1-fix-keybox-search.patch

@ -0,0 +1,61 @@
commit b55709d72f46ec6cdf411874df3dbdb716288ed1
Author: Damien Goutte-Gattat <dgouttegattat@incenp.org>
Date: Fri Dec 26 14:51:41 2014 +0100
kbx: Call skipfnc callback to filter out keys
When searching for keys, extract the key ID from the blob we
found and apply the skipfnc callback function (if any) to filter
out any keys that the caller does not want.
diff --git a/kbx/keybox-search.c b/kbx/keybox-search.c
index 6e72d0b..2126ece 100644
--- a/kbx/keybox-search.c
+++ b/kbx/keybox-search.c
@@ -79,6 +79,30 @@ blob_get_blob_flags (KEYBOXBLOB blob)
}
+static int
+blob_get_keyid (KEYBOXBLOB blob, u32 *kid)
+{
+ const unsigned char *buffer;
+ size_t length, keyinfolen;
+
+ buffer = _keybox_get_blob_image (blob, &length);
+ if (length < 48)
+ return 0; /* blob too short */
+
+ if (buffer[4] != KEYBOX_BLOBTYPE_PGP)
+ return 0; /* don't know what to do with X.509 blobs */
+
+ keyinfolen = get16 (buffer + 18);
+ if (keyinfolen < 28)
+ return 0; /* invalid blob */
+
+ kid[0] = get32 (buffer + 32);
+ kid[1] = get32 (buffer + 36);
+
+ return 1;
+}
+
+
/* Return information on the flag WHAT within the blob BUFFER,LENGTH.
Return the offset and the length (in bytes) of the flag in
FLAGOFF,FLAG_SIZE. */
@@ -967,9 +991,12 @@ keybox_search (KEYBOX_HANDLE hd, KEYBOX_SEARCH_DESC *desc, size_t ndesc,
*r_descindex = n;
for (n=any_skip?0:ndesc; n < ndesc; n++)
{
-/* if (desc[n].skipfnc */
-/* && desc[n].skipfnc (desc[n].skipfncvalue, aki, NULL)) */
-/* break; */
+ u32 kid[2];
+
+ if (desc[n].skipfnc
+ && blob_get_keyid (blob, kid)
+ && desc[n].skipfnc (desc[n].skipfncvalue, kid, NULL))
+ break;
}
if (n == ndesc)
break; /* got it */

3
n/gnupg2/gnupg2.SlackBuild

@ -34,7 +34,7 @@ WGET=${WGET:-ftp://ftp.gnupg.org/gcrypt/gnupg/$ARCHIVE}
# Build infos
NAMEPKG=${NAMEPKG:-gnupg2}
BUILD=${BUILD:-1GGD}
BUILD=${BUILD:-2GGD}
ARCH=${ARCH:-$(uname -m | sed 's/^i.86$/i486/;s/^arm.*/arm/')}
JOBS=${JOBS:-1}
EXT=${EXT:-txz}
@ -85,6 +85,7 @@ cd $TMP
echo "Building $ARCHIVE..."
tar xf $CWD/$ARCHIVE
cd $NAME
patch -p 1 < $CWD/gnupg-2.1.1-fix-keybox-search.patch
CFLAGS=$CPUOPT \
CXXFLAGS=$CPUOPT \
./configure \

Loading…
Cancel
Save