From 53a32e6636f391212c662f2f3d4b671e96610b7a Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Mon, 25 Dec 2017 12:27:06 +0100 Subject: [PATCH] Fix Bug#29822 * lisp/net/tramp-sh.el (tramp-maybe-open-connection): Fix handling of restricted shells. (Bug#29822) --- lisp/net/tramp-sh.el | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index 96a0d849072..2eae8ff941e 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el @@ -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 -- 2.39.2