diff options
author | Ted Zlatanov <tzz@lifelogs.com> | 2011-02-12 11:51:02 -0600 |
---|---|---|
committer | Ted Zlatanov <tzz@lifelogs.com> | 2011-02-12 11:51:02 -0600 |
commit | 563790b6db1fed5d81809ca826e19685b78461f4 (patch) | |
tree | 0115ee56f0b0046fca7b41b293c192ac06df3dc6 /lisp/net/tramp.el | |
parent | 50fd938f33c9c5e91a407595ad9609379e46d11a (diff) | |
download | emacs-563790b6db1fed5d81809ca826e19685b78461f4.tar.gz |
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/tramp.el')
-rw-r--r-- | lisp/net/tramp.el | 24 |
1 files changed, 20 insertions, 4 deletions
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." (executable-find "pscp")) (if (or (fboundp 'password-read) (fboundp 'auth-source-user-or-password) + (fboundp 'auth-source-search) ;; Pageant is running. (tramp-compat-process-running-p "Pageant")) "pscp" @@ -307,6 +308,7 @@ shouldn't return t when it isn't." ((tramp-detect-ssh-controlmaster) "scpc") ((or (fboundp 'password-read) (fboundp 'auth-source-user-or-password) + (fboundp 'auth-source-search) ;; ssh-agent is running. (getenv "SSH_AUTH_SOCK") (getenv "SSH_AGENT_PID")) @@ -3519,7 +3521,8 @@ Invokes `password-read' if available, `read-passwd' else." (or prompt (with-current-buffer (process-buffer proc) (tramp-check-for-regexp proc tramp-password-prompt-regexp) - (format "%s for %s " (capitalize (match-string 1)) key))))) + (format "%s for %s " (capitalize (match-string 1)) key)))) + auth-info auth-passwd) (with-parsed-tramp-file-name key nil (prog1 (or @@ -3527,9 +3530,22 @@ Invokes `password-read' if available, `read-passwd' else." (and (boundp 'auth-sources) (tramp-get-connection-property v "first-password-request" nil) ;; Try with Tramp's current method. - (tramp-compat-funcall - 'auth-source-user-or-password - "password" tramp-current-host tramp-current-method)) + (if (fboundp 'auth-source-search) + (progn + (setq auth-info + (tramp-compat-funcall + 'auth-source-search + :max 1 + :user (or tramp-current-user t) + :host tramp-current-host + :port tramp-current-method)) + (setq auth-passwd (plist-get (nth 0 auth-info) :secret)) + (setq auth-passwd (if (functionp auth-passwd) + (funcall auth-passwd) + auth-passwd))) + (tramp-compat-funcall + 'auth-source-user-or-password + "password" tramp-current-host tramp-current-method))) ;; Try the password cache. (when (functionp 'password-read) (unless (tramp-get-connection-property |