[gnus git] branch master updated: n0-17-309-gcc9b4a9 =1= auth-source: fix default value evaluation
Julien Danjou <[email protected]>
| Newsgroups | gmane.emacs.gnus.cvs |
|---|---|
| Message-ID | <[email protected]> |
via cc9b4a9373fc9b15ea2fce98a9733d101ee6883d (commit)
from 3d9e1e64bd3e2b5f3fd370ae5b7672189bfff604 (commit)
- Log -----------------------------------------------------------------
commit cc9b4a9373fc9b15ea2fce98a9733d101ee6883d
Author: Julien Danjou <[email protected]>
Date: Tue Sep 20 17:35:43 2011 +0200
auth-source: fix default value evaluation
Signed-off-by: Julien Danjou <[email protected]>
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index b332a31..80016ed 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -3,6 +3,8 @@
* auth-source.el (auth-source-netrc-create): Use default value for
password if specified. Evaluate default.
(auth-source-plstore-create): Ditto.
+ (auth-source-plstore-create, auth-source-netrc-create): Fix default
+ value evaluation.
* password-cache.el (password-cache-remove): Remove entries even if the
value is nil, so that password with a nil value (negative caching) is
diff --git a/lisp/auth-source.el b/lisp/auth-source.el
index a8e6750..c7daed8 100644
--- a/lisp/auth-source.el
+++ b/lisp/auth-source.el
@@ -1201,7 +1201,7 @@ See `auth-source-search' for details on SPEC."
(default (cond
((and (not given-default) (eq r 'user))
(user-login-name))
- (t (eval given-default))))
+ (t given-default)))
(printable-defaults (list
(cons 'user
(or
@@ -1235,11 +1235,8 @@ See `auth-source-search' for details on SPEC."
(?p ,(aget printable-defaults 'port))))))
;; Store the data, prompting for the password if needed.
- (setq data
- (cond
- ((and (null data) (eq r 'secret))
- (if default
- default
+ (setq data (or data
+ (if (eq r 'secret)
;; Special case prompt for passwords.
;; TODO: make the default (setq auth-source-netrc-use-gpg-tokens `((,(if (boundp 'epa-file-auto-mode-alist-entry) (car (symbol-value 'epa-file-auto-mode-alist-entry)) "\\.gpg\\'") nil) (t gpg)))
;; TODO: or maybe leave as (setq auth-source-netrc-use-gpg-tokens 'never)
@@ -1259,7 +1256,7 @@ See `auth-source-search' for details on SPEC."
(setq ret (cdr item))
(setq check nil)))))
(t 'never)))
- (plain (read-passwd prompt)))
+ (plain (or (eval default) read-passwd prompt)))
;; ask if we don't know what to do (in which case
;; auth-source-netrc-use-gpg-tokens must be a list)
(unless gpg-encrypt
@@ -1270,15 +1267,14 @@ See `auth-source-search' for details on SPEC."
auth-source-netrc-use-gpg-tokens)))
(if (eq gpg-encrypt 'gpg)
(auth-source-epa-make-gpg-token plain file)
- plain))))
- ((null data)
- (when default
+ plain))
+ (if (stringp default)
(read-string (if (string-match ": *\\'" prompt)
(concat (substring prompt 0 (match-beginning 0))
" (default " default "): ")
(concat prompt "(default " default ") "))
- nil nil default)))
- (t (or data default))))
+ nil nil default)
+ (eval default)))))
(when data
(setq artificial (plist-put artificial
@@ -1648,7 +1644,7 @@ authentication tokens:
(default (cond
((and (not given-default) (eq r 'user))
(user-login-name))
- (t (eval given-default))))
+ (t given-default)))
(printable-defaults (list
(cons 'user
(or
@@ -1682,21 +1678,16 @@ authentication tokens:
(?p ,(aget printable-defaults 'port))))))
;; Store the data, prompting for the password if needed.
- (setq data
- (cond
- ((and (null data) (eq r 'secret))
- ;; Special case prompt for passwords.
- (if default
- default
- (read-passwd prompt)))
- ((null data)
- (when default
+ (setq data (or data
+ (if (eq r 'secret)
+ (or (eval default) (read-passwd prompt))
+ (if stringp default
(read-string (if (string-match ": *\\'" prompt)
(concat (substring prompt 0 (match-beginning 0))
" (default " default "): ")
(concat prompt "(default " default ") "))
- nil nil default)))
- (t (or data default))))
+ nil nil default)
+ (eval default)))))
(when data
(if (member r base-secret)
-----------------------------------------------------------------------
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we listed those
revisions in full, above.
Summary of changes:
lisp/ChangeLog | 2 +
lisp/auth-source.el | 113 +++++++++++++++++++++++---------------------------
2 files changed, 54 insertions(+), 61 deletions(-)
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Gnus Project".
The branch, master has been updated
hooks/post-receive
--
Gnus Project