aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorThierry Volpiatto2014-03-23 10:22:16 +0100
committerMichael Albinus2014-03-23 10:22:16 +0100
commitf1e06f7bffc1407f7e597f714b2969fc6d1d8eed (patch)
treebcdcbe01f179d85d917d5f87cd95f0448918b2f2 /lisp
parent2614c1af39e9a9746133a7e04e19f378ad593909 (diff)
downloademacs-f1e06f7bffc1407f7e597f714b2969fc6d1d8eed.tar.gz
emacs-f1e06f7bffc1407f7e597f714b2969fc6d1d8eed.zip
* net/tramp.el (tramp-read-passwd): Suspend the timers while reading
the password.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ChangeLog5
-rw-r--r--lisp/net/tramp.el76
2 files changed, 47 insertions, 34 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index feb78f59fc7..f00bef537f6 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,8 @@
12014-03-23 Thierry Volpiatto <thierry.volpiatto@gmail.com>
2
3 * net/tramp.el (tramp-read-passwd): Suspend the timers while reading
4 the password.
5
12014-03-23 Dmitry Gutov <dgutov@yandex.ru> 62014-03-23 Dmitry Gutov <dgutov@yandex.ru>
2 7
3 * emacs-lisp/package.el (package-show-package-list): If the buffer 8 * emacs-lisp/package.el (package-show-package-list): If the buffer
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index b9b64ed70f8..5f448ecdbbd 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -4119,40 +4119,48 @@ Invokes `password-read' if available, `read-passwd' else."
4119 (with-current-buffer (process-buffer proc) 4119 (with-current-buffer (process-buffer proc)
4120 (tramp-check-for-regexp proc tramp-password-prompt-regexp) 4120 (tramp-check-for-regexp proc tramp-password-prompt-regexp)
4121 (format "%s for %s " (capitalize (match-string 1)) key)))) 4121 (format "%s for %s " (capitalize (match-string 1)) key))))
4122 auth-info auth-passwd) 4122 ;; We suspend the timers while reading the password.
4123 (with-parsed-tramp-file-name key nil 4123 (stimers (with-timeout-suspend))
4124 (prog1 4124 auth-info auth-passwd)
4125 (or 4125
4126 ;; See if auth-sources contains something useful, if it's 4126 (unwind-protect
4127 ;; bound. `auth-source-user-or-password' is an obsoleted 4127 (with-parsed-tramp-file-name key nil
4128 ;; function, it has been replaced by `auth-source-search'. 4128 (prog1
4129 (and (boundp 'auth-sources) 4129 (or
4130 (tramp-get-connection-property v "first-password-request" nil) 4130 ;; See if auth-sources contains something useful, if
4131 ;; Try with Tramp's current method. 4131 ;; it's bound. `auth-source-user-or-password' is an
4132 (if (fboundp 'auth-source-search) 4132 ;; obsoleted function, it has been replaced by
4133 (setq auth-info 4133 ;; `auth-source-search'.
4134 (tramp-compat-funcall 4134 (and (boundp 'auth-sources)
4135 'auth-source-search 4135 (tramp-get-connection-property
4136 :max 1 4136 v "first-password-request" nil)
4137 :user (or tramp-current-user t) 4137 ;; Try with Tramp's current method.
4138 :host tramp-current-host 4138 (if (fboundp 'auth-source-search)
4139 :port tramp-current-method) 4139 (setq auth-info
4140 auth-passwd (plist-get (nth 0 auth-info) :secret) 4140 (tramp-compat-funcall
4141 auth-passwd (if (functionp auth-passwd) 4141 'auth-source-search
4142 (funcall auth-passwd) 4142 :max 1
4143 auth-passwd)) 4143 :user (or tramp-current-user t)
4144 (tramp-compat-funcall 4144 :host tramp-current-host
4145 'auth-source-user-or-password 4145 :port tramp-current-method)
4146 "password" tramp-current-host tramp-current-method))) 4146 auth-passwd (plist-get (nth 0 auth-info) :secret)
4147 ;; Try the password cache. 4147 auth-passwd (if (functionp auth-passwd)
4148 (when (functionp 'password-read) 4148 (funcall auth-passwd)
4149 (let ((password 4149 auth-passwd))
4150 (tramp-compat-funcall 'password-read pw-prompt key))) 4150 (tramp-compat-funcall
4151 (tramp-compat-funcall 'password-cache-add key password) 4151 'auth-source-user-or-password
4152 password)) 4152 "password" tramp-current-host tramp-current-method)))
4153 ;; Else, get the password interactively. 4153 ;; Try the password cache.
4154 (read-passwd pw-prompt)) 4154 (when (functionp 'password-read)
4155 (tramp-set-connection-property v "first-password-request" nil))))) 4155 (let ((password
4156 (tramp-compat-funcall 'password-read pw-prompt key)))
4157 (tramp-compat-funcall 'password-cache-add key password)
4158 password))
4159 ;; Else, get the password interactively.
4160 (read-passwd pw-prompt))
4161 (tramp-set-connection-property v "first-password-request" nil)))
4162 ;; Reenable the timers.
4163 (with-timeout-unsuspend stimers))))
4156 4164
4157;;;###tramp-autoload 4165;;;###tramp-autoload
4158(defun tramp-clear-passwd (vec) 4166(defun tramp-clear-passwd (vec)