From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Daiki Ueno Newsgroups: gmane.emacs.bugs Subject: bug#7487: 24.0.50; Gnus nnimap broken Date: Wed, 15 Dec 2010 11:06:42 +0900 Message-ID: References: <8739q54g7x.fsf@lifelogs.com> <8762uxob2f.fsf@lifelogs.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: dough.gmane.org 1292379766 1414 80.91.229.12 (15 Dec 2010 02:22:46 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 15 Dec 2010 02:22:46 +0000 (UTC) To: bug-gnu-emacs@gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Dec 15 03:22:43 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 1PSh0s-0007xQ-IV for geb-bug-gnu-emacs@m.gmane.org; Wed, 15 Dec 2010 03:22:42 +0100 Original-Received: from localhost ([127.0.0.1]:48940 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PSh0s-000219-0L for geb-bug-gnu-emacs@m.gmane.org; Tue, 14 Dec 2010 21:22:42 -0500 Original-Received: from [140.186.70.92] (port=59348 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PSh0n-000214-DB for bug-gnu-emacs@gnu.org; Tue, 14 Dec 2010 21:22:38 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PSh0m-0003Nn-1s for bug-gnu-emacs@gnu.org; Tue, 14 Dec 2010 21:22:37 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:46496) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PSh0l-0003Nj-Tu for bug-gnu-emacs@gnu.org; Tue, 14 Dec 2010 21:22:36 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1PSgc1-0007H3-Rx; Tue, 14 Dec 2010 20:57:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Daiki Ueno Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org, bugs@gnus.org Resent-Date: Wed, 15 Dec 2010 01:57:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 7487 X-GNU-PR-Package: emacs,gnus X-GNU-PR-Keywords: Original-Received: via spool by submit@debbugs.gnu.org id=B.129237819727929 (code B ref -1); Wed, 15 Dec 2010 01:57:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 15 Dec 2010 01:56:37 +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 1PSgbd-0007GQ-0i for submit@debbugs.gnu.org; Tue, 14 Dec 2010 20:56:37 -0500 Original-Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PSgba-0007GE-TG for submit@debbugs.gnu.org; Tue, 14 Dec 2010 20:56:35 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PSghc-0008GO-CI for submit@debbugs.gnu.org; Tue, 14 Dec 2010 21:02:49 -0500 Original-Received: from lists.gnu.org ([199.232.76.165]:36999) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PSghY-0008FR-83 for submit@debbugs.gnu.org; Tue, 14 Dec 2010 21:02:48 -0500 Original-Received: from [140.186.70.92] (port=50848 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PSghI-0005T6-Q1 for bug-gnu-emacs@gnu.org; Tue, 14 Dec 2010 21:02:38 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PSgh4-0008BM-MB for bug-gnu-emacs@gnu.org; Tue, 14 Dec 2010 21:02:16 -0500 Original-Received: from ivory4.scn-net.ne.jp ([219.117.176.192]:43587) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1PSgh4-0008An-1i for bug-gnu-emacs@gnu.org; Tue, 14 Dec 2010 21:02:14 -0500 Original-Received: from ([192.168.0.187]) (envelope sender: ) by ivory4.scn-net.ne.jp with Active!Hunter esmtp server; Wed, 15 Dec 2010 11:02:10 +0900 Original-Received: Received: from well-done.deisui.org (g187018.scn-net.ne.jp [202.83.187.18]) (authenticated) by blue17.scn-net.ne.jp (unknown) with ESMTP id oBF2298W022207 for ; Wed, 15 Dec 2010 11:02:10 +0900 In-Reply-To: (Daiki Ueno's message of "Tue, 14 Dec 2010 10:08:31 +0900") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Tue, 14 Dec 2010 20:57:01 -0500 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) 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:42524 Archived-At: --=-=-= Daiki Ueno writes: > If you want to simply skip the key selection, I'd suggest to do: > > (make-local-variable 'epa-file-encrypt-to) > (setq epa-file-encrypt-to nil) > > in the "authinfo.gpg" buffer (see epa-file-write-region). Find below a proposed patch to auth-source.el. BTW, I forgot to mention in the previous response, I think it overkill to make epa-file to encrypt files with symmetric encryption by default, because as long as a file is visited in a buffer, epa-file remembers the last used encryption method (in epa-file-encrypt-to local variable), which will be used on the next save-buffer. So a user should see the key selection UI only the first time she saves the buffer. Default symmetric might be useful when Emacs does visit/save/kill-buffer repeatedly, but I think it is a rare case. --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=auth-source-gpg-encrypt-to.diff === modified file 'lisp/gnus/auth-source.el' --- lisp/gnus/auth-source.el 2010-10-10 22:48:40 +0000 +++ lisp/gnus/auth-source.el 2010-12-15 01:32:00 +0000 @@ -159,6 +159,15 @@ (const :tag "Any" t) (string :tag "Specific user name")))))))) +(defcustom auth-source-gpg-encrypt-to t + "List of recipient keys that `authinfo.gpg' encrypted to. +If the value is not a list, symmetric encryption will be used." + :group 'auth-source + :version "23.2" ;; No Gnus + :type '(choice (const :tag "Symmetric encryption" t) + (repeat :tag "Recipient public keys" + (string :tag "Recipient public key")))) + ;; temp for debugging ;; (unintern 'auth-source-protocols) ;; (unintern 'auth-sources) @@ -352,9 +361,28 @@ ;; netrc interface. (when (y-or-n-p (format "Do you want to save this password in %s? " source)) - (netrc-store-data source host prot - (or user (cdr (assoc "login" result))) - (cdr (assoc "password" result)))))) + ;; the code below is almost same as `netrc-store-data' except + ;; the `epa-file-encrypt-to' hack (see bug#7487). + (with-temp-buffer + (when (file-exists-p source) + (insert-file-contents source)) + (when auth-source-gpg-encrypt-to + ;; making `epa-file-encrypt-to' local to this buffer lets + ;; epa-file skip the key selection query (see the + ;; `local-variable-p' check in `epa-file-write-region'). + (unless (local-variable-p 'epa-file-encrypt-to) + (make-local-variable 'epa-file-encrypt-to)) + (if (listp auth-source-gpg-encrypt-to) + (setq epa-file-encrypt-to auth-source-gpg-encrypt-to))) + (goto-char (point-max)) + (unless (bolp) + (insert "\n")) + (insert (format "machine %s login %s password %s port %s\n" + host + (or user (cdr (assoc "login" result))) + (cdr (assoc "password" result)) + prot)) + (write-region (point-min) (point-max) source nil 'silent))))) (if (consp mode) (mapcar #'cdr result) (cdar result)))) --=-=-= Regards, -- Daiki Ueno --=-=-=--