emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] emacs-24 r116841: * net/tramp.el (tramp-read-passwd): Susp


From: Michael Albinus
Subject: [Emacs-diffs] emacs-24 r116841: * net/tramp.el (tramp-read-passwd): Suspend the timers while reading
Date: Sun, 23 Mar 2014 09:22:24 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 116841
revision-id: address@hidden
parent: address@hidden
author: Thierry Volpiatto <address@hidden>
committer: Michael Albinus <address@hidden>
branch nick: emacs-24
timestamp: Sun 2014-03-23 10:22:16 +0100
message:
  * net/tramp.el (tramp-read-passwd): Suspend the timers while reading
  the password.
modified:
  lisp/ChangeLog                 changelog-20091113204419-o5vbwnq5f7feedwu-1432
  lisp/net/tramp.el              tramp.el-20091113204419-o5vbwnq5f7feedwu-2427
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2014-03-23 08:35:56 +0000
+++ b/lisp/ChangeLog    2014-03-23 09:22:16 +0000
@@ -1,3 +1,8 @@
+2014-03-23  Thierry Volpiatto  <address@hidden>
+
+       * net/tramp.el (tramp-read-passwd): Suspend the timers while reading
+       the password.
+
 2014-03-23  Dmitry Gutov  <address@hidden>
 
        * emacs-lisp/package.el (package-show-package-list): If the buffer

=== modified file 'lisp/net/tramp.el'
--- a/lisp/net/tramp.el 2014-03-21 13:02:25 +0000
+++ b/lisp/net/tramp.el 2014-03-23 09:22:16 +0000
@@ -4119,40 +4119,48 @@
              (with-current-buffer (process-buffer proc)
                (tramp-check-for-regexp proc tramp-password-prompt-regexp)
                (format "%s for %s " (capitalize (match-string 1)) key))))
-         auth-info auth-passwd)
-    (with-parsed-tramp-file-name key nil
-      (prog1
-         (or
-          ;; See if auth-sources contains something useful, if it's
-          ;; bound.  `auth-source-user-or-password' is an obsoleted
-          ;; function, it has been replaced by `auth-source-search'.
-          (and (boundp 'auth-sources)
-               (tramp-get-connection-property v "first-password-request" nil)
-               ;; Try with Tramp's current method.
-                (if (fboundp 'auth-source-search)
-                   (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)
-                         auth-passwd (plist-get (nth 0 auth-info) :secret)
-                         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)
-            (let ((password
-                   (tramp-compat-funcall 'password-read pw-prompt key)))
-              (tramp-compat-funcall 'password-cache-add key password)
-              password))
-          ;; Else, get the password interactively.
-          (read-passwd pw-prompt))
-       (tramp-set-connection-property v "first-password-request" nil)))))
+        ;; We suspend the timers while reading the password.
+         (stimers (with-timeout-suspend))
+        auth-info auth-passwd)
+
+    (unwind-protect
+       (with-parsed-tramp-file-name key nil
+         (prog1
+             (or
+              ;; See if auth-sources contains something useful, if
+              ;; it's bound.  `auth-source-user-or-password' is an
+              ;; obsoleted function, it has been replaced by
+              ;; `auth-source-search'.
+              (and (boundp 'auth-sources)
+                   (tramp-get-connection-property
+                    v "first-password-request" nil)
+                   ;; Try with Tramp's current method.
+                   (if (fboundp 'auth-source-search)
+                       (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)
+                             auth-passwd (plist-get (nth 0 auth-info) :secret)
+                             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)
+                (let ((password
+                       (tramp-compat-funcall 'password-read pw-prompt key)))
+                  (tramp-compat-funcall 'password-cache-add key password)
+                  password))
+              ;; Else, get the password interactively.
+              (read-passwd pw-prompt))
+           (tramp-set-connection-property v "first-password-request" nil)))
+      ;; Reenable the timers.
+      (with-timeout-unsuspend stimers))))
 
 ;;;###tramp-autoload
 (defun tramp-clear-passwd (vec)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]