]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix Bug#29822
authorMichael Albinus <michael.albinus@gmx.de>
Mon, 25 Dec 2017 11:27:06 +0000 (12:27 +0100)
committerMichael Albinus <michael.albinus@gmx.de>
Mon, 25 Dec 2017 11:27:06 +0000 (12:27 +0100)
* lisp/net/tramp-sh.el (tramp-maybe-open-connection):
Fix handling of restricted shells.  (Bug#29822)

lisp/net/tramp-sh.el

index 96a0d8490721107ae7a45a729717a812c0db59cf..2eae8ff941ee193b770937c082433dc326a7dda0 100644 (file)
@@ -4738,14 +4738,16 @@ connection if a previous connection has died for some reason."
                           (if tramp-encoding-command-interactive
                               (list tramp-encoding-shell
                                     tramp-encoding-command-interactive)
-                            (list tramp-encoding-shell))))))
+                            (list tramp-encoding-shell)))))
+                    current-host)
 
-               ;; Set sentinel and query flag.
+               ;; Set sentinel and query flag.  Initialize variables.
                (tramp-set-connection-property p "vector" vec)
                (set-process-sentinel p 'tramp-process-sentinel)
                (process-put p 'adjust-window-size-function 'ignore)
                (set-process-query-on-exit-flag p nil)
-               (setq tramp-current-connection (cons vec (current-time)))
+               (setq tramp-current-connection (cons vec (current-time))
+                     current-host (system-name))
 
                (tramp-message
                 vec 6 "%s" (mapconcat 'identity (process-command p) " "))
@@ -4799,8 +4801,9 @@ connection if a previous connection has died for some reason."
 
                    ;; Check, whether there is a restricted shell.
                    (dolist (elt tramp-restricted-shell-hosts-alist)
-                     (when (string-match elt l-host)
+                     (when (string-match elt current-host)
                        (setq r-shell t)))
+                   (setq current-host l-host)
 
                    ;; Set password prompt vector.
                    (tramp-set-connection-property