aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/net
diff options
context:
space:
mode:
authorTed Zlatanov2011-02-12 11:51:02 -0600
committerTed Zlatanov2011-02-12 11:51:02 -0600
commit563790b6db1fed5d81809ca826e19685b78461f4 (patch)
tree0115ee56f0b0046fca7b41b293c192ac06df3dc6 /lisp/net
parent50fd938f33c9c5e91a407595ad9609379e46d11a (diff)
downloademacs-563790b6db1fed5d81809ca826e19685b78461f4.tar.gz
emacs-563790b6db1fed5d81809ca826e19685b78461f4.zip
Use `auto-source-search' instead of `auto-source-user-or-password'.
* mail/smtpmail.el: Autoload `auto-source-search' instead of `auto-source-user-or-password. (smtpmail-try-auth-methods): Use it. * net/imap-hash.el: Autoload `auto-source-search' instead of `auto-source-user-or-password. (imap-hash-open-connection): Use it. * net/tramp-imap.el: Autoload `auto-source-search' instead of `auto-source-user-or-password. (tramp-imap-passphrase-callback-function): Use it. * net/tramp.el (tramp-default-method): Also check if `auth-source-search' is bound. (tramp-read-passwd): Use `auth-source-search' instead of `auto-source-user-or-password'. * url-parse.el (url-bit-for-url, url-user-for-url) (url-password-for-url): Use `auto-source-search' instead of `auto-source-user-or-password'. * url-auth.el: Autoload `auto-source-search' instead of `auto-source-user-or-password'. (url-basic-auth, url-digest-auth, url-do-auth-source-search): Use it.
Diffstat (limited to 'lisp/net')
-rw-r--r--lisp/net/imap-hash.el13
-rw-r--r--lisp/net/tramp-imap.el12
-rw-r--r--lisp/net/tramp.el24
3 files changed, 36 insertions, 13 deletions
diff --git a/lisp/net/imap-hash.el b/lisp/net/imap-hash.el
index d21b714d950..a07277cee68 100644
--- a/lisp/net/imap-hash.el
+++ b/lisp/net/imap-hash.el
@@ -43,7 +43,7 @@
43(require 'imap) 43(require 'imap)
44(require 'sendmail) ; for mail-header-separator 44(require 'sendmail) ; for mail-header-separator
45(require 'message) 45(require 'message)
46(autoload 'auth-source-user-or-password "auth-source") 46(autoload 'auth-source-search "auth-source")
47 47
48;; retrieve these headers 48;; retrieve these headers
49(defvar imap-hash-headers 49(defvar imap-hash-headers
@@ -267,13 +267,14 @@ The function is passed the message headers (see `imap-hash-get-headers')."
267 (imap-hash-password iht)))) 267 (imap-hash-password iht))))
268 ;; this will not be needed if auth-need is t 268 ;; this will not be needed if auth-need is t
269 (auth-info (when auth-need 269 (auth-info (when auth-need
270 (auth-source-user-or-password 270 (nth 0 (auth-source-search :host server :port port))))
271 '("login" "password")
272 server port)))
273 (auth-user (or (imap-hash-user iht) 271 (auth-user (or (imap-hash-user iht)
274 (nth 0 auth-info))) 272 (plist-get auth-info :user)))
275 (auth-passwd (or (imap-hash-password iht) 273 (auth-passwd (or (imap-hash-password iht)
276 (nth 1 auth-info))) 274 (plist-get auth-info :secret)))
275 (auth-passwd (if (functionp auth-passwd)
276 (funcall auth-passwd)
277 auth-passwd))
277 (imap-logout-timeout nil)) 278 (imap-logout-timeout nil))
278 279
279 ;; (debug "opening server: opened+state" (imap-opened) imap-state) 280 ;; (debug "opening server: opened+state" (imap-opened) imap-state)
diff --git a/lisp/net/tramp-imap.el b/lisp/net/tramp-imap.el
index 3a536103c3d..4157265b0e1 100644
--- a/lisp/net/tramp-imap.el
+++ b/lisp/net/tramp-imap.el
@@ -56,7 +56,7 @@
56(require 'assoc) 56(require 'assoc)
57(require 'tramp) 57(require 'tramp)
58 58
59(autoload 'auth-source-user-or-password "auth-source") 59(autoload 'auth-source-search "auth-source")
60(autoload 'epg-context-operation "epg") 60(autoload 'epg-context-operation "epg")
61(autoload 'epg-context-set-armor "epg") 61(autoload 'epg-context-set-armor "epg")
62(autoload 'epg-context-set-passphrase-callback "epg") 62(autoload 'epg-context-set-passphrase-callback "epg")
@@ -639,8 +639,14 @@ HANDBACK is just carried through.
639KEY-ID can be 'SYM or 'PIN among others." 639KEY-ID can be 'SYM or 'PIN among others."
640 (let* ((server tramp-current-host) 640 (let* ((server tramp-current-host)
641 (port "tramp-imap") ; this is NOT the server password! 641 (port "tramp-imap") ; this is NOT the server password!
642 (auth-passwd 642 (auth-passwd (plist-get
643 (auth-source-user-or-password "password" server port))) 643 (nth 0 (auth-source-search :max 1
644 :host server
645 :port port))
646 :secret))
647 (auth-passwd (if (functionp auth-passwd)
648 (funcall auth-passwd)
649 auth-passwd)))
644 (or 650 (or
645 (copy-sequence auth-passwd) 651 (copy-sequence auth-passwd)
646 ;; If we cache the passphrase and we have one. 652 ;; If we cache the passphrase and we have one.
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index 8584d4ddc92..5d0f3935884 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -297,6 +297,7 @@ shouldn't return t when it isn't."
297 (executable-find "pscp")) 297 (executable-find "pscp"))
298 (if (or (fboundp 'password-read) 298 (if (or (fboundp 'password-read)
299 (fboundp 'auth-source-user-or-password) 299 (fboundp 'auth-source-user-or-password)
300 (fboundp 'auth-source-search)
300 ;; Pageant is running. 301 ;; Pageant is running.
301 (tramp-compat-process-running-p "Pageant")) 302 (tramp-compat-process-running-p "Pageant"))
302 "pscp" 303 "pscp"
@@ -307,6 +308,7 @@ shouldn't return t when it isn't."
307 ((tramp-detect-ssh-controlmaster) "scpc") 308 ((tramp-detect-ssh-controlmaster) "scpc")
308 ((or (fboundp 'password-read) 309 ((or (fboundp 'password-read)
309 (fboundp 'auth-source-user-or-password) 310 (fboundp 'auth-source-user-or-password)
311 (fboundp 'auth-source-search)
310 ;; ssh-agent is running. 312 ;; ssh-agent is running.
311 (getenv "SSH_AUTH_SOCK") 313 (getenv "SSH_AUTH_SOCK")
312 (getenv "SSH_AGENT_PID")) 314 (getenv "SSH_AGENT_PID"))
@@ -3519,7 +3521,8 @@ Invokes `password-read' if available, `read-passwd' else."
3519 (or prompt 3521 (or prompt
3520 (with-current-buffer (process-buffer proc) 3522 (with-current-buffer (process-buffer proc)
3521 (tramp-check-for-regexp proc tramp-password-prompt-regexp) 3523 (tramp-check-for-regexp proc tramp-password-prompt-regexp)
3522 (format "%s for %s " (capitalize (match-string 1)) key))))) 3524 (format "%s for %s " (capitalize (match-string 1)) key))))
3525 auth-info auth-passwd)
3523 (with-parsed-tramp-file-name key nil 3526 (with-parsed-tramp-file-name key nil
3524 (prog1 3527 (prog1
3525 (or 3528 (or
@@ -3527,9 +3530,22 @@ Invokes `password-read' if available, `read-passwd' else."
3527 (and (boundp 'auth-sources) 3530 (and (boundp 'auth-sources)
3528 (tramp-get-connection-property v "first-password-request" nil) 3531 (tramp-get-connection-property v "first-password-request" nil)
3529 ;; Try with Tramp's current method. 3532 ;; Try with Tramp's current method.
3530 (tramp-compat-funcall 3533 (if (fboundp 'auth-source-search)
3531 'auth-source-user-or-password 3534 (progn
3532 "password" tramp-current-host tramp-current-method)) 3535 (setq auth-info
3536 (tramp-compat-funcall
3537 'auth-source-search
3538 :max 1
3539 :user (or tramp-current-user t)
3540 :host tramp-current-host
3541 :port tramp-current-method))
3542 (setq auth-passwd (plist-get (nth 0 auth-info) :secret))
3543 (setq auth-passwd (if (functionp auth-passwd)
3544 (funcall auth-passwd)
3545 auth-passwd)))
3546 (tramp-compat-funcall
3547 'auth-source-user-or-password
3548 "password" tramp-current-host tramp-current-method)))
3533 ;; Try the password cache. 3549 ;; Try the password cache.
3534 (when (functionp 'password-read) 3550 (when (functionp 'password-read)
3535 (unless (tramp-get-connection-property 3551 (unless (tramp-get-connection-property