[Pkg-gnupg-commit] [gnupg2] 123/124: import post-release bugfixes from upstream
Daniel Kahn Gillmor
dkg at fifthhorseman.net
Wed Apr 5 15:55:45 UTC 2017
This is an automated email from the git hooks/post-receive script.
dkg pushed a commit to branch experimental
in repository gnupg2.
commit 2937394383438a15b943435f6d8bbb70cb4b0753
Author: Daniel Kahn Gillmor <dkg at fifthhorseman.net>
Date: Wed Apr 5 11:42:33 2017 -0400
import post-release bugfixes from upstream
---
.../0012-agent-Minor-fix-for-get_client_pid.patch | 56 +++++++++
.../0013-gpgscm-Simplify-substring-operation.patch | 39 ++++++
...gscm-Simplify-get-output-string-operation.patch | 43 +++++++
.../patches/0015-gpgscm-Fix-copying-values.patch | 103 ++++++++++++++++
...s-Fix-setup-of-ephemeral-home-directories.patch | 133 +++++++++++++++++++++
...s-Fix-setup-of-ephemeral-home-directories.patch | 31 +++++
debian/patches/series | 6 +
7 files changed, 411 insertions(+)
diff --git a/debian/patches/0012-agent-Minor-fix-for-get_client_pid.patch b/debian/patches/0012-agent-Minor-fix-for-get_client_pid.patch
new file mode 100644
index 0000000..d419f9e
--- /dev/null
+++ b/debian/patches/0012-agent-Minor-fix-for-get_client_pid.patch
@@ -0,0 +1,56 @@
+From: NIIBE Yutaka <gniibe at fsij.org>
+Date: Tue, 4 Apr 2017 10:39:00 +0900
+Subject: agent: Minor fix for get_client_pid.
+
+* agent/command-ssh.c (get_client_pid): Use 0 to initialize.
+
+Signed-off-by: NIIBE Yutaka <gniibe at fsij.org>
+(cherry picked from commit 5744d2038bd17b8b1be4e73d0ad3bc41772efe96)
+---
+ agent/command-ssh.c | 10 ++++++----
+ 1 file changed, 6 insertions(+), 4 deletions(-)
+
+diff --git a/agent/command-ssh.c b/agent/command-ssh.c
+index 5a02542..b15d8b2 100644
+--- a/agent/command-ssh.c
++++ b/agent/command-ssh.c
+@@ -3567,7 +3567,7 @@ ssh_request_process (ctrl_t ctrl, estream_t stream_sock)
+ static unsigned long
+ get_client_pid (int fd)
+ {
+- pid_t client_pid = (pid_t)(-1);
++ pid_t client_pid = (pid_t)0;
+
+ #ifdef SO_PEERCRED
+ {
+@@ -3578,7 +3578,7 @@ get_client_pid (int fd)
+ #endif
+ socklen_t cl = sizeof cr;
+
+- if ( !getsockopt (fd, SOL_SOCKET, SO_PEERCRED, &cr, &cl))
++ if (!getsockopt (fd, SOL_SOCKET, SO_PEERCRED, &cr, &cl))
+ {
+ #if defined (HAVE_STRUCT_SOCKPEERCRED_PID) || defined (HAVE_STRUCT_UCRED_PID)
+ client_pid = cr.pid;
+@@ -3593,7 +3593,7 @@ get_client_pid (int fd)
+ {
+ socklen_t len = sizeof (pid_t);
+
+- getsockopt(fd, SOL_LOCAL, LOCAL_PEERPID, &client_pid, &len);
++ getsockopt (fd, SOL_LOCAL, LOCAL_PEERPID, &client_pid, &len);
+ }
+ #elif defined (LOCAL_PEEREID)
+ {
+@@ -3613,9 +3613,11 @@ get_client_pid (int fd)
+ ucred_free (ucred);
+ }
+ }
++#else
++ (void)fd;
+ #endif
+
+- return client_pid == (pid_t)(-1)? 0 : (unsigned long)client_pid;
++ return (unsigned long)client_pid;
+ }
+
+
diff --git a/debian/patches/0013-gpgscm-Simplify-substring-operation.patch b/debian/patches/0013-gpgscm-Simplify-substring-operation.patch
new file mode 100644
index 0000000..a982dd1
--- /dev/null
+++ b/debian/patches/0013-gpgscm-Simplify-substring-operation.patch
@@ -0,0 +1,39 @@
+From: Justus Winter <justus at g10code.com>
+Date: Tue, 4 Apr 2017 14:28:45 +0200
+Subject: gpgscm: Simplify substring operation.
+
+* tests/gpgscm/scheme.c (opexe_2): Simplify 'substring'.
+
+Signed-off-by: Justus Winter <justus at g10code.com>
+(cherry picked from commit d858096c99705ccf2e115475f81c4cf88edbeebf)
+---
+ tests/gpgscm/scheme.c | 8 +-------
+ 1 file changed, 1 insertion(+), 7 deletions(-)
+
+diff --git a/tests/gpgscm/scheme.c b/tests/gpgscm/scheme.c
+index fbc562d..3c7afa3 100644
+--- a/tests/gpgscm/scheme.c
++++ b/tests/gpgscm/scheme.c
+@@ -4355,7 +4355,6 @@ static pointer opexe_2(scheme *sc, enum scheme_opcodes op) {
+ char *str;
+ int index0;
+ int index1;
+- int len;
+
+ str=strvalue(car(sc->args));
+
+@@ -4374,13 +4373,8 @@ static pointer opexe_2(scheme *sc, enum scheme_opcodes op) {
+ index1=strlength(car(sc->args));
+ }
+
+- len=index1-index0;
+ gc_disable(sc, 1);
+- x=mk_empty_string(sc,len,' ');
+- memcpy(strvalue(x),str+index0,len);
+- strvalue(x)[len]=0;
+-
+- s_return_enable_gc(sc, x);
++ s_return_enable_gc(sc, mk_counted_string(sc, str + index0, index1 - index0));
+ }
+
+ CASE(OP_VECTOR): { /* vector */
diff --git a/debian/patches/0014-gpgscm-Simplify-get-output-string-operation.patch b/debian/patches/0014-gpgscm-Simplify-get-output-string-operation.patch
new file mode 100644
index 0000000..650319c
--- /dev/null
+++ b/debian/patches/0014-gpgscm-Simplify-get-output-string-operation.patch
@@ -0,0 +1,43 @@
+From: Justus Winter <justus at g10code.com>
+Date: Tue, 4 Apr 2017 17:38:50 +0200
+Subject: gpgscm: Simplify get-output-string operation.
+
+* tests/gpgscm/scheme.c (opexe_4): Simplify 'get-output-string'.
+
+Signed-off-by: Justus Winter <justus at g10code.com>
+(cherry picked from commit a80d4a9b50ad47eae1f8c740dd73804311e38783)
+---
+ tests/gpgscm/scheme.c | 20 ++++++--------------
+ 1 file changed, 6 insertions(+), 14 deletions(-)
+
+diff --git a/tests/gpgscm/scheme.c b/tests/gpgscm/scheme.c
+index 3c7afa3..736486f 100644
+--- a/tests/gpgscm/scheme.c
++++ b/tests/gpgscm/scheme.c
+@@ -4811,20 +4811,12 @@ static pointer opexe_4(scheme *sc, enum scheme_opcodes op) {
+ port *p;
+
+ if ((p=car(sc->args)->_object._port)->kind&port_string) {
+- off_t size;
+- char *str;
+-
+- size=p->rep.string.curr-p->rep.string.start+1;
+- str=sc->malloc(size);
+- if(str != NULL) {
+- pointer s;
+-
+- memcpy(str,p->rep.string.start,size-1);
+- str[size-1]='\0';
+- s=mk_string(sc,str);
+- sc->free(str);
+- s_return(sc,s);
+- }
++ gc_disable(sc, 1);
++ s_return_enable_gc(
++ sc,
++ mk_counted_string(sc,
++ p->rep.string.start,
++ p->rep.string.curr - p->rep.string.start));
+ }
+ s_return(sc,sc->F);
+ }
diff --git a/debian/patches/0015-gpgscm-Fix-copying-values.patch b/debian/patches/0015-gpgscm-Fix-copying-values.patch
new file mode 100644
index 0000000..1b5d7cc
--- /dev/null
+++ b/debian/patches/0015-gpgscm-Fix-copying-values.patch
@@ -0,0 +1,103 @@
+From: Justus Winter <justus at g10code.com>
+Date: Tue, 4 Apr 2017 17:36:45 +0200
+Subject: gpgscm: Fix copying values.
+
+* tests/gpgscm/scheme.c (copy_value): New function.
+(mk_tagged_value): Use new function.
+(opexe_4): Likewise for OP_SAVE_FORCED.
+--
+
+Occasionally, we need to copy a value from one location in the storage
+to another. Scheme objects are fine. Some primitive objects,
+however, require finalization, usually to free resources.
+
+For these values, we either make a copy or acquire a reference.
+
+Fixes e.g. a double free if a delayed expression evaluating to a
+string is forced.
+
+Signed-off-by: Justus Winter <justus at g10code.com>
+(cherry picked from commit 6261611d3786f19fd84ccc79f45a89cadac518e8)
+---
+ tests/gpgscm/scheme.c | 54 +++++++++++++++++++++++++++++++++++++++++++++++++--
+ 1 file changed, 52 insertions(+), 2 deletions(-)
+
+diff --git a/tests/gpgscm/scheme.c b/tests/gpgscm/scheme.c
+index 736486f..51fdef0 100644
+--- a/tests/gpgscm/scheme.c
++++ b/tests/gpgscm/scheme.c
+@@ -624,6 +624,56 @@ static long binary_decode(const char *s) {
+
+
+
++/*
++ * Copying values.
++ *
++ * Occasionally, we need to copy a value from one location in the
++ * storage to another. Scheme objects are fine. Some primitive
++ * objects, however, require finalization, usually to free resources.
++ *
++ * For these values, we either make a copy or acquire a reference.
++ */
++
++/*
++ * Copy SRC to DST.
++ *
++ * Copies the representation of SRC to DST. This makes SRC
++ * indistinguishable from DST from the perspective of a Scheme
++ * expression modulo the fact that they reside at a different location
++ * in the store.
++ *
++ * Conditions:
++ *
++ * - SRC must not be a vector.
++ * - Caller must ensure that any resources associated with the
++ * value currently stored in DST is accounted for.
++ */
++static void
++copy_value(scheme *sc, pointer dst, pointer src)
++{
++ memcpy(dst, src, sizeof *src);
++
++ /* We may need to make a copy or acquire a reference. */
++ if (typeflag(dst) & T_FINALIZE)
++ switch (type(dst)) {
++ case T_STRING:
++ strvalue(dst) = store_string(sc, strlength(dst), strvalue(dst), 0);
++ break;
++ case T_PORT:
++ /* XXX acquire reference */
++ assert (!"implemented");
++ break;
++ case T_FOREIGN_OBJECT:
++ /* XXX acquire reference */
++ assert (!"implemented");
++ break;
++ case T_VECTOR:
++ assert (!"vectors cannot be copied");
++ }
++}
++
++
++
+ /* Tags are like property lists, but can be attached to arbitrary
+ * values. */
+
+@@ -640,7 +690,7 @@ mk_tagged_value(scheme *sc, pointer v, pointer tag_car, pointer tag_cdr)
+ if (r == sc->sink)
+ return sc->sink;
+
+- memcpy(r, v, sizeof *v);
++ copy_value(sc, r, v);
+ typeflag(r) |= T_TAGGED;
+
+ t = r + 1;
+@@ -4603,7 +4653,7 @@ static pointer opexe_4(scheme *sc, enum scheme_opcodes op) {
+ }
+
+ CASE(OP_SAVE_FORCED): /* Save forced value replacing promise */
+- memcpy(sc->code,sc->value,sizeof(struct cell));
++ copy_value(sc, sc->code, sc->value);
+ s_return(sc,sc->value);
+
+ CASE(OP_WRITE): /* write */
diff --git a/debian/patches/0016-tests-Fix-setup-of-ephemeral-home-directories.patch b/debian/patches/0016-tests-Fix-setup-of-ephemeral-home-directories.patch
new file mode 100644
index 0000000..61394e7
--- /dev/null
+++ b/debian/patches/0016-tests-Fix-setup-of-ephemeral-home-directories.patch
@@ -0,0 +1,133 @@
+From: Justus Winter <justus at g10code.com>
+Date: Tue, 4 Apr 2017 14:32:04 +0200
+Subject: tests: Fix setup of ephemeral home directories.
+
+* tests/openpgp/defs.scm (with-ephemeral-home-directory): Create
+configuration files when we enter the context.
+* tests/openpgp/setup.scm: Do not use an ephemeral home directory.
+Tests should always use the cwd.
+* tests/gpgsm/setup.scm: Likewise.
+* tests/gpgsm/export.scm: Add explicit constructor function.
+* tests/openpgp/decrypt-session-key.scm: Likewise.
+* tests/openpgp/decrypt-unwrap-verify.scm: Likewise.
+--
+
+Previously, ephemeral homedirectories lacked a configuration, hence
+GnuPG tried to start backend daemons using their installed locations.
+Fix this by explicitly creating a suitable configuration.
+
+GnuPG-bug-id: 3047
+Signed-off-by: Justus Winter <justus at g10code.com>
+(cherry picked from commit 32b75fb7743f35936d7014fce33c90ba97dfa374)
+---
+ tests/gpgsm/export.scm | 2 +-
+ tests/gpgsm/setup.scm | 8 +++-----
+ tests/openpgp/decrypt-session-key.scm | 2 +-
+ tests/openpgp/decrypt-unwrap-verify.scm | 2 +-
+ tests/openpgp/defs.scm | 12 ++++++++----
+ tests/openpgp/setup.scm | 13 ++++++-------
+ 6 files changed, 20 insertions(+), 19 deletions(-)
+
+diff --git a/tests/gpgsm/export.scm b/tests/gpgsm/export.scm
+index 1ee91e4..47fb06e 100644
+--- a/tests/gpgsm/export.scm
++++ b/tests/gpgsm/export.scm
+@@ -25,7 +25,7 @@
+ (lambda (cert)
+ (lettmp (exported)
+ (call-check `(, at gpgsm --output ,exported --export ,cert::uid::CN))
+- (with-ephemeral-home-directory
++ (with-ephemeral-home-directory setup-gpgsm-environment
+ (call-check `(, at gpgsm --import ,exported))
+ (assert (sm-have-public-key? cert)))))
+ (lambda (cert) cert::uid::CN)
+diff --git a/tests/gpgsm/setup.scm b/tests/gpgsm/setup.scm
+index 91821a0..aa1ab41 100644
+--- a/tests/gpgsm/setup.scm
++++ b/tests/gpgsm/setup.scm
+@@ -23,8 +23,6 @@
+ (unless (and tarball (not (null? tarball)))
+ (error "Usage: setup.scm --create-tarball <file> ..."))
+
+-(with-ephemeral-home-directory
+- (chdir (getenv "GNUPGHOME"))
+- (create-gpgsmhome)
+- (stop-agent)
+- (call-check `(,(tool 'gpgtar) --create --output ,(car tarball) ".")))
++(setenv "GNUPGHOME" (getcwd) #t)
++(create-gpgsmhome)
++(call-check `(,(tool 'gpgtar) --create --output ,(car tarball) "."))
+diff --git a/tests/openpgp/decrypt-session-key.scm b/tests/openpgp/decrypt-session-key.scm
+index 771b53d..989ce30 100755
+--- a/tests/openpgp/decrypt-session-key.scm
++++ b/tests/openpgp/decrypt-session-key.scm
+@@ -37,7 +37,7 @@
+ (lambda (name)
+ (let* ((source (in-srcdir (string-append name ".asc")))
+ (key (get-session-key source)))
+- (with-ephemeral-home-directory
++ (with-ephemeral-home-directory setup-environment
+ (tr:do
+ (tr:open source)
+ (tr:gpg "" `(--yes --decrypt --override-session-key ,key))
+diff --git a/tests/openpgp/decrypt-unwrap-verify.scm b/tests/openpgp/decrypt-unwrap-verify.scm
+index 97a72e4..ef9a99a 100755
+--- a/tests/openpgp/decrypt-unwrap-verify.scm
++++ b/tests/openpgp/decrypt-unwrap-verify.scm
+@@ -35,7 +35,7 @@
+
+ ;; Then, verify the signature with a clean working directory
+ ;; containing only Steve's public key.
+- (with-ephemeral-home-directory
++ (with-ephemeral-home-directory setup-environment
+ (call-check `(, at gpg --import ,steve's-key))
+ (call-check `(, at gpg --verify ,unwrapped)))))
+ '("encsig-2-keys-3" "encsig-2-keys-4")))
+diff --git a/tests/openpgp/defs.scm b/tests/openpgp/defs.scm
+index e8d06c0..4271ba0 100644
+--- a/tests/openpgp/defs.scm
++++ b/tests/openpgp/defs.scm
+@@ -289,14 +289,18 @@
+
+ ;; Evaluate a sequence of expressions with an ephemeral home
+ ;; directory.
+-(define-macro (with-ephemeral-home-directory . expressions)
++(define-macro (with-ephemeral-home-directory setup-fn . expressions)
+ (let ((original-home-directory (gensym))
+- (ephemeral-home-directory (gensym)))
++ (ephemeral-home-directory (gensym))
++ (setup (gensym)))
+ `(let ((,original-home-directory (getenv "GNUPGHOME"))
+- (,ephemeral-home-directory (mkdtemp)))
++ (,ephemeral-home-directory (mkdtemp))
++ (,setup (delay (,setup-fn))))
+ (finally (unlink-recursively ,ephemeral-home-directory)
+ (dynamic-wind
+- (lambda () (setenv "GNUPGHOME" ,ephemeral-home-directory #t))
++ (lambda ()
++ (force ,setup)
++ (setenv "GNUPGHOME" ,ephemeral-home-directory #t))
+ (lambda () , at expressions)
+ (lambda () (setenv "GNUPGHOME" ,original-home-directory #t)))))))
+
+diff --git a/tests/openpgp/setup.scm b/tests/openpgp/setup.scm
+index 4b3bfcb..a7d14e7 100755
+--- a/tests/openpgp/setup.scm
++++ b/tests/openpgp/setup.scm
+@@ -40,10 +40,9 @@
+ '(gpgconf gpg gpg-agent scdaemon gpgsm dirmngr gpg-connect-agent
+ gpg-preset-passphrase gpgtar pinentry)))
+
+-(with-ephemeral-home-directory
+- (chdir (getenv "GNUPGHOME"))
+- (create-gpghome)
+- (start-agent)
+- (create-legacy-gpghome)
+- (stop-agent)
+- (call-check `(,(tool 'gpgtar) --create --output ,(cadr *args*) ".")))
++(setenv "GNUPGHOME" (getcwd) #t)
++(create-gpghome)
++(start-agent)
++(create-legacy-gpghome)
++(stop-agent)
++(call-check `(,(tool 'gpgtar) --create --output ,(cadr *args*) "."))
diff --git a/debian/patches/0017-tests-Fix-setup-of-ephemeral-home-directories.patch b/debian/patches/0017-tests-Fix-setup-of-ephemeral-home-directories.patch
new file mode 100644
index 0000000..a0bd43e
--- /dev/null
+++ b/debian/patches/0017-tests-Fix-setup-of-ephemeral-home-directories.patch
@@ -0,0 +1,31 @@
+From: Justus Winter <justus at g10code.com>
+Date: Wed, 5 Apr 2017 15:18:30 +0200
+Subject: tests: Fix setup of ephemeral home directories.
+
+* tests/openpgp/defs.scm (with-ephemeral-home-directory): Set
+GNUPGHOME and cwd to the ephemeral directory before calling the setup
+function.
+
+GnuPG-bug-id: 3047
+Fixes-commit: 32b75fb7743f35936d7014fce33c90ba97dfa374
+Signed-off-by: Justus Winter <justus at g10code.com>
+(cherry picked from commit 01e84d429aeeb1450012ff0576a6a24de50693c6)
+---
+ tests/openpgp/defs.scm | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/tests/openpgp/defs.scm b/tests/openpgp/defs.scm
+index 4271ba0..815a560 100644
+--- a/tests/openpgp/defs.scm
++++ b/tests/openpgp/defs.scm
+@@ -299,8 +299,8 @@
+ (finally (unlink-recursively ,ephemeral-home-directory)
+ (dynamic-wind
+ (lambda ()
+- (force ,setup)
+- (setenv "GNUPGHOME" ,ephemeral-home-directory #t))
++ (setenv "GNUPGHOME" ,ephemeral-home-directory #t)
++ (with-working-directory ,ephemeral-home-directory (force ,setup)))
+ (lambda () , at expressions)
+ (lambda () (setenv "GNUPGHOME" ,original-home-directory #t)))))))
+
diff --git a/debian/patches/series b/debian/patches/series
index db4b87c..e30e4f1 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -9,3 +9,9 @@ gpg-agent-idling/0008-agent-Create-framework-of-scheduled-timers.patch
gpg-agent-idling/0009-agent-Allow-threads-to-interrupt-main-select-loop-wi.patch
gpg-agent-idling/0010-agent-Avoid-tight-timer-tick-when-possible.patch
gpg-agent-idling/0011-agent-Avoid-scheduled-checks-on-socket-when-inotify-.patch
+0012-agent-Minor-fix-for-get_client_pid.patch
+0013-gpgscm-Simplify-substring-operation.patch
+0014-gpgscm-Simplify-get-output-string-operation.patch
+0015-gpgscm-Fix-copying-values.patch
+0016-tests-Fix-setup-of-ephemeral-home-directories.patch
+0017-tests-Fix-setup-of-ephemeral-home-directories.patch
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-gnupg/gnupg2.git
More information about the Pkg-gnupg-commit
mailing list