diff options
| author | Paul Eggert | 2011-02-12 12:00:35 -0800 |
|---|---|---|
| committer | Paul Eggert | 2011-02-12 12:00:35 -0800 |
| commit | 583dab51b0c1962c10d5b8baf9da7af7921e8775 (patch) | |
| tree | 69e6178b399ecfaed2e3b757e2d68e96b7b0334d /lisp | |
| parent | 64640ce2d31c153698c501e9385e3d5397181de9 (diff) | |
| parent | 470d996db4b850a0c4676e03de805e53703b80e0 (diff) | |
| download | emacs-583dab51b0c1962c10d5b8baf9da7af7921e8775.tar.gz emacs-583dab51b0c1962c10d5b8baf9da7af7921e8775.zip | |
Merge from mainline.
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/ChangeLog | 29 | ||||
| -rw-r--r-- | lisp/files.el | 44 | ||||
| -rw-r--r-- | lisp/mail/smtpmail.el | 14 | ||||
| -rw-r--r-- | lisp/minibuffer.el | 4 | ||||
| -rw-r--r-- | lisp/net/imap-hash.el | 13 | ||||
| -rw-r--r-- | lisp/net/tramp-imap.el | 12 | ||||
| -rw-r--r-- | lisp/net/tramp.el | 24 | ||||
| -rw-r--r-- | lisp/url/ChangeLog | 10 | ||||
| -rw-r--r-- | lisp/url/url-auth.el | 25 | ||||
| -rw-r--r-- | lisp/url/url-parse.el | 17 |
10 files changed, 139 insertions, 53 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index e8308059963..e80de4e9175 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,32 @@ | |||
| 1 | 2011-02-12 Thierry Volpiatto <thierry.volpiatto@gmail.com> | ||
| 2 | |||
| 3 | * files.el (copy-directory): New argument COPY-CONTENTS for | ||
| 4 | copying directory contents into another existing directory. | ||
| 5 | |||
| 6 | 2011-02-12 Tassilo Horn <tassilo@member.fsf.org> | ||
| 7 | |||
| 8 | * minibuffer.el (completion-table-case-fold): New function for | ||
| 9 | creating a case-insensitive completion table. | ||
| 10 | |||
| 11 | 2011-02-12 Teodor Zlatanov <tzz@lifelogs.com> | ||
| 12 | |||
| 13 | * net/tramp.el (tramp-default-method): Also check if | ||
| 14 | `auth-source-search' is bound. | ||
| 15 | (tramp-read-passwd): Use `auth-source-search' instead of | ||
| 16 | `auto-source-user-or-password'. | ||
| 17 | |||
| 18 | * net/tramp-imap.el: Autoload `auto-source-search' instead of | ||
| 19 | `auto-source-user-or-password. | ||
| 20 | (tramp-imap-passphrase-callback-function): Use it. | ||
| 21 | |||
| 22 | * net/imap-hash.el: Autoload `auto-source-search' instead of | ||
| 23 | `auto-source-user-or-password. | ||
| 24 | (imap-hash-open-connection): Use it. | ||
| 25 | |||
| 26 | * mail/smtpmail.el: Autoload `auto-source-search' instead of | ||
| 27 | `auto-source-user-or-password. | ||
| 28 | (smtpmail-try-auth-methods): Use it. | ||
| 29 | |||
| 1 | 2011-02-12 Phil Hagelberg <phil@hagelb.org> | 30 | 2011-02-12 Phil Hagelberg <phil@hagelb.org> |
| 2 | 31 | ||
| 3 | * emacs-lisp/package.el: Allow packages to be reinstalled. | 32 | * emacs-lisp/package.el: Allow packages to be reinstalled. |
diff --git a/lisp/files.el b/lisp/files.el index 43b31cb0a7a..2d3dbc67d72 100644 --- a/lisp/files.el +++ b/lisp/files.el | |||
| @@ -4826,10 +4826,8 @@ given. With a prefix argument, TRASH is nil." | |||
| 4826 | directory 'full directory-files-no-dot-files-regexp))) | 4826 | directory 'full directory-files-no-dot-files-regexp))) |
| 4827 | (delete-directory-internal directory))))) | 4827 | (delete-directory-internal directory))))) |
| 4828 | 4828 | ||
| 4829 | (defun copy-directory (directory newname &optional keep-time parents) | 4829 | (defun copy-directory (directory newname &optional keep-time parents copy-contents) |
| 4830 | "Copy DIRECTORY to NEWNAME. Both args must be strings. | 4830 | "Copy DIRECTORY to NEWNAME. Both args must be strings. |
| 4831 | If NEWNAME names an existing directory, copy DIRECTORY as subdirectory there. | ||
| 4832 | |||
| 4833 | This function always sets the file modes of the output files to match | 4831 | This function always sets the file modes of the output files to match |
| 4834 | the corresponding input file. | 4832 | the corresponding input file. |
| 4835 | 4833 | ||
| @@ -4840,7 +4838,12 @@ A prefix arg makes KEEP-TIME non-nil. | |||
| 4840 | 4838 | ||
| 4841 | Noninteractively, the last argument PARENTS says whether to | 4839 | Noninteractively, the last argument PARENTS says whether to |
| 4842 | create parent directories if they don't exist. Interactively, | 4840 | create parent directories if they don't exist. Interactively, |
| 4843 | this happens by default." | 4841 | this happens by default. |
| 4842 | |||
| 4843 | If NEWNAME names an existing directory, copy DIRECTORY as a | ||
| 4844 | subdirectory there. However, if called from Lisp with a non-nil | ||
| 4845 | optional argument COPY-CONTENTS, copy the contents of DIRECTORY | ||
| 4846 | directly into NEWNAME instead." | ||
| 4844 | (interactive | 4847 | (interactive |
| 4845 | (let ((dir (read-directory-name | 4848 | (let ((dir (read-directory-name |
| 4846 | "Copy directory: " default-directory default-directory t nil))) | 4849 | "Copy directory: " default-directory default-directory t nil))) |
| @@ -4848,7 +4851,7 @@ this happens by default." | |||
| 4848 | (read-file-name | 4851 | (read-file-name |
| 4849 | (format "Copy directory %s to: " dir) | 4852 | (format "Copy directory %s to: " dir) |
| 4850 | default-directory default-directory nil nil) | 4853 | default-directory default-directory nil nil) |
| 4851 | current-prefix-arg t))) | 4854 | current-prefix-arg t nil))) |
| 4852 | ;; If default-directory is a remote directory, make sure we find its | 4855 | ;; If default-directory is a remote directory, make sure we find its |
| 4853 | ;; copy-directory handler. | 4856 | ;; copy-directory handler. |
| 4854 | (let ((handler (or (find-file-name-handler directory 'copy-directory) | 4857 | (let ((handler (or (find-file-name-handler directory 'copy-directory) |
| @@ -4860,21 +4863,22 @@ this happens by default." | |||
| 4860 | (setq directory (directory-file-name (expand-file-name directory)) | 4863 | (setq directory (directory-file-name (expand-file-name directory)) |
| 4861 | newname (directory-file-name (expand-file-name newname))) | 4864 | newname (directory-file-name (expand-file-name newname))) |
| 4862 | 4865 | ||
| 4863 | (if (not (file-directory-p newname)) | 4866 | (cond ((not (file-directory-p newname)) |
| 4864 | ;; If NEWNAME is not an existing directory, create it; that | 4867 | ;; If NEWNAME is not an existing directory, create it; |
| 4865 | ;; is where we will copy the files of DIRECTORY. | 4868 | ;; that is where we will copy the files of DIRECTORY. |
| 4866 | (make-directory newname parents) | 4869 | (make-directory newname parents)) |
| 4867 | ;; If NEWNAME is an existing directory, we will copy into | 4870 | ;; If NEWNAME is an existing directory and COPY-CONTENTS |
| 4868 | ;; NEWNAME/[DIRECTORY-BASENAME]. | 4871 | ;; is nil, copy into NEWNAME/[DIRECTORY-BASENAME]. |
| 4869 | (setq newname (expand-file-name | 4872 | ((not copy-contents) |
| 4870 | (file-name-nondirectory | 4873 | (setq newname (expand-file-name |
| 4871 | (directory-file-name directory)) | 4874 | (file-name-nondirectory |
| 4872 | newname)) | 4875 | (directory-file-name directory)) |
| 4873 | (and (file-exists-p newname) | 4876 | newname)) |
| 4874 | (not (file-directory-p newname)) | 4877 | (and (file-exists-p newname) |
| 4875 | (error "Cannot overwrite non-directory %s with a directory" | 4878 | (not (file-directory-p newname)) |
| 4876 | newname)) | 4879 | (error "Cannot overwrite non-directory %s with a directory" |
| 4877 | (make-directory newname t)) | 4880 | newname)) |
| 4881 | (make-directory newname t))) | ||
| 4878 | 4882 | ||
| 4879 | ;; Copy recursively. | 4883 | ;; Copy recursively. |
| 4880 | (dolist (file | 4884 | (dolist (file |
diff --git a/lisp/mail/smtpmail.el b/lisp/mail/smtpmail.el index f726304704b..427d9d17746 100644 --- a/lisp/mail/smtpmail.el +++ b/lisp/mail/smtpmail.el | |||
| @@ -77,7 +77,7 @@ | |||
| 77 | (autoload 'netrc-machine "netrc") | 77 | (autoload 'netrc-machine "netrc") |
| 78 | (autoload 'netrc-get "netrc") | 78 | (autoload 'netrc-get "netrc") |
| 79 | (autoload 'password-read "password-cache") | 79 | (autoload 'password-read "password-cache") |
| 80 | (autoload 'auth-source-user-or-password "auth-source") | 80 | (autoload 'auth-source-search "auth-source") |
| 81 | 81 | ||
| 82 | ;;; | 82 | ;;; |
| 83 | (defgroup smtpmail nil | 83 | (defgroup smtpmail nil |
| @@ -538,10 +538,14 @@ The list is in preference order.") | |||
| 538 | (defun smtpmail-try-auth-methods (process supported-extensions host port) | 538 | (defun smtpmail-try-auth-methods (process supported-extensions host port) |
| 539 | (let* ((mechs (cdr-safe (assoc 'auth supported-extensions))) | 539 | (let* ((mechs (cdr-safe (assoc 'auth supported-extensions))) |
| 540 | (mech (car (smtpmail-intersection mechs smtpmail-auth-supported))) | 540 | (mech (car (smtpmail-intersection mechs smtpmail-auth-supported))) |
| 541 | (auth-user (auth-source-user-or-password | 541 | (auth-info (auth-source-search :max 1 |
| 542 | "login" host (or port "smtp"))) | 542 | :host host |
| 543 | (auth-pass (auth-source-user-or-password | 543 | :port (or port "smtp"))) |
| 544 | "password" host (or port "smtp"))) | 544 | (auth-user (plist-get (nth 0 auth-info) :user)) |
| 545 | (auth-pass (plist-get (nth 0 auth-info) :secret)) | ||
| 546 | (auth-pass (if (functionp auth-pass) | ||
| 547 | (funcall auth-pass) | ||
| 548 | auth-pass)) | ||
| 545 | (cred (if (and auth-user auth-pass) ; try user-auth-* before netrc-* | 549 | (cred (if (and auth-user auth-pass) ; try user-auth-* before netrc-* |
| 546 | (list host port auth-user auth-pass) | 550 | (list host port auth-user auth-pass) |
| 547 | ;; else, if auth-source didn't return them... | 551 | ;; else, if auth-source didn't return them... |
diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el index 1b42ee1f2ce..3c8628c9cfa 100644 --- a/lisp/minibuffer.el +++ b/lisp/minibuffer.el | |||
| @@ -196,6 +196,10 @@ You should give VAR a non-nil `risky-local-variable' property." | |||
| 196 | (setq ,var (,fun))) | 196 | (setq ,var (,fun))) |
| 197 | ,var)))) | 197 | ,var)))) |
| 198 | 198 | ||
| 199 | (defun completion-table-case-fold (table string pred action) | ||
| 200 | (let ((completion-ignore-case t)) | ||
| 201 | (complete-with-action action table string pred))) | ||
| 202 | |||
| 199 | (defun completion-table-with-context (prefix table string pred action) | 203 | (defun completion-table-with-context (prefix table string pred action) |
| 200 | ;; TODO: add `suffix' maybe? | 204 | ;; TODO: add `suffix' maybe? |
| 201 | ;; Notice that `pred' may not be a function in some abusive cases. | 205 | ;; Notice that `pred' may not be a function in some abusive cases. |
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. | |||
| 639 | KEY-ID can be 'SYM or 'PIN among others." | 639 | KEY-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 |
diff --git a/lisp/url/ChangeLog b/lisp/url/ChangeLog index 742a3cfb9b5..3c7b8b6abe7 100644 --- a/lisp/url/ChangeLog +++ b/lisp/url/ChangeLog | |||
| @@ -1,3 +1,13 @@ | |||
| 1 | 2011-02-12 Teodor Zlatanov <tzz@lifelogs.com> | ||
| 2 | |||
| 3 | * url-parse.el (url-bit-for-url, url-user-for-url) | ||
| 4 | (url-password-for-url): Use `auto-source-search' instead of | ||
| 5 | `auto-source-user-or-password'. | ||
| 6 | |||
| 7 | * url-auth.el: Autoload `auto-source-search' instead of | ||
| 8 | `auto-source-user-or-password'. | ||
| 9 | (url-basic-auth, url-digest-auth, url-do-auth-source-search): Use it. | ||
| 10 | |||
| 1 | 2011-02-03 Lars Ingebrigtsen <larsi@gnus.org> | 11 | 2011-02-03 Lars Ingebrigtsen <larsi@gnus.org> |
| 2 | 12 | ||
| 3 | * url-http.el (url-http-wait-for-headers-change-function): Don't | 13 | * url-http.el (url-http-wait-for-headers-change-function): Don't |
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 @@ | |||
| 24 | (require 'url-vars) | 24 | (require 'url-vars) |
| 25 | (require 'url-parse) | 25 | (require 'url-parse) |
| 26 | (autoload 'url-warn "url") | 26 | (autoload 'url-warn "url") |
| 27 | (autoload 'auth-source-user-or-password "auth-source") | 27 | (autoload 'auth-source-search "auth-source") |
| 28 | 28 | ||
| 29 | (defsubst url-auth-user-prompt (url realm) | 29 | (defsubst url-auth-user-prompt (url realm) |
| 30 | "String to usefully prompt for a username." | 30 | "String to usefully prompt for a username." |
| @@ -81,11 +81,11 @@ instead of the filename inheritance method." | |||
| 81 | (cond | 81 | (cond |
| 82 | ((and prompt (not byserv)) | 82 | ((and prompt (not byserv)) |
| 83 | (setq user (or | 83 | (setq user (or |
| 84 | (auth-source-user-or-password "login" server type) | 84 | (url-do-auth-source-search server type :user) |
| 85 | (read-string (url-auth-user-prompt url realm) | 85 | (read-string (url-auth-user-prompt url realm) |
| 86 | (or user (user-real-login-name)))) | 86 | (or user (user-real-login-name)))) |
| 87 | pass (or | 87 | pass (or |
| 88 | (auth-source-user-or-password "password" server type) | 88 | (url-do-auth-source-search server type :secret) |
| 89 | (read-passwd "Password: " nil (or pass "")))) | 89 | (read-passwd "Password: " nil (or pass "")))) |
| 90 | (set url-basic-auth-storage | 90 | (set url-basic-auth-storage |
| 91 | (cons (list server | 91 | (cons (list server |
| @@ -110,11 +110,11 @@ instead of the filename inheritance method." | |||
| 110 | (if (or (and (not retval) prompt) overwrite) | 110 | (if (or (and (not retval) prompt) overwrite) |
| 111 | (progn | 111 | (progn |
| 112 | (setq user (or | 112 | (setq user (or |
| 113 | (auth-source-user-or-password "login" server type) | 113 | (url-do-auth-source-search server type :user) |
| 114 | (read-string (url-auth-user-prompt url realm) | 114 | (read-string (url-auth-user-prompt url realm) |
| 115 | (user-real-login-name))) | 115 | (user-real-login-name))) |
| 116 | pass (or | 116 | pass (or |
| 117 | (auth-source-user-or-password "password" server type) | 117 | (url-do-auth-source-search server type :secret) |
| 118 | (read-passwd "Password: ")) | 118 | (read-passwd "Password: ")) |
| 119 | retval (base64-encode-string (format "%s:%s" user pass)) | 119 | retval (base64-encode-string (format "%s:%s" user pass)) |
| 120 | byserv (assoc server (symbol-value url-basic-auth-storage))) | 120 | byserv (assoc server (symbol-value url-basic-auth-storage))) |
| @@ -173,11 +173,11 @@ instead of hostname:portnum." | |||
| 173 | (cond | 173 | (cond |
| 174 | ((and prompt (not byserv)) | 174 | ((and prompt (not byserv)) |
| 175 | (setq user (or | 175 | (setq user (or |
| 176 | (auth-source-user-or-password "login" server type) | 176 | (url-do-auth-source-search server type :user) |
| 177 | (read-string (url-auth-user-prompt url realm) | 177 | (read-string (url-auth-user-prompt url realm) |
| 178 | (user-real-login-name))) | 178 | (user-real-login-name))) |
| 179 | pass (or | 179 | pass (or |
| 180 | (auth-source-user-or-password "password" server type) | 180 | (url-do-auth-source-search server type :secret) |
| 181 | (read-passwd "Password: ")) | 181 | (read-passwd "Password: ")) |
| 182 | url-digest-auth-storage | 182 | url-digest-auth-storage |
| 183 | (cons (list server | 183 | (cons (list server |
| @@ -204,11 +204,11 @@ instead of hostname:portnum." | |||
| 204 | (if overwrite | 204 | (if overwrite |
| 205 | (if (and (not retval) prompt) | 205 | (if (and (not retval) prompt) |
| 206 | (setq user (or | 206 | (setq user (or |
| 207 | (auth-source-user-or-password "login" server type) | 207 | (url-do-auth-source-search server type :user) |
| 208 | (read-string (url-auth-user-prompt url realm) | 208 | (read-string (url-auth-user-prompt url realm) |
| 209 | (user-real-login-name))) | 209 | (user-real-login-name))) |
| 210 | pass (or | 210 | pass (or |
| 211 | (auth-source-user-or-password "password" server type) | 211 | (url-do-auth-source-search server type :secret) |
| 212 | (read-passwd "Password: ")) | 212 | (read-passwd "Password: ")) |
| 213 | retval (setq retval | 213 | retval (setq retval |
| 214 | (cons user | 214 | (cons user |
| @@ -244,6 +244,13 @@ instead of hostname:portnum." | |||
| 244 | "A list of the registered authorization schemes and various and sundry | 244 | "A list of the registered authorization schemes and various and sundry |
| 245 | information associated with them.") | 245 | information associated with them.") |
| 246 | 246 | ||
| 247 | (defun url-do-auth-source-search (server type parameter) | ||
| 248 | (let* ((auth-info (auth-source-search :max 1 :host server :port type)) | ||
| 249 | (auth-info (nth 0 auth-info)) | ||
| 250 | (token (plist-get auth-info parameter)) | ||
| 251 | (token (if (functionp token) (funcall token) token))) | ||
| 252 | token)) | ||
| 253 | |||
| 247 | ;;;###autoload | 254 | ;;;###autoload |
| 248 | (defun url-get-authentication (url realm type prompt &optional args) | 255 | (defun url-get-authentication (url realm type prompt &optional args) |
| 249 | "Return an authorization string suitable for use in the WWW-Authenticate | 256 | "Return an authorization string suitable for use in the WWW-Authenticate |
diff --git a/lisp/url/url-parse.el b/lisp/url/url-parse.el index 950f666e9c7..71c03bf1edd 100644 --- a/lisp/url/url-parse.el +++ b/lisp/url/url-parse.el | |||
| @@ -178,20 +178,25 @@ TYPE USER PASSWORD HOST PORTSPEC FILENAME TARGET ATTRIBUTES FULLNESS." | |||
| 178 | `(let* ((urlobj (url-generic-parse-url url)) | 178 | `(let* ((urlobj (url-generic-parse-url url)) |
| 179 | (bit (funcall ,method urlobj)) | 179 | (bit (funcall ,method urlobj)) |
| 180 | (methods (list 'url-recreate-url | 180 | (methods (list 'url-recreate-url |
| 181 | 'url-host))) | 181 | 'url-host)) |
| 182 | auth-info) | ||
| 182 | (while (and (not bit) (> (length methods) 0)) | 183 | (while (and (not bit) (> (length methods) 0)) |
| 183 | (setq bit | 184 | (setq auth-info (auth-source-search |
| 184 | (auth-source-user-or-password | 185 | :max 1 |
| 185 | ,lookfor (funcall (pop methods) urlobj) (url-type urlobj)))) | 186 | :host (funcall (pop methods) urlobj) |
| 187 | :port (url-type urlobj))) | ||
| 188 | (setq bit (plist-get (nth 0 auth-info) ,lookfor)) | ||
| 189 | (when (functionp bit) | ||
| 190 | (setq bit (funcall bit)))) | ||
| 186 | bit)) | 191 | bit)) |
| 187 | 192 | ||
| 188 | (defun url-user-for-url (url) | 193 | (defun url-user-for-url (url) |
| 189 | "Attempt to use .authinfo to find a user for this URL." | 194 | "Attempt to use .authinfo to find a user for this URL." |
| 190 | (url-bit-for-url 'url-user "login" url)) | 195 | (url-bit-for-url 'url-user :user url)) |
| 191 | 196 | ||
| 192 | (defun url-password-for-url (url) | 197 | (defun url-password-for-url (url) |
| 193 | "Attempt to use .authinfo to find a password for this URL." | 198 | "Attempt to use .authinfo to find a password for this URL." |
| 194 | (url-bit-for-url 'url-password "password" url)) | 199 | (url-bit-for-url 'url-password :secret url)) |
| 195 | 200 | ||
| 196 | (provide 'url-parse) | 201 | (provide 'url-parse) |
| 197 | 202 | ||