~ubuntu-branches/ubuntu/trusty/gnupg/trusty-updates

« back to all changes in this revision

Viewing changes to debian/patches/long-keyids.dpatch

  • Committer: Package Import Robot
  • Author(s): Colin Watson
  • Date: 2012-12-04 22:26:16 UTC
  • mfrom: (1.1.18 sid)
  • Revision ID: package-import@ubuntu.com-20121204222616-cr0fow26geq90l3y
Tags: 1.4.12-6ubuntu1
* Resynchronise with Debian.  Remaining changes:
  - Disable mlock() test since it fails with ulimit 0 (on buildds).
  - Set gpg (or gpg2) and gpgsm to use a passphrase agent by default.
  - Only suggest gnupg-curl and libldap; recommendations are pulled into
    minimal, and we don't need the keyserver utilities in a minimal Ubuntu
    system.
  - Remove the Win32 build.
  - Update config.guess/config.sub for aarch64.
* Dropped patches:
  - Fix udeb build failure on powerpc, building with -O2 instead of -Os.
    (No longer seems to be necessary.)
* Simplify removal of Win32 build, to make this easier to merge in future.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#! /bin/sh /usr/share/dpatch/dpatch-run
2
 
# Description: Use the longest key ID available when requesting a key from
3
 
#  a key server
4
 
# Origin: upstream, http://git.gnupg.org/cgi-bin/gitweb.cgi?p=gnupg.git;a=commit;h=6fe25e5602fabe92c68e5ba30e4777221e8612df
5
 
# Bug: https://bugs.g10code.com/gnupg/issue1340
6
 
 
7
 
@DPATCH@
8
 
diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' gnupg-1.4.11~/keyserver/gpgkeys_hkp.c gnupg-1.4.11/keyserver/gpgkeys_hkp.c
9
 
--- gnupg-1.4.11~/keyserver/gpgkeys_hkp.c       2009-08-25 14:41:27.000000000 -0400
10
 
+++ gnupg-1.4.11/keyserver/gpgkeys_hkp.c        2012-07-24 10:28:34.399282804 -0400
11
 
@@ -234,9 +234,10 @@
12
 
 get_key(char *getkey)
13
 
 {
14
 
   CURLcode res;
15
 
-  char request[MAX_URL+60];
16
 
+  char request[MAX_URL+92];
17
 
   char *offset;
18
 
   struct curl_writer_ctx ctx;
19
 
+  size_t keylen;
20
 
 
21
 
   memset(&ctx,0,sizeof(ctx));
22
 
 
23
 
@@ -262,14 +263,19 @@
24
 
   strcat(request,port);
25
 
   strcat(request,opt->path);
26
 
   /* request is MAX_URL+55 bytes long - MAX_URL covers the whole URL,
27
 
-     including any supplied path.  The 60 overcovers this /pks/... etc
28
 
-     string plus the 8 bytes of key id */
29
 
+     including any supplied path.  The 92 overcovers this /pks/... etc
30
 
+     string plus the 8, 16, or 40 bytes of key id/fingerprint */
31
 
   append_path(request,"/pks/lookup?op=get&options=mr&search=0x");
32
 
 
33
 
-  /* fingerprint or long key id.  Take the last 8 characters and treat
34
 
-     it like a short key id */
35
 
-  if(strlen(getkey)>8)
36
 
-    offset=&getkey[strlen(getkey)-8];
37
 
+  /* send only fingerprint, long key id, or short keyid.  see:
38
 
+     https://tools.ietf.org/html/draft-shaw-openpgp-hkp-00#section-3.1.1.1 */
39
 
+  keylen = strlen(getkey);
40
 
+  if(keylen >= 40)
41
 
+    offset=&getkey[keylen-40];
42
 
+  else if(keylen >= 16)
43
 
+    offset=&getkey[keylen-16];
44
 
+  else if(keylen >= 8)
45
 
+    offset=&getkey[keylen-8];
46
 
   else
47
 
     offset=getkey;
48