[git] GnuPG - branch, master, updated. gnupg-2.1.16-154-ga76fe9e

by Justus Winter cvs at cvs.gnupg.org
Mon Dec 19 15:42:56 CET 2016


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "The GNU Privacy Guard".

The branch, master has been updated
       via  a76fe9e86d7802e67373218bd1759168585e92ab (commit)
       via  a1afc450e182af02ad5e6f6ba79e9dc4332ca2bc (commit)
       via  a45dc0849da0d944ec8c759bc8e3e733b1eb0079 (commit)
       via  3949cbd1128585c9b810713aeffaa1455fb5aed9 (commit)
       via  df00745d6eed7034b218a0c482a46d975425798a (commit)
      from  026bbf0d5ee4510967e5f1dd3db2dee4687b0612 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit a76fe9e86d7802e67373218bd1759168585e92ab
Author: Justus Winter <justus at g10code.com>
Date:   Mon Dec 19 15:40:16 2016 +0100

    doc: Clarify that delkey deletes public keys.
    
    --
    GnuPG-bug-id: 2878
    Signed-off-by: Justus Winter <justus at g10code.com>

diff --git a/doc/gpg.texi b/doc/gpg.texi
index e02c5c1..469e548 100644
--- a/doc/gpg.texi
+++ b/doc/gpg.texi
@@ -930,7 +930,8 @@ signing.
   @opindex keyedit:delkey
   Remove a subkey (secondary key). Note that it is not possible to retract
   a subkey, once it has been send to the public (i.e. to a keyserver).  In
-  that case you better use @code{revkey}.
+  that case you better use @code{revkey}.  Also note that this only
+  deletes the public part of a key.
 
   @item revkey
   @opindex keyedit:revkey

commit a1afc450e182af02ad5e6f6ba79e9dc4332ca2bc
Author: Justus Winter <justus at g10code.com>
Date:   Mon Dec 19 15:33:55 2016 +0100

    tests: New test for --delete-[secret-]keys.
    
    * tests/openpgp/Makefile.am (XTESTS): Add new test.
    * tests/openpgp/defs.scm (keys): New variable.
    (have-public-key?): New function.
    (have-secret-key?): Likewise.
    (have-secret-key-file?): Likewise.
    * tests/openpgp/delete-keys.scm: New file.
    * tests/openpgp/quick-key-manipulation.scm: Move the accessors to
    'defs.scm'.
    
    Signed-off-by: Justus Winter <justus at g10code.com>

diff --git a/tests/openpgp/Makefile.am b/tests/openpgp/Makefile.am
index deed63d..0670531 100644
--- a/tests/openpgp/Makefile.am
+++ b/tests/openpgp/Makefile.am
@@ -90,6 +90,7 @@ XTESTS = \
 	ssh-export.scm \
 	quick-key-manipulation.scm \
 	key-selection.scm \
+	delete-keys.scm \
 	issue2015.scm \
 	issue2346.scm \
 	issue2417.scm \
diff --git a/tests/openpgp/defs.scm b/tests/openpgp/defs.scm
index ef81f99..7867080 100644
--- a/tests/openpgp/defs.scm
+++ b/tests/openpgp/defs.scm
@@ -35,6 +35,31 @@
 ;; first and then search for the encryption subkey.)
 (define dsa-usrname2 "0xCB879DE9")
 
+(define keys
+  (package
+   (define (new fpr grip uids subkeys)
+     (package))
+   (define (subkey fpr grip)
+     (package))
+   (define alfa (new "A0FF4590BB6122EDEF6E3C542D727CC768697734"
+		     "76F7E2B35832976B50A27A282D9B87E44577EB66"
+		     '("alfa at example.net" "alpha at example.net")
+		     (list
+		      (subkey "3B3FBC948FE59301ED629EFB6AE6D7EE46A871F8"
+			      "A0747D5F9425E6664F4FFBEED20FBCA79FDED2BD"))))
+   (define one (new "289B0EF1D105E124B6F626020EF77096D74C5F22"
+		    "50B2D4FA4122C212611048BC5FC31BD44393626E"
+		    '("one at example.com")
+		    (list
+		     (subkey "EB467DCA4AD7676A6A62B2ABABAB28A247BE2775"
+			     "7E201E28B6FEB2927B321F443205F4724EBE637E"))))
+   (define two (new "C1DEBB34EA8B71009EAFA474973D50E1C40FDECF"
+		    "343D8AF79796EE107D645A2787A9D9252F924E6F"
+		    '("two at example.com")
+		    (list
+		     (subkey "CD3D0F5701CBFCACB2A4907305A37887B27907AA"
+			     "8B5ABF3EF9EB8D96B91A0B8C2C4401C91C834C34"))))))
+
 (define key-file1 "samplekeys/rsa-rsa-sample-1.asc")
 (define key-file2 "samplekeys/ed25519-cv25519-sample-1.asc")
 
@@ -117,6 +142,30 @@
     (map (lambda (line) (string-split line #\:))
 	 (string-split-newlines s))))
 
+;; Convenient accessors for the colon output.
+(define (:type x)   (string->symbol (list-ref x 0)))
+(define (:length x) (string->number (list-ref x 2)))
+(define (:alg x) (string->number (list-ref x 3)))
+(define (:expire x) (list-ref x 6))
+(define (:fpr x) (list-ref x 9))
+(define (:cap x) (list-ref x 11))
+
+(define (have-public-key? key)
+  (catch #f
+	 (pair? (filter (lambda (l) (and (equal? 'fpr (:type l))
+					 (equal? key::fpr (:fpr l))))
+			(gpg-with-colons `(--list-keys ,key::fpr))))))
+
+(define (have-secret-key? key)
+  (catch #f
+	 (pair? (filter (lambda (l) (and (equal? 'fpr (:type l))
+					 (equal? key::fpr (:fpr l))))
+			(gpg-with-colons `(--list-secret-keys ,key::fpr))))))
+
+(define (have-secret-key-file? key)
+  (file-exists? (path-join (getenv "GNUPGHOME") "private-keys-v1.d"
+			   (string-append key::grip ".key"))))
+
 (define (get-config what)
   (string-split (caddar (gpg-with-colons `(--list-config ,what))) #\;))
 
diff --git a/tests/openpgp/delete-keys.scm b/tests/openpgp/delete-keys.scm
new file mode 100755
index 0000000..9a187a2
--- /dev/null
+++ b/tests/openpgp/delete-keys.scm
@@ -0,0 +1,103 @@
+#!/usr/bin/env gpgscm
+
+;; Copyright (C) 2016 g10 Code GmbH
+;;
+;; This file is part of GnuPG.
+;;
+;; GnuPG is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 3 of the License, or
+;; (at your option) any later version.
+;;
+;; GnuPG is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+;;
+;; You should have received a copy of the GNU General Public License
+;; along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+(load (with-path "defs.scm"))
+(setup-legacy-environment)
+
+(let* ((key keys::alfa)
+      (subkey (car key::subkeys)))
+  (assert (have-public-key? key))
+  (assert (have-public-key? subkey))
+  (assert (have-secret-key? key))
+  (assert (have-secret-key-file? key))
+  (assert (have-secret-key? subkey))
+  (assert (have-secret-key-file? subkey))
+
+  ;; Firstly, delete the secret key.
+  (call-check `(, at gpg --delete-secret-keys ,key::fpr))
+  (assert (have-public-key? key))
+  (assert (have-public-key? subkey))
+  (assert (not (have-secret-key? key)))
+  (assert (not (have-secret-key-file? key)))
+  (assert (not (have-secret-key? subkey)))
+  (assert (not (have-secret-key-file? subkey)))
+
+  ;; Now, delete the public key.
+  (call-check `(, at gpg --delete-keys ,key::fpr))
+  (assert (not (have-public-key? key)))
+  (assert (not (have-public-key? subkey))))
+
+;; Do the same for key one, but do the subkeys separately.
+(let* ((key keys::one)
+       (subkey (car key::subkeys)))
+  (assert (have-public-key? key))
+  (assert (have-public-key? subkey))
+  (assert (have-secret-key? key))
+  (assert (have-secret-key-file? key))
+  (assert (have-secret-key-file? key))
+  (assert (have-secret-key? subkey))
+  (assert (have-secret-key-file? subkey))
+
+  ;; Firstly, delete the secret subkey.
+  (call-check `(, at gpg --delete-secret-keys ,subkey::fpr))
+  (assert (have-public-key? key))
+  (assert (have-public-key? subkey))
+  ;; JW: Deleting the secret subkey also deletes the secret key.
+  ;; XXX (assert (have-secret-key? key))
+  ;; XXX (assert (have-secret-key-file? key))
+  (assert (not (have-secret-key? subkey)))
+  (assert (not (have-secret-key-file? subkey)))
+
+  ;; Then, delete the secret key.
+  ;; XXX (call-check `(, at gpg --delete-secret-keys ,key::fpr))
+  (assert (have-public-key? key))
+  (assert (have-public-key? subkey))
+  (assert (not (have-secret-key? key)))
+  (assert (not (have-secret-key-file? key)))
+  (assert (not (have-secret-key? subkey)))
+  (assert (not (have-secret-key-file? subkey)))
+
+  ;; Now, delete the public subkey.
+  (call-check `(, at gpg --delete-keys ,subkey::fpr))
+  ;; JW: Deleting the subkey also deletes the key.
+  ;; XXX (assert (have-public-key? key))
+  (assert (not (have-public-key? subkey)))
+
+  ;; Now, delete the public key.
+  ;; XXX (call-check `(, at gpg --delete-keys ,key::fpr))
+  (assert (not (have-public-key? key)))
+  (assert (not (have-public-key? subkey))))
+
+(let* ((key keys::two)
+      (subkey (car key::subkeys)))
+  (assert (have-public-key? key))
+  (assert (have-public-key? subkey))
+  (assert (have-secret-key? key))
+  (assert (have-secret-key-file? key))
+  (assert (have-secret-key? subkey))
+  (assert (have-secret-key-file? subkey))
+
+  ;; Delete everything at once.
+  (call-check `(, at gpg --delete-secret-and-public-key ,key::fpr))
+  (assert (not (have-public-key? key)))
+  (assert (not (have-public-key? subkey)))
+  (assert (not (have-secret-key? key)))
+  (assert (not (have-secret-key-file? key)))
+  (assert (not (have-secret-key? subkey)))
+  (assert (not (have-secret-key-file? subkey))))
diff --git a/tests/openpgp/quick-key-manipulation.scm b/tests/openpgp/quick-key-manipulation.scm
index 9b9c919..d43f7b5 100755
--- a/tests/openpgp/quick-key-manipulation.scm
+++ b/tests/openpgp/quick-key-manipulation.scm
@@ -27,13 +27,6 @@
 (define (exact id)
   (string-append "=" id))
 
-;; Convenient accessors for the colon output.
-(define (:length x) (string->number (list-ref x 2)))
-(define (:alg x) (string->number (list-ref x 3)))
-(define (:expire x) (list-ref x 6))
-(define (:fpr x) (list-ref x 9))
-(define (:cap x) (list-ref x 11))
-
 (define (count-uids-of-secret-key id)
   (length (filter (lambda (x) (and (string=? "uid" (car x))
 				   (not (string=? "r" (cadr x)))))

commit a45dc0849da0d944ec8c759bc8e3e733b1eb0079
Author: Justus Winter <justus at g10code.com>
Date:   Mon Dec 19 15:29:07 2016 +0100

    gpgscm: Change associativity of ::.
    
    * tests/gpgscm/scheme.c (mk_atom): Change associativity of the ::
    infix-operator.  This makes it possible to naturally express accessing
    nested structures (e.g. a::b::c).
    
    Signed-off-by: Justus Winter <justus at g10code.com>

diff --git a/tests/gpgscm/scheme.c b/tests/gpgscm/scheme.c
index 3abe12a..a5b7691 100644
--- a/tests/gpgscm/scheme.c
+++ b/tests/gpgscm/scheme.c
@@ -1409,14 +1409,23 @@ static pointer mk_atom(scheme *sc, char *q) {
      int has_fp_exp = 0;
 
 #if USE_COLON_HOOK
-     if((p=strstr(q,"::"))!=0) {
+     char *next;
+     next = p = q;
+     while ((next = strstr(next, "::")) != 0) {
+	  /* Keep looking for the last occurrence.  */
+	  p = next;
+	  next = next + 2;
+     }
+
+     if (p != q) {
           *p=0;
           return cons(sc, sc->COLON_HOOK,
                           cons(sc,
                               cons(sc,
                                    sc->QUOTE,
-                                   cons(sc, mk_atom(sc,p+2), sc->NIL)),
-                              cons(sc, mk_symbol(sc,strlwr(q)), sc->NIL)));
+                                   cons(sc, mk_symbol(sc, strlwr(p + 2)),
+					sc->NIL)),
+                              cons(sc, mk_atom(sc, q), sc->NIL)));
      }
 #endif
 

commit 3949cbd1128585c9b810713aeffaa1455fb5aed9
Author: Justus Winter <justus at g10code.com>
Date:   Mon Dec 19 15:28:07 2016 +0100

    gpgscm: Display location when assertions fail.
    
    * tests/gpgscm/lib.scm (assert): Use location information if
    available.
    
    Signed-off-by: Justus Winter <justus at g10code.com>

diff --git a/tests/gpgscm/lib.scm b/tests/gpgscm/lib.scm
index fabbef8..6959aa4 100644
--- a/tests/gpgscm/lib.scm
+++ b/tests/gpgscm/lib.scm
@@ -18,13 +18,16 @@
 ;; along with this program; if not, see <http://www.gnu.org/licenses/>.
 
 (macro (assert form)
-  `(if (not ,(cadr form))
-       (begin
-	 (display "Assertion failed: ")
-	 (write (quote ,(cadr form)))
-	 (newline)
-	 (exit 1))))
+  (let ((tag (get-tag form)))
+    `(if (not ,(cadr form))
+	 (throw ,(if (pair? tag)
+		     `(string-append ,(car tag) ":"
+				     ,(number->string (+ 1 (cdr tag)))
+				     ": Assertion failed: ")
+		     "Assertion failed: ")
+		(quote ,(cadr form))))))
 (assert #t)
+(assert (not #f))
 
 (define (filter pred lst)
   (cond ((null? lst) '())

commit df00745d6eed7034b218a0c482a46d975425798a
Author: Justus Winter <justus at g10code.com>
Date:   Mon Dec 19 15:25:52 2016 +0100

    gpgscm: Make exception handling more robust.
    
    * tests/gpgscm/init.scm (throw'): Check that args is a list.
    
    Signed-off-by: Justus Winter <justus at g10code.com>

diff --git a/tests/gpgscm/init.scm b/tests/gpgscm/init.scm
index 04f088c..106afd5 100644
--- a/tests/gpgscm/init.scm
+++ b/tests/gpgscm/init.scm
@@ -597,7 +597,8 @@
   (cond
    ((more-handlers?)
     ((pop-handler) message args history))
-   ((and args (= 2 (length args)) (equal? *interpreter-exit* (car args)))
+   ((and args (list? args) (= 2 (length args))
+	 (equal? *interpreter-exit* (car args)))
     (*run-atexit-handlers*)
     (quit (cadr args)))
    (else

-----------------------------------------------------------------------

Summary of changes:
 doc/gpg.texi                             |   3 +-
 tests/gpgscm/init.scm                    |   3 +-
 tests/gpgscm/lib.scm                     |  15 +++--
 tests/gpgscm/scheme.c                    |  15 ++++-
 tests/openpgp/Makefile.am                |   1 +
 tests/openpgp/defs.scm                   |  49 +++++++++++++++
 tests/openpgp/delete-keys.scm            | 103 +++++++++++++++++++++++++++++++
 tests/openpgp/quick-key-manipulation.scm |   7 ---
 8 files changed, 178 insertions(+), 18 deletions(-)
 create mode 100755 tests/openpgp/delete-keys.scm


hooks/post-receive
-- 
The GNU Privacy Guard
http://git.gnupg.org




More information about the Gnupg-commits mailing list