summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulien Danjou <julien@danjou.info>2011-09-20 14:08:04 +0000
committerKatsumi Yamaoka <yamaoka@jpl.org>2011-09-20 14:08:04 +0000
commitcf499a1a42695fb0ce3aee0b1e6b48a3078ddca3 (patch)
treed4973e4d904193fd4984e926b8172ef07f07ffbb
parente4bd0584194ca5d0a933b20a207b5ad0395a07a6 (diff)
downloademacs-cf499a1a42695fb0ce3aee0b1e6b48a3078ddca3.tar.gz
password-cache.el (password-cache-remove): Remove entries even if the value is nil, so that password with a nil value (negative caching) is possible to invalidate.
auth-source.el (auth-source-format-cache-entry): New function.
-rw-r--r--lisp/ChangeLog6
-rw-r--r--lisp/gnus/ChangeLog4
-rw-r--r--lisp/gnus/auth-source.el13
-rw-r--r--lisp/password-cache.el15
4 files changed, 26 insertions, 12 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 2f4f7051250..a1289fb7750 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,9 @@
+2011-09-20 Julien Danjou <julien@danjou.info>
+
+ * password-cache.el (password-cache-remove): Remove entries even if the
+ value is nil, so that password with a nil value (negative caching) is
+ possible to invalidate.
+
2011-09-20 Lawrence Mitchell <wence@gmx.li>
* progmodes/f90.el (f90-break-line): If breaking inside comment delete
diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog
index 1d53425388d..4838044b7ac 100644
--- a/lisp/gnus/ChangeLog
+++ b/lisp/gnus/ChangeLog
@@ -1,3 +1,7 @@
+2011-09-20 Julien Danjou <julien@danjou.info>
+
+ * auth-source.el (auth-source-format-cache-entry): New function.
+
2011-09-20 Katsumi Yamaoka <yamaoka@jpl.org>
* gnus-fun.el (gnus-convert-image-to-x-face-command): Doc fix.
diff --git a/lisp/gnus/auth-source.el b/lisp/gnus/auth-source.el
index 7a05edfabc2..dc9c23131f1 100644
--- a/lisp/gnus/auth-source.el
+++ b/lisp/gnus/auth-source.el
@@ -749,28 +749,31 @@ Returns the deleted entries."
do (password-cache-remove (symbol-name sym)))
(setq auth-source-netrc-cache nil))
+(defun auth-source-format-cache-entry (spec)
+ "Format SPEC entry to put it in the password cache."
+ (concat auth-source-magic (format "%S" spec)))
+
(defun auth-source-remember (spec found)
"Remember FOUND search results for SPEC."
(let ((password-cache-expiry auth-source-cache-expiry))
(password-cache-add
- (concat auth-source-magic (format "%S" spec)) found)))
+ (auth-source-format-cache-entry spec) found)))
(defun auth-source-recall (spec)
"Recall FOUND search results for SPEC."
- (password-read-from-cache
- (concat auth-source-magic (format "%S" spec))))
+ (password-read-from-cache (auth-source-format-cache-entry spec)))
(defun auth-source-remembered-p (spec)
"Check if SPEC is remembered."
(password-in-cache-p
- (concat auth-source-magic (format "%S" spec))))
+ (auth-source-format-cache-entry spec)))
(defun auth-source-forget (spec)
"Forget any cached data matching SPEC exactly.
This is the same SPEC you passed to `auth-source-search'.
Returns t or nil for forgotten or not found."
- (password-cache-remove (concat auth-source-magic (format "%S" spec))))
+ (password-cache-remove (auth-source-format-cache-entry spec)))
;;; (loop for sym being the symbols of password-data when (string-match (concat "^" auth-source-magic) (symbol-name sym)) collect (symbol-name sym))
diff --git a/lisp/password-cache.el b/lisp/password-cache.el
index 941428d5291..c425e0aa7e8 100644
--- a/lisp/password-cache.el
+++ b/lisp/password-cache.el
@@ -116,13 +116,14 @@ but can be invoked at any time to forcefully remove passwords
from the cache. This may be useful when it has been detected
that a password is invalid, so that `password-read' query the
user again."
- (let ((password (symbol-value (intern-soft key password-data))))
- (when password
- (when (stringp password)
- (if (fboundp 'clear-string)
- (clear-string password)
- (fillarray password ?_)))
- (unintern key password-data))))
+ (let ((sym (intern-soft key password-data)))
+ (when sym
+ (let ((password (symbol-value sym)))
+ (when (stringp password)
+ (if (fboundp 'clear-string)
+ (clear-string password)
+ (fillarray password ?_)))
+ (unintern key password-data)))))
(defun password-cache-add (key password)
"Add password to cache.