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/url/url-auth.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/url/url-auth.el')
-rw-r--r-- | lisp/url/url-auth.el | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/lisp/url/url-auth.el b/lisp/url/url-auth.el index 842e2a3be8d..5261302a15c 100644 --- a/lisp/url/url-auth.el +++ b/lisp/url/url-auth.el @@ -24,7 +24,7 @@ (require 'url-vars) (require 'url-parse) (autoload 'url-warn "url") -(autoload 'auth-source-user-or-password "auth-source") +(autoload 'auth-source-search "auth-source") (defsubst url-auth-user-prompt (url realm) "String to usefully prompt for a username." @@ -81,11 +81,11 @@ instead of the filename inheritance method." (cond ((and prompt (not byserv)) (setq user (or - (auth-source-user-or-password "login" server type) + (url-do-auth-source-search server type :user) (read-string (url-auth-user-prompt url realm) (or user (user-real-login-name)))) pass (or - (auth-source-user-or-password "password" server type) + (url-do-auth-source-search server type :secret) (read-passwd "Password: " nil (or pass "")))) (set url-basic-auth-storage (cons (list server @@ -110,11 +110,11 @@ instead of the filename inheritance method." (if (or (and (not retval) prompt) overwrite) (progn (setq user (or - (auth-source-user-or-password "login" server type) + (url-do-auth-source-search server type :user) (read-string (url-auth-user-prompt url realm) (user-real-login-name))) pass (or - (auth-source-user-or-password "password" server type) + (url-do-auth-source-search server type :secret) (read-passwd "Password: ")) retval (base64-encode-string (format "%s:%s" user pass)) byserv (assoc server (symbol-value url-basic-auth-storage))) @@ -173,11 +173,11 @@ instead of hostname:portnum." (cond ((and prompt (not byserv)) (setq user (or - (auth-source-user-or-password "login" server type) + (url-do-auth-source-search server type :user) (read-string (url-auth-user-prompt url realm) (user-real-login-name))) pass (or - (auth-source-user-or-password "password" server type) + (url-do-auth-source-search server type :secret) (read-passwd "Password: ")) url-digest-auth-storage (cons (list server @@ -204,11 +204,11 @@ instead of hostname:portnum." (if overwrite (if (and (not retval) prompt) (setq user (or - (auth-source-user-or-password "login" server type) + (url-do-auth-source-search server type :user) (read-string (url-auth-user-prompt url realm) (user-real-login-name))) pass (or - (auth-source-user-or-password "password" server type) + (url-do-auth-source-search server type :secret) (read-passwd "Password: ")) retval (setq retval (cons user @@ -244,6 +244,13 @@ instead of hostname:portnum." "A list of the registered authorization schemes and various and sundry information associated with them.") +(defun url-do-auth-source-search (server type parameter) + (let* ((auth-info (auth-source-search :max 1 :host server :port type)) + (auth-info (nth 0 auth-info)) + (token (plist-get auth-info parameter)) + (token (if (functionp token) (funcall token) token))) + token)) + ;;;###autoload (defun url-get-authentication (url realm type prompt &optional args) "Return an authorization string suitable for use in the WWW-Authenticate |