GNU bug report logs -
#7487
24.0.50; Gnus nnimap broken
Previous Next
Reported by: Jason Rumney <jasonr <at> gnu.org>
Date: Fri, 26 Nov 2010 17:06:02 UTC
Severity: normal
Found in version 24.0.50
Done: Lars Magne Ingebrigtsen <larsi <at> gnus.org>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
Daiki Ueno <ueno <at> 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.
[auth-source-gpg-encrypt-to.diff (text/x-patch, inline)]
=== 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))))
[Message part 3 (text/plain, inline)]
Regards,
--
Daiki Ueno
This bug report was last modified 14 years and 165 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.