[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] Changes to emacs/lisp/gnus/auth-source.el,v
From: |
Miles Bader |
Subject: |
[Emacs-diffs] Changes to emacs/lisp/gnus/auth-source.el,v |
Date: |
Thu, 06 Nov 2008 00:49:25 +0000 |
CVSROOT: /cvsroot/emacs
Module name: emacs
Changes by: Miles Bader <miles> 08/11/06 00:49:24
Index: auth-source.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/gnus/auth-source.el,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- auth-source.el 8 Jun 2008 11:49:34 -0000 1.9
+++ auth-source.el 6 Nov 2008 00:49:24 -0000 1.10
@@ -91,6 +91,15 @@
p)))
auth-source-protocols))
+(defvar auth-source-cache (make-hash-table :test 'equal)
+ "Cache for auth-source data")
+
+(defcustom auth-source-do-cache t
+ "Whether auth-source should cache information."
+ :group 'auth-source
+ :version "23.1" ;; No Gnus
+ :type `boolean)
+
(defcustom auth-sources '((:source "~/.authinfo.gpg" :host t :protocol t))
"List of authentication sources.
@@ -150,12 +159,26 @@
(unless fallback
(auth-source-pick host protocol t)))))
+(defun auth-source-forget-user-or-password (mode host protocol)
+ (interactive "slogin/password: \nsHost: \nsProtocol: \n") ;for testing
+ (remhash (format "%s %s:%s" mode host protocol) auth-source-cache))
+
(defun auth-source-user-or-password (mode host protocol)
"Find user or password (from the string MODE) matching HOST and PROTOCOL."
(gnus-message 9
"auth-source-user-or-password: get %s for %s (%s)"
mode host protocol)
- (let (found)
+ (let* ((cname (format "%s %s:%s" mode host protocol))
+ (found (gethash cname auth-source-cache)))
+ (if found
+ (progn
+ (gnus-message 9
+ "auth-source-user-or-password: cached %s=%s for %s (%s)"
+ mode
+ ;; don't show the password
+ (if (equal mode "password") "SECRET" found)
+ host protocol)
+ found)
(dolist (choice (auth-source-pick host protocol))
(setq found (netrc-machine-user-or-password
mode
@@ -170,6 +193,8 @@
;; don't show the password
(if (equal mode "password") "SECRET" found)
host protocol)
+ (when auth-source-do-cache
+ (puthash cname found auth-source-cache)))
(return found)))))
(defun auth-source-protocol-defaults (protocol)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] Changes to emacs/lisp/gnus/auth-source.el,v,
Miles Bader <=