password-cache: fix negative caching invalidation
authorJulien Danjou <julien@danjou.info>
Tue, 20 Sep 2011 12:20:39 +0000 (14:20 +0200)
committerJulien Danjou <julien@danjou.info>
Tue, 20 Sep 2011 12:31:10 +0000 (14:31 +0200)
Signed-off-by: Julien Danjou <julien@danjou.info>
lisp/ChangeLog
lisp/password-cache.el

index f6cf698..3fd5ca5 100644 (file)
@@ -1,5 +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.
+
        * auth-source.el (auth-source-format-cache-entry): New function.
 
 2011-09-20  Katsumi Yamaoka  <yamaoka@jpl.org>
index 941428d..c425e0a 100644 (file)
@@ -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.