[gnus git] branch master updated: n0-17-306-g6b6601f =2= password-cache: fix negative caching invalidation ; auth-source: add auth-source-format-cache-entry

Julien Danjou <[email protected]>
Newsgroups gmane.emacs.gnus.cvs
Message-ID <[email protected]>
       via  6b6601f546f95399fee49605bd4cd186c0d99e31 (commit)
       via  05905038fb21a389fbdf0841921a22d77d336d93 (commit)
      from  ca4edeb73a031281a1f659251d035558a2b9dc6d (commit)


- Log -----------------------------------------------------------------
commit 6b6601f546f95399fee49605bd4cd186c0d99e31
Author: Julien Danjou <[email protected]>
Date:   Tue Sep 20 14:20:39 2011 +0200

    password-cache: fix negative caching invalidation
    
    Signed-off-by: Julien Danjou <[email protected]>

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index f6cf698..3fd5ca5 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,9 @@
 2011-09-20  Julien Danjou  <[email protected]>
 
+	* 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  <[email protected]>
diff --git a/lisp/password-cache.el b/lisp/password-cache.el
index 941428d..c425e0a 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
+  (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))))
+        (unintern key password-data)))))
 
 (defun password-cache-add (key password)
   "Add password to cache.

commit 05905038fb21a389fbdf0841921a22d77d336d93
Author: Julien Danjou <[email protected]>
Date:   Tue Sep 20 13:57:43 2011 +0200

    auth-source: add auth-source-format-cache-entry
    
    Signed-off-by: Julien Danjou <[email protected]>

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 9e68a04..f6cf698 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,7 @@
+2011-09-20  Julien Danjou  <[email protected]>
+
+	* auth-source.el (auth-source-format-cache-entry): New function.
+
 2011-09-20  Katsumi Yamaoka  <[email protected]>
 
 	* gnus-fun.el (gnus-convert-image-to-x-face-command): Doc fix.
diff --git a/lisp/auth-source.el b/lisp/auth-source.el
index 39bf32f..2d6f472 100644
--- a/lisp/auth-source.el
+++ b/lisp/auth-source.el
@@ -759,28 +759,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))
 

-----------------------------------------------------------------------
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         |    8 ++++++++
 lisp/auth-source.el    |   13 ++++++++-----
 lisp/password-cache.el |   15 ++++++++-------
 3 files changed, 24 insertions(+), 12 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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.