]> git.eshelyaron.com Git - emacs.git/commitdiff
package.el: Don't signal "no public key" error if allow-unsigned
authorDaiki Ueno <ueno@gnu.org>
Thu, 26 Jun 2014 07:10:22 +0000 (16:10 +0900)
committerDaiki Ueno <ueno@gnu.org>
Thu, 26 Jun 2014 07:10:22 +0000 (16:10 +0900)
* emacs-lisp/package.el (package--check-signature): If
package-check-signature is allow-unsigned, don't signal error when
we can't verify signature because of missing public key
(bug#17625).

lisp/ChangeLog
lisp/emacs-lisp/package.el

index cd30ff34dce99380f6db29877b26c0e4841eb6ab..850edf64c2885f8a292ab93215a73efbf0070937 100644 (file)
@@ -1,3 +1,10 @@
+2014-06-26  Daiki Ueno  <ueno@gnu.org>
+
+       * emacs-lisp/package.el (package--check-signature): If
+       package-check-signature is allow-unsigned, don't signal error when
+       we can't verify signature because of missing public key
+       (bug#17625).
+
 2014-06-26  Glenn Morris  <rgm@gnu.org>
 
        * emacs-lisp/cl-macs.el (help-add-fundoc-usage):
index c2aaabdd6a60ac90c6223ae45a94134c66a93ac3..4d7ed8f121c001e4937d7a36cb68bbe770df16dc 100644 (file)
@@ -828,16 +828,20 @@ GnuPG keyring is located under \"gnupg\" in `package-user-dir'."
                        (buffer-string))))
     (epg-context-set-home-directory context homedir)
     (epg-verify-string context sig-content (buffer-string))
-    ;; The .sig file may contain multiple signatures.  Success if one
-    ;; of the signatures is good.
-    (let ((good-signatures
-           (delq nil (mapcar (lambda (sig)
-                               (if (eq (epg-signature-status sig) 'good)
-                                   sig))
-                             (epg-context-result-for context 'verify)))))
-      (if (null good-signatures)
-          ;; FIXME: Only signal an error if the signature is invalid, not if we
-          ;; simply lack the key needed to check the sig!
+    (let (good-signatures had-fatal-error)
+      ;; The .sig file may contain multiple signatures.  Success if one
+      ;; of the signatures is good.
+      (dolist (sig (epg-context-result-for context 'verify))
+       (if (eq (epg-signature-status sig) 'good)
+           (push sig good-signatures)
+         ;; If package-check-signature is allow-unsigned, don't
+         ;; signal error when we can't verify signature because of
+         ;; missing public key.  Other errors are still treated as
+         ;; fatal (bug#17625).
+         (unless (and (eq package-check-signature 'allow-unsigned)
+                      (eq (epg-signature-status sig) 'no-pubkey))
+           (setq had-fatal-error t))))
+      (if (and (null good-signatures) had-fatal-error)
           (error "Failed to verify signature %s: %S"
                  sig-file
                  (mapcar #'epg-signature-to-string