From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Christian von Roques Newsgroups: gmane.emacs.bugs Subject: bug#5592: gnus mml2015 epg: Trying and failing to encrypt email to disabled pgp-key Date: Wed, 17 Feb 2010 16:41:00 -0400 Message-ID: <87r5ojd28z.fsf@pepper.mti.ag> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1266557860 12630 80.91.229.12 (19 Feb 2010 05:37:40 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 19 Feb 2010 05:37:40 +0000 (UTC) To: 5592@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Feb 19 06:37:31 2010 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1NiLYQ-0008Ru-BI for geb-bug-gnu-emacs@m.gmane.org; Fri, 19 Feb 2010 06:37:30 +0100 Original-Received: from localhost ([127.0.0.1]:53639 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NiLYP-0003mv-Pr for geb-bug-gnu-emacs@m.gmane.org; Fri, 19 Feb 2010 00:37:29 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Nhqt8-0001jE-Kj for bug-gnu-emacs@gnu.org; Wed, 17 Feb 2010 15:52:50 -0500 Original-Received: from [140.186.70.92] (port=48323 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Nhqt7-0001iI-Hl for bug-gnu-emacs@gnu.org; Wed, 17 Feb 2010 15:52:50 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Nhqt6-0007wr-Oo for bug-gnu-emacs@gnu.org; Wed, 17 Feb 2010 15:52:49 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:34946) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Nhqt6-0007wn-NE for bug-gnu-emacs@gnu.org; Wed, 17 Feb 2010 15:52:48 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1Nhqkc-0008P9-9H; Wed, 17 Feb 2010 15:44:02 -0500 X-Loop: bug-gnu-emacs@gnu.org Resent-From: Christian von Roques Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 17 Feb 2010 20:44:02 +0000 Resent-Message-ID: Resent-Sender: bug-gnu-emacs@gnu.org X-Emacs-PR-Message: report 5592 X-Emacs-PR-Package: emacs,gnus X-Emacs-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.126643941332285 (code B ref -1); Wed, 17 Feb 2010 20:44:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 17 Feb 2010 20:43:33 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Nhqk9-0008Og-FT for submit@debbugs.gnu.org; Wed, 17 Feb 2010 15:43:33 -0500 Original-Received: from fencepost.gnu.org ([140.186.70.10]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Nhqhz-0008Mc-RO for submit@debbugs.gnu.org; Wed, 17 Feb 2010 15:41:20 -0500 Original-Received: from mail.gnu.org ([199.232.76.166]:43512 helo=mx10.gnu.org) by fencepost.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Nhqhv-0002la-Lp for submit@debbugs.gnu.org; Wed, 17 Feb 2010 15:41:15 -0500 Original-Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1Nhqhu-0004AR-6n for submit@debbugs.gnu.org; Wed, 17 Feb 2010 15:41:15 -0500 Original-Received: from lists.gnu.org ([199.232.76.165]:57425) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1Nhqht-0004AL-Vz for submit@debbugs.gnu.org; Wed, 17 Feb 2010 15:41:14 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Nhqht-0004TE-A7 for bug-gnu-emacs@gnu.org; Wed, 17 Feb 2010 15:41:13 -0500 Original-Received: from [140.186.70.92] (port=48699 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Nhqhr-0004SI-7N for bug-gnu-emacs@gnu.org; Wed, 17 Feb 2010 15:41:12 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Nhqhq-0006G5-9c for bug-gnu-emacs@gnu.org; Wed, 17 Feb 2010 15:41:11 -0500 Original-Received: from cw.mti.ag ([206.214.2.10]:26817) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Nhqhq-0006FB-2a for bug-gnu-emacs@gnu.org; Wed, 17 Feb 2010 15:41:10 -0500 Original-Received: from localhost (localhost [127.0.0.1]) by cw.mti.ag (Postfix) with ESMTP id A746F72354 for ; Wed, 17 Feb 2010 16:41:02 -0400 (AST) X-Virus-Scanned: amavisd-new at mti.ag Original-Received: from cw.mti.ag ([127.0.0.1]) by localhost (anger.mti.ag [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id wHTyK81FY9nS for ; Wed, 17 Feb 2010 16:41:01 -0400 (AST) Original-Received: from pepper.mti.ag (pepper.mti.ag [192.168.2.6]) by smtp.mti.ag (Postfix) with ESMTP id 70AF572353 for ; Wed, 17 Feb 2010 16:41:01 -0400 (AST) Original-Received: by pepper.mti.ag (Postfix, from userid 1000) id D62CB74236; Wed, 17 Feb 2010 16:41:00 -0400 (AST) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: OpenBSD 3.0-3.9 X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-Mailman-Approved-At: Wed, 17 Feb 2010 15:43:32 -0500 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Wed, 17 Feb 2010 15:44:02 -0500 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Mailman-Approved-At: Fri, 19 Feb 2010 00:37:11 -0500 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:35187 Archived-At: Package: emacs,gnus Version: 23.1.1 Severity: minor Tags: patch "GNU Emacs 23.1.1 (i486-pc-linux-gnu, GTK+ Version 2.12.12) of 2009-10-19 on debian-build.int-office-er.priv, modified by Debian" When trying to send a pgp-encrypted email to a friend, using gnus, mml2015, and epg, sending the email fails with the error message: "Encrypt failed: exit" My friend has two pgp-keys, of which the first has been disabled from within "gpg --edit-key friend@example.com". mml2015 picks this disabled key, tries to encrypt to it and fails. I expected mml2015 to choose the second, not disabled, key. The patch below (relative to revno 99512 of emacs/trunk) adds 'disabled' to epg-key-capability-alist for disabled keys and uses it in mml2015-epg-find-usable-key to skip disabled keys. Note: epg already tries to determine which key is disabled using the 'd' flag in field 2 of lines from the output of "gpg --list-keys --with-colons". But this is not used by mml2015, does not work with version 1.4.9 of gnupg and according to doc/DETAILS of gnupg-1.4.9 the 'd' flag in field 2 is deprecated and the 'D' in field 12 should be used instead, which is exactly what my patch is doing. My changes should be safe with older versions of gnupg because they just don't put 'D' in field 12. Christian. === modified file 'lisp/epg.el' --- old/lisp/epg.el 2010-01-13 08:35:10 +0000 +++ new/lisp/epg.el 2010-02-17 19:18:09 +0000 @@ -136,9 +136,10 @@ (defvar epg-key-capablity-alist '((?e . encrypt) (?s . sign) (?c . certify) - (?a . authentication))) + (?a . authentication) + (?D . disabled))) (defvar epg-new-signature-type-alist '((?D . detached) (?C . clear) === modified file 'lisp/gnus/mml2015.el' --- old/lisp/gnus/mml2015.el 2010-01-13 08:35:10 +0000 +++ new/lisp/gnus/mml2015.el 2010-02-17 19:18:09 +0000 @@ -1018,8 +1018,9 @@ (while keys (let ((pointer (epg-key-sub-key-list (car keys)))) (while pointer (if (and (memq usage (epg-sub-key-capability (car pointer))) + (not (memq 'disabled (epg-sub-key-capability (car pointer)))) (not (memq (epg-sub-key-validity (car pointer)) '(revoked expired)))) (throw 'found (car keys))) (setq pointer (cdr pointer))))