From 4f2d7949f03e1c198bc888f2d05f421d35c57e21 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Mon, 9 Oct 2017 18:53:29 +0100 Subject: reinit the tree, so we can have metadata --- .../gnupg/files/gnupg-2.1.20-gpg-Fix-typo.patch | 27 +++++++ ...g-Properly-account-for-ring-trust-packets.patch | 86 ++++++++++++++++++++++ ...shorter-socket-path-lengts-to-improve-tes.patch | 33 +++++++++ .../gnupg/files/gnupg-2.2.1-fix-gnupg-wait.patch | 85 +++++++++++++++++++++ 4 files changed, 231 insertions(+) create mode 100644 app-crypt/gnupg/files/gnupg-2.1.20-gpg-Fix-typo.patch create mode 100644 app-crypt/gnupg/files/gnupg-2.1.20-gpg-Properly-account-for-ring-trust-packets.patch create mode 100644 app-crypt/gnupg/files/gnupg-2.1.20-gpgscm-Use-shorter-socket-path-lengts-to-improve-tes.patch create mode 100644 app-crypt/gnupg/files/gnupg-2.2.1-fix-gnupg-wait.patch (limited to 'app-crypt/gnupg/files') diff --git a/app-crypt/gnupg/files/gnupg-2.1.20-gpg-Fix-typo.patch b/app-crypt/gnupg/files/gnupg-2.1.20-gpg-Fix-typo.patch new file mode 100644 index 000000000000..292fc264ac84 --- /dev/null +++ b/app-crypt/gnupg/files/gnupg-2.1.20-gpg-Fix-typo.patch @@ -0,0 +1,27 @@ +From 692208fd6c1547cc7dd2062a1d1c9499bc0a8be4 Mon Sep 17 00:00:00 2001 +From: Justus Winter +Date: Mon, 8 May 2017 13:52:39 +0200 +Subject: [PATCH] gpg: Fix typo. + +-- +Signed-off-by: Justus Winter +--- + g10/packet.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/g10/packet.h b/g10/packet.h +index a10495c..d42510d 100644 +--- a/g10/packet.h ++++ b/g10/packet.h +@@ -623,7 +623,7 @@ struct parse_packet_ctx_s + iobuf_t inp; /* The input stream with the packets. */ + struct packet_struct last_pkt; /* The last parsed packet. */ + int free_last_pkt; /* Indicates that LAST_PKT must be freed. */ +- int skip_meta; /* Skip right trust packets. */ ++ int skip_meta; /* Skip ring trust packets. */ + }; + typedef struct parse_packet_ctx_s *parse_packet_ctx_t; + +-- +2.10.2 + diff --git a/app-crypt/gnupg/files/gnupg-2.1.20-gpg-Properly-account-for-ring-trust-packets.patch b/app-crypt/gnupg/files/gnupg-2.1.20-gpg-Properly-account-for-ring-trust-packets.patch new file mode 100644 index 000000000000..58568db47d2a --- /dev/null +++ b/app-crypt/gnupg/files/gnupg-2.1.20-gpg-Properly-account-for-ring-trust-packets.patch @@ -0,0 +1,86 @@ +From 22739433e98be80e46fe7d01d52a9627c1aebaae Mon Sep 17 00:00:00 2001 +From: Justus Winter +Date: Mon, 8 May 2017 14:24:00 +0200 +Subject: [PATCH] gpg: Properly account for ring trust packets. + +* g10/keyring.c (keyring_get_keyblock): Use the parser's packet count +instead of counting ourself. +* g10/packet.h (struct parse_packet_ctx_s): New field +'n_parsed_packets'. +(init_parse_packet): Initialize new field. +* g10/parse-packet.c (parse): Count packets. +-- + +The 'keyring' keystore depends on the number of packets for delete and +update operations. With the rework of the ring trust packets, the +trust packets were no longer properly accounted for leading to keyring +corruptions. + +The 'keybox' store was not affected. + +GnuPG-bug-id: 3123 +GnuPG-bug-id: 3135 +GnuPG-bug-id: 3144 +Fixes-commit: a8895c99a7d0750132477d80cd66caaf3a709113 +Signed-off-by: Justus Winter +--- + g10/keyring.c | 4 ++-- + g10/packet.h | 2 ++ + g10/parse-packet.c | 3 +++ + 3 files changed, 7 insertions(+), 2 deletions(-) + +diff --git a/g10/keyring.c b/g10/keyring.c +index e223f0f..50f1b82 100644 +--- a/g10/keyring.c ++++ b/g10/keyring.c +@@ -409,11 +409,11 @@ keyring_get_keyblock (KEYRING_HANDLE hd, KBNODE *ret_kb) + pkt = xmalloc (sizeof *pkt); + init_packet (pkt); + init_parse_packet (&parsectx, a); +- hd->found.n_packets = 0;; ++ hd->found.n_packets = 0; + lastnode = NULL; + save_mode = set_packet_list_mode(0); + while ((rc=parse_packet (&parsectx, pkt)) != -1) { +- hd->found.n_packets++; ++ hd->found.n_packets = parsectx.n_parsed_packets; + if (gpg_err_code (rc) == GPG_ERR_UNKNOWN_PACKET) { + free_packet (pkt, &parsectx); + init_packet (pkt); +diff --git a/g10/packet.h b/g10/packet.h +index d42510d..cf2121c 100644 +--- a/g10/packet.h ++++ b/g10/packet.h +@@ -624,6 +624,7 @@ struct parse_packet_ctx_s + struct packet_struct last_pkt; /* The last parsed packet. */ + int free_last_pkt; /* Indicates that LAST_PKT must be freed. */ + int skip_meta; /* Skip ring trust packets. */ ++ unsigned int n_parsed_packets; /* Number of parsed packets. */ + }; + typedef struct parse_packet_ctx_s *parse_packet_ctx_t; + +@@ -633,6 +634,7 @@ typedef struct parse_packet_ctx_s *parse_packet_ctx_t; + (a)->last_pkt.pkt.generic= NULL;\ + (a)->free_last_pkt = 0; \ + (a)->skip_meta = 0; \ ++ (a)->n_parsed_packets = 0; \ + } while (0) + + #define deinit_parse_packet(a) do { \ +diff --git a/g10/parse-packet.c b/g10/parse-packet.c +index fa44f83..dbb7af8 100644 +--- a/g10/parse-packet.c ++++ b/g10/parse-packet.c +@@ -764,6 +764,9 @@ parse (parse_packet_ctx_t ctx, PACKET *pkt, int onlykeypkts, off_t * retpos, + partial? (new_ctb ? " partial" : " indeterminate") :"", + new_ctb? " new-ctb":""); + ++ /* Count it. */ ++ ctx->n_parsed_packets++; ++ + pkt->pkttype = pkttype; + rc = GPG_ERR_UNKNOWN_PACKET; /* default error */ + switch (pkttype) +-- +2.10.2 + diff --git a/app-crypt/gnupg/files/gnupg-2.1.20-gpgscm-Use-shorter-socket-path-lengts-to-improve-tes.patch b/app-crypt/gnupg/files/gnupg-2.1.20-gpgscm-Use-shorter-socket-path-lengts-to-improve-tes.patch new file mode 100644 index 000000000000..dd75e3a5e96c --- /dev/null +++ b/app-crypt/gnupg/files/gnupg-2.1.20-gpgscm-Use-shorter-socket-path-lengts-to-improve-tes.patch @@ -0,0 +1,33 @@ +From e3bdb7d17264b8d5bd9abab97c96d9c4a50e4f61 Mon Sep 17 00:00:00 2001 +From: Kristian Fiskerstrand +Date: Mon, 3 Apr 2017 23:44:56 +0300 +Subject: [PATCH] gpgscm: Use shorter socket path lengts to improve test + reliability + +-- +As socket lengths are normally restricted to 108 characters +(UNIX_PATH_MAX variable in /usr/include/linux/un.h), using 42 characters +by default easily results in errors. +--- + tests/gpgscm/tests.scm | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/tests/gpgscm/tests.scm b/tests/gpgscm/tests.scm +index 592b36f..f54a387 100644 +--- a/tests/gpgscm/tests.scm ++++ b/tests/gpgscm/tests.scm +@@ -273,9 +273,9 @@ + (canonical-path (_mkdtemp (if (null? components) + (path-join + (get-temp-path) +- (string-append "gpgscm-" (get-isotime) "-" ++ (string-append "gscm" + (basename-suffix *scriptname* ".scm") +- "-XXXXXX")) ++ "XXXXXX")) + (apply path-join components))))) + + ;; Make a temporary directory and remove it at interpreter shutdown. +-- +2.10.2 + diff --git a/app-crypt/gnupg/files/gnupg-2.2.1-fix-gnupg-wait.patch b/app-crypt/gnupg/files/gnupg-2.2.1-fix-gnupg-wait.patch new file mode 100644 index 000000000000..6a2c18e9b63f --- /dev/null +++ b/app-crypt/gnupg/files/gnupg-2.2.1-fix-gnupg-wait.patch @@ -0,0 +1,85 @@ +From eeb3da6eb717ed6a1a1069a7611eb37503e8672d Mon Sep 17 00:00:00 2001 +From: NIIBE Yutaka +Date: Tue, 19 Sep 2017 12:28:43 +0900 +Subject: [PATCH 2/3] common: Fix gnupg_wait_processes. + +* common/exechelp-posix.c (gnupg_wait_processes): Loop for r_exitcodes +even if we already see an error. + +-- + +The value stored by waitpid for exit code is encoded; It requires +decoded by WEXITSTATUS macro, regardless of an error. + +For example, when one of processes is already exited and another is +still running, it resulted wrong value of in r_exitcodes[n]. + +Signed-off-by: NIIBE Yutaka +--- + common/exechelp-posix.c | 50 +++++++++++++++++++++++++------------------------ + 1 file changed, 26 insertions(+), 24 deletions(-) + +diff --git a/common/exechelp-posix.c b/common/exechelp-posix.c +index 7237993a2..3acf74ad6 100644 +--- a/common/exechelp-posix.c ++++ b/common/exechelp-posix.c +@@ -784,30 +784,32 @@ gnupg_wait_processes (const char **pgmnames, pid_t *pids, size_t count, + } + } + +- if (ec == 0) +- for (i = 0; i < count; i++) +- { +- if (WIFEXITED (r_exitcodes[i]) && WEXITSTATUS (r_exitcodes[i]) == 127) +- { +- log_error (_("error running '%s': probably not installed\n"), +- pgmnames[i]); +- ec = GPG_ERR_CONFIGURATION; +- } +- else if (WIFEXITED (r_exitcodes[i]) && WEXITSTATUS (r_exitcodes[i])) +- { +- if (dummy) +- log_error (_("error running '%s': exit status %d\n"), +- pgmnames[i], WEXITSTATUS (r_exitcodes[i])); +- else +- r_exitcodes[i] = WEXITSTATUS (r_exitcodes[i]); +- ec = GPG_ERR_GENERAL; +- } +- else if (!WIFEXITED (r_exitcodes[i])) +- { +- log_error (_("error running '%s': terminated\n"), pgmnames[i]); +- ec = GPG_ERR_GENERAL; +- } +- } ++ for (i = 0; i < count; i++) ++ { ++ if (r_exitcodes[i] == -1) ++ continue; ++ ++ if (WIFEXITED (r_exitcodes[i]) && WEXITSTATUS (r_exitcodes[i]) == 127) ++ { ++ log_error (_("error running '%s': probably not installed\n"), ++ pgmnames[i]); ++ ec = GPG_ERR_CONFIGURATION; ++ } ++ else if (WIFEXITED (r_exitcodes[i]) && WEXITSTATUS (r_exitcodes[i])) ++ { ++ if (dummy) ++ log_error (_("error running '%s': exit status %d\n"), ++ pgmnames[i], WEXITSTATUS (r_exitcodes[i])); ++ else ++ r_exitcodes[i] = WEXITSTATUS (r_exitcodes[i]); ++ ec = GPG_ERR_GENERAL; ++ } ++ else if (!WIFEXITED (r_exitcodes[i])) ++ { ++ log_error (_("error running '%s': terminated\n"), pgmnames[i]); ++ ec = GPG_ERR_GENERAL; ++ } ++ } + + xfree (dummy); + return gpg_err_make (GPG_ERR_SOURCE_DEFAULT, ec); +-- +2.13.5 + -- cgit v1.2.3