From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Teemu Likonen Newsgroups: gmane.emacs.bugs Subject: bug#37025: [found the culprit] Date: Sun, 18 Aug 2019 18:13:49 +0300 Message-ID: <87mug6a4lu.fsf@iki.fi> References: <87imr06o42.fsf@mat.ucm.es> <8736i3y3uw.fsf@mat.ucm.es> <87ef1n4l1c.fsf@iki.fi> <87imqz6nl3.fsf@iki.fi> <875zmyh0ny.fsf@iki.fi> Mime-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="83096"; mail-complaints-to="usenet@blaine.gmane.org" Cc: oub@mat.ucm.es, 37025@debbugs.gnu.org To: Glenn Morris Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Aug 18 17:15:27 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1hzMtz-000LVa-5T for geb-bug-gnu-emacs@m.gmane.org; Sun, 18 Aug 2019 17:15:27 +0200 Original-Received: from localhost ([::1]:41580 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hzMtx-00049w-Vh for geb-bug-gnu-emacs@m.gmane.org; Sun, 18 Aug 2019 11:15:26 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:59308) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hzMtb-000466-Hz for bug-gnu-emacs@gnu.org; Sun, 18 Aug 2019 11:15:04 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hzMta-0007Dc-4e for bug-gnu-emacs@gnu.org; Sun, 18 Aug 2019 11:15:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:49541) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hzMtZ-0007DO-VY for bug-gnu-emacs@gnu.org; Sun, 18 Aug 2019 11:15:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hzMtZ-0006ck-N1 for bug-gnu-emacs@gnu.org; Sun, 18 Aug 2019 11:15:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Teemu Likonen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 18 Aug 2019 15:15:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 37025 X-GNU-PR-Package: emacs Original-Received: via spool by 37025-submit@debbugs.gnu.org id=B37025.156614124625374 (code B ref 37025); Sun, 18 Aug 2019 15:15:01 +0000 Original-Received: (at 37025) by debbugs.gnu.org; 18 Aug 2019 15:14:06 +0000 Original-Received: from localhost ([127.0.0.1]:58362 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hzMsf-0006bB-Mr for submit@debbugs.gnu.org; Sun, 18 Aug 2019 11:14:06 -0400 Original-Received: from mail.kapsi.fi ([91.232.154.25]:48667) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hzMsc-0006b0-Vt for 37025@debbugs.gnu.org; Sun, 18 Aug 2019 11:14:03 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=kapsi.fi; s=20161220; h=Content-Type:MIME-Version:Message-ID:Date:References: In-Reply-To:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=Vui+fhKKaAD2krYKzODNf4aHHaqU1s3tkTMBwrDRBQ4=; b=UV7me3jGYRAKgAeIdMEvnoqKFM 7N1+R5zQf92n3m8kO9fYAB6oGyyi68UjYNO5nPd7cehJX6svAs6xX7H/ytXmYRhMtVXK7YrC8zhyX /hUGHWJiMf4rcYhsHfU2cFi+NDY5w9qGjVR6KsHnWCoLhvr86LzUhA8CVfsJttZMgE494MvwrWY2u Rrd8+nPlr+RUQsyKTP/uVtM26bny0jUh1/Uxs/2DsM6uqvTs7lWZGfs6RC6MoAhrxN4J+rvcvLWtO JAt/KSpC2mCzfi+Pbt39zjkXohnQB9W0HWeYAVbJm6niNLCiu09aM67A1Z47xxu/D0gJTsfs4mPKl 1WT4wYJg==; Original-Received: from mobile-access-6df055-234.dhcp.inet.fi ([109.240.85.234] helo=mithlond) by mail.kapsi.fi with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1hzMsa-0005N8-3d; Sun, 18 Aug 2019 18:14:00 +0300 In-Reply-To: <875zmyh0ny.fsf@iki.fi> X-SA-Exim-Connect-IP: 109.240.85.234 X-SA-Exim-Mail-From: tlikonen@iki.fi X-SA-Exim-Scanned: No (on mail.kapsi.fi); SAEximRunCond expanded to false X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 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: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:165325 Archived-At: --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Teemu Likonen [2019-08-15T19:08:01+03] wrote: > Here's a patch with version checking. This patch includes everything > in the previous patch (that is, use "--sender" only with OpenPGP > protocol) and additionally this checks if gpg is at least version > 2.1.15 which introduced the "--sender" option. The code is probably clearer if we define a separate predicate function for checking GnuPG version. I made another version of the patch which defines function epg-required-version-p (epg-config.el) and uses the function in epg.el. The function is used twice in my patch but it can be useful in the future. diff --git a/lisp/epg-config.el b/lisp/epg-config.el index 5549068169..54328290c8 100644 =2D-- a/lisp/epg-config.el +++ b/lisp/epg-config.el @@ -262,6 +262,15 @@ epg-check-configuration (throw 'version-ok t))) (error "Unsupported version: %s" version)))) =20 +(defun epg-required-version-p (protocol required-version) + "Verify a sufficient version of GnuPG for specific protocol. +PROTOCOL is symbol, either `OpenPGP' or `CMS'. REQUIRED-VERSION +is a string containing the required version number. Return +non-nil if that version or higher is installed." + (let ((version (cdr (assq 'version (epg-find-configuration protocol))))) + (and (stringp version) + (version<=3D required-version version)))) + ;;;###autoload (defun epg-expand-group (config group) "Look at CONFIG and try to expand GROUP." diff --git a/lisp/epg.el b/lisp/epg.el index ce58c520f1..6d377d07e2 100644 =2D-- a/lisp/epg.el +++ b/lisp/epg.el @@ -1618,7 +1618,9 @@ epg-start-sign (car (epg-key-sub-key-list signer))))) (epg-context-signers context))) (let ((sender (epg-context-sender context))) =2D (when (stringp sender) + (when (and (eql 'OpenPGP (epg-context-protocol cont= ext)) + (epg-required-version-p 'OpenPGP "2.1.15= ") + (stringp sender)) (list "--sender" sender))) (epg--args-from-sig-notations (epg-context-sig-notations context)) @@ -1714,9 +1716,11 @@ epg-start-encrypt (car (epg-key-sub-key-list signer))))) (epg-context-signers context)))) =2D (if sign + (if (and sign + (eql 'OpenPGP (epg-context-protocol context)= )) (let ((sender (epg-context-sender context))) =2D (when (stringp sender) + (when (and (epg-required-version-p 'OpenPGP "2.= 1.15") + (stringp sender)) (list "--sender" sender)))) (if sign (epg--args-from-sig-notations diff --git a/lisp/gnus/mml-sec.el b/lisp/gnus/mml-sec.el index 07d2028534..e0ec829617 100644 =2D-- a/lisp/gnus/mml-sec.el +++ b/lisp/gnus/mml-sec.el @@ -915,7 +915,7 @@ mml-secure-epg-encrypt (when sign (setq signers (mml-secure-signers context signer-names)) (setf (epg-context-signers context) signers) =2D (when mml-secure-openpgp-sign-with-sender + (when (and (eq 'OpenPGP protocol) mml-secure-openpgp-sign-with-sende= r) (setf (epg-context-sender context) sender))) (when (eq 'OpenPGP protocol) (setf (epg-context-armor context) t) @@ -945,10 +945,10 @@ mml-secure-epg-sign signature micalg) (when (eq 'OpenPGP protocol) (setf (epg-context-armor context) t) =2D (setf (epg-context-textmode context) t)) + (setf (epg-context-textmode context) t) + (when mml-secure-openpgp-sign-with-sender + (setf (epg-context-sender context) sender))) (setf (epg-context-signers context) signers) =2D (when mml-secure-openpgp-sign-with-sender =2D (setf (epg-context-sender context) sender)) (when (mml-secure-cache-passphrase-p protocol) (epg-context-set-passphrase-callback context =2D-=20 /// OpenPGP key: 4E1055DC84E9DFF613D78557719D69D324539450 // https://keys.openpgp.org/search?q=3Dtlikonen@iki.fi / https://keybase.io/tlikonen https://github.com/tlikonen --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQFEBAEBCAAuFiEEkhZiiC54Bnj5a16Skzo1BB5+rVEFAl1Zay0QHHRsaWtvbmVu QGlraS5maQAKCRCTOjUEHn6tUfnHB/9othU1WgOq2L5CDSL/E3WiGKCDu3igXR/3 FcjOzzub0Ze0LEV55OS9pkH8jfGzKSYcKnG3My1q3ApX74Seydd+iMTgzTDCg9Ol xoz9Af83sO2VtvH+NvHod2sZLMG/BuXgz6zQB6o6qd1jlvABmEv3vzzKw3/JXlw1 Zkouk90QwMfL+ErrGXtI6YX3EgE1NapUeoiaTu0YnJhaXQLHZ4iJQTejEcAX3Vg5 LclgbUgPqZmk8Re3Eq2Nli1qEPuP/iJjqLyRZerg+GGgvPe22QGq9dlbCXDJZDqH m2ZWWibNmCfThYN5/8QIt811y33GwBCtWQF/TCkbCPRwaNHIYqOciIYEARYIAC4W IQTJW2wqtelxC1gHdbitnXWr7pTCcwUCXVlrNhAcdGxpa29uZW5AaWtpLmZpAAoJ EK2ddavulMJzMloBAMOBjCMzjC/WzT/zErWNASJdnZygYwWxgqBj5Q9TTSD8AQCC pvGGAf8oBSdcECOMsh1ul+6S0jkWCH8HFqDp2WiQBw== =IjEN -----END PGP SIGNATURE----- --=-=-=--