diff options
| author | Julien Danjou | 2011-09-20 14:08:04 +0000 |
|---|---|---|
| committer | Katsumi Yamaoka | 2011-09-20 14:08:04 +0000 |
| commit | cf499a1a42695fb0ce3aee0b1e6b48a3078ddca3 (patch) | |
| tree | d4973e4d904193fd4984e926b8172ef07f07ffbb | |
| parent | e4bd0584194ca5d0a933b20a207b5ad0395a07a6 (diff) | |
| download | emacs-cf499a1a42695fb0ce3aee0b1e6b48a3078ddca3.tar.gz emacs-cf499a1a42695fb0ce3aee0b1e6b48a3078ddca3.zip | |
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/ChangeLog | 6 | ||||
| -rw-r--r-- | lisp/gnus/ChangeLog | 4 | ||||
| -rw-r--r-- | lisp/gnus/auth-source.el | 13 | ||||
| -rw-r--r-- | lisp/password-cache.el | 15 |
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 @@ | |||
| 1 | 2011-09-20 Julien Danjou <julien@danjou.info> | ||
| 2 | |||
| 3 | * password-cache.el (password-cache-remove): Remove entries even if the | ||
| 4 | value is nil, so that password with a nil value (negative caching) is | ||
| 5 | possible to invalidate. | ||
| 6 | |||
| 1 | 2011-09-20 Lawrence Mitchell <wence@gmx.li> | 7 | 2011-09-20 Lawrence Mitchell <wence@gmx.li> |
| 2 | 8 | ||
| 3 | * progmodes/f90.el (f90-break-line): If breaking inside comment delete | 9 | * 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 @@ | |||
| 1 | 2011-09-20 Julien Danjou <julien@danjou.info> | ||
| 2 | |||
| 3 | * auth-source.el (auth-source-format-cache-entry): New function. | ||
| 4 | |||
| 1 | 2011-09-20 Katsumi Yamaoka <yamaoka@jpl.org> | 5 | 2011-09-20 Katsumi Yamaoka <yamaoka@jpl.org> |
| 2 | 6 | ||
| 3 | * gnus-fun.el (gnus-convert-image-to-x-face-command): Doc fix. | 7 | * 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." | |||
| 749 | do (password-cache-remove (symbol-name sym))) | 749 | do (password-cache-remove (symbol-name sym))) |
| 750 | (setq auth-source-netrc-cache nil)) | 750 | (setq auth-source-netrc-cache nil)) |
| 751 | 751 | ||
| 752 | (defun auth-source-format-cache-entry (spec) | ||
| 753 | "Format SPEC entry to put it in the password cache." | ||
| 754 | (concat auth-source-magic (format "%S" spec))) | ||
| 755 | |||
| 752 | (defun auth-source-remember (spec found) | 756 | (defun auth-source-remember (spec found) |
| 753 | "Remember FOUND search results for SPEC." | 757 | "Remember FOUND search results for SPEC." |
| 754 | (let ((password-cache-expiry auth-source-cache-expiry)) | 758 | (let ((password-cache-expiry auth-source-cache-expiry)) |
| 755 | (password-cache-add | 759 | (password-cache-add |
| 756 | (concat auth-source-magic (format "%S" spec)) found))) | 760 | (auth-source-format-cache-entry spec) found))) |
| 757 | 761 | ||
| 758 | (defun auth-source-recall (spec) | 762 | (defun auth-source-recall (spec) |
| 759 | "Recall FOUND search results for SPEC." | 763 | "Recall FOUND search results for SPEC." |
| 760 | (password-read-from-cache | 764 | (password-read-from-cache (auth-source-format-cache-entry spec))) |
| 761 | (concat auth-source-magic (format "%S" spec)))) | ||
| 762 | 765 | ||
| 763 | (defun auth-source-remembered-p (spec) | 766 | (defun auth-source-remembered-p (spec) |
| 764 | "Check if SPEC is remembered." | 767 | "Check if SPEC is remembered." |
| 765 | (password-in-cache-p | 768 | (password-in-cache-p |
| 766 | (concat auth-source-magic (format "%S" spec)))) | 769 | (auth-source-format-cache-entry spec))) |
| 767 | 770 | ||
| 768 | (defun auth-source-forget (spec) | 771 | (defun auth-source-forget (spec) |
| 769 | "Forget any cached data matching SPEC exactly. | 772 | "Forget any cached data matching SPEC exactly. |
| 770 | 773 | ||
| 771 | This is the same SPEC you passed to `auth-source-search'. | 774 | This is the same SPEC you passed to `auth-source-search'. |
| 772 | Returns t or nil for forgotten or not found." | 775 | Returns t or nil for forgotten or not found." |
| 773 | (password-cache-remove (concat auth-source-magic (format "%S" spec)))) | 776 | (password-cache-remove (auth-source-format-cache-entry spec))) |
| 774 | 777 | ||
| 775 | ;;; (loop for sym being the symbols of password-data when (string-match (concat "^" auth-source-magic) (symbol-name sym)) collect (symbol-name sym)) | 778 | ;;; (loop for sym being the symbols of password-data when (string-match (concat "^" auth-source-magic) (symbol-name sym)) collect (symbol-name sym)) |
| 776 | 779 | ||
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 | |||
| 116 | from the cache. This may be useful when it has been detected | 116 | from the cache. This may be useful when it has been detected |
| 117 | that a password is invalid, so that `password-read' query the | 117 | that a password is invalid, so that `password-read' query the |
| 118 | user again." | 118 | user again." |
| 119 | (let ((password (symbol-value (intern-soft key password-data)))) | 119 | (let ((sym (intern-soft key password-data))) |
| 120 | (when password | 120 | (when sym |
| 121 | (when (stringp password) | 121 | (let ((password (symbol-value sym))) |
| 122 | (if (fboundp 'clear-string) | 122 | (when (stringp password) |
| 123 | (clear-string password) | 123 | (if (fboundp 'clear-string) |
| 124 | (fillarray password ?_))) | 124 | (clear-string password) |
| 125 | (unintern key password-data)))) | 125 | (fillarray password ?_))) |
| 126 | (unintern key password-data))))) | ||
| 126 | 127 | ||
| 127 | (defun password-cache-add (key password) | 128 | (defun password-cache-add (key password) |
| 128 | "Add password to cache. | 129 | "Add password to cache. |