From: Daiki Ueno <ueno@unixuser.org>
To: bug-gnu-emacs@gnu.org
Subject: bug#7487: 24.0.50; Gnus nnimap broken
Date: Wed, 15 Dec 2010 11:06:42 +0900 [thread overview]
Message-ID: <m3ei9j23il.fsf-ueno@unixuser.org> (raw)
In-Reply-To: <m3pqt5kvow.fsf-ueno@unixuser.org> (Daiki Ueno's message of "Tue, 14 Dec 2010 10:08:31 +0900")
[-- Attachment #1: Type: text/plain, Size: 830 bytes --]
Daiki Ueno <ueno@unixuser.org> 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.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: auth-source-gpg-encrypt-to.diff --]
[-- Type: text/x-patch, Size: 2158 bytes --]
=== 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))))
[-- Attachment #3: Type: text/plain, Size: 25 bytes --]
Regards,
--
Daiki Ueno
next prev parent reply other threads:[~2010-12-15 2:06 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <mailman.0.1290791691.11667.bug-gnu-emacs@gnu.org>
2010-11-28 2:56 ` bug#7487: 24.0.50; Gnus nnimap broken Lars Magne Ingebrigtsen
[not found] ` <m3ipziupey.fsf@quimbies.gnus.org>
2010-12-06 16:11 ` Ted Zlatanov
2010-12-07 23:32 ` Lars Magne Ingebrigtsen
2010-12-08 17:00 ` Jason Rumney
2010-12-09 21:15 ` Lars Magne Ingebrigtsen
2010-12-10 2:55 ` Stefan Monnier
[not found] ` <ids61l$jr6$2@quimby.gnus.org>
2010-12-10 16:18 ` Lars Magne Ingebrigtsen
2010-12-08 17:05 ` Jason Rumney
2010-12-08 23:32 ` Stefan Monnier
2010-12-09 21:10 ` Lars Magne Ingebrigtsen
[not found] ` <mailman.1.1291931529.5417.bug-gnu-emacs@gnu.org>
2010-12-10 18:48 ` Ted Zlatanov
2010-12-10 20:56 ` Stefan Monnier
[not found] ` <mailman.38.1292016144.4804.bug-gnu-emacs@gnu.org>
2010-12-13 3:19 ` Lars Magne Ingebrigtsen
2010-12-13 17:08 ` Ted Zlatanov
2010-12-13 20:11 ` Lars Magne Ingebrigtsen
2010-12-14 1:08 ` Daiki Ueno
2010-12-15 2:06 ` Daiki Ueno [this message]
[not found] ` <mailman.3.1292379760.6505.bug-gnu-emacs@gnu.org>
2010-12-15 14:39 ` Ted Zlatanov
2010-12-15 22:05 ` Daiki Ueno
2010-12-15 23:42 ` Daiki Ueno
2010-12-16 2:45 ` Daiki Ueno
[not found] ` <mailman.13.1292467961.28766.bug-gnu-emacs@gnu.org>
2010-12-16 16:00 ` Ted Zlatanov
2010-12-16 19:15 ` Ted Zlatanov
2010-12-16 19:39 ` Lars Magne Ingebrigtsen
2010-12-16 19:44 ` Lars Magne Ingebrigtsen
2010-11-26 17:10 Jason Rumney
2010-12-05 16:49 ` Lars Magne Ingebrigtsen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m3ei9j23il.fsf-ueno@unixuser.org \
--to=ueno@unixuser.org \
--cc=bug-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).