aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Albinus2012-07-06 15:16:13 +0200
committerMichael Albinus2012-07-06 15:16:13 +0200
commit07b151f1bc4290377085aa41564a918b718def9f (patch)
tree72a1ca80c4a9d9f0638302a7f56a9d36e8ab24d8
parent3181e279107e1fc1677af0731c4247681d766ec5 (diff)
downloademacs-07b151f1bc4290377085aa41564a918b718def9f.tar.gz
emacs-07b151f1bc4290377085aa41564a918b718def9f.zip
* net/tramp.el (tramp-restricted-shell-hosts-alist): New defcustom.
* net/tramp-sh.el (tramp-maybe-open-connection): Handle it.
-rw-r--r--lisp/ChangeLog6
-rw-r--r--lisp/net/tramp-sh.el19
-rw-r--r--lisp/net/tramp.el12
3 files changed, 31 insertions, 6 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index c177f1540af..cf95fd39e2a 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,9 @@
12012-07-06 Michael Albinus <michael.albinus@gmx.de>
2
3 * net/tramp.el (tramp-restricted-shell-hosts-alist): New defcustom.
4
5 * net/tramp-sh.el (tramp-maybe-open-connection): Handle it.
6
12012-07-06 Glenn Morris <rgm@gnu.org> 72012-07-06 Glenn Morris <rgm@gnu.org>
2 8
3 * Makefile.in (compile-one-process): Rename from "recompile". 9 * Makefile.in (compile-one-process): Rename from "recompile".
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el
index 6716ef52148..afb25509e4f 100644
--- a/lisp/net/tramp-sh.el
+++ b/lisp/net/tramp-sh.el
@@ -4340,7 +4340,8 @@ connection if a previous connection has died for some reason."
4340 (set-process-sentinel p 'tramp-process-sentinel) 4340 (set-process-sentinel p 'tramp-process-sentinel)
4341 (tramp-compat-set-process-query-on-exit-flag p nil) 4341 (tramp-compat-set-process-query-on-exit-flag p nil)
4342 (setq tramp-current-connection 4342 (setq tramp-current-connection
4343 (cons (butlast (append vec nil)) (current-time))) 4343 (cons (butlast (append vec nil)) (current-time))
4344 tramp-current-host (system-name))
4344 4345
4345 (tramp-message 4346 (tramp-message
4346 vec 6 "%s" (mapconcat 'identity (process-command p) " ")) 4347 vec 6 "%s" (mapconcat 'identity (process-command p) " "))
@@ -4387,7 +4388,7 @@ connection if a previous connection has died for some reason."
4387 (expand-file-name 4388 (expand-file-name
4388 tramp-temp-name-prefix 4389 tramp-temp-name-prefix
4389 (tramp-compat-temporary-file-directory))))) 4390 (tramp-compat-temporary-file-directory)))))
4390 spec) 4391 spec r-shell)
4391 4392
4392 ;; Add arguments for asynchronous processes. 4393 ;; Add arguments for asynchronous processes.
4393 (when (and process-name async-args) 4394 (when (and process-name async-args)
@@ -4403,6 +4404,11 @@ connection if a previous connection has died for some reason."
4403 (setq l-port (match-string 2 l-host) 4404 (setq l-port (match-string 2 l-host)
4404 l-host (match-string 1 l-host))) 4405 l-host (match-string 1 l-host)))
4405 4406
4407 ;; Check, whether there is a restricted shell.
4408 (dolist (elt tramp-restricted-shell-hosts-alist)
4409 (when (string-match elt tramp-current-host)
4410 (setq r-shell t)))
4411
4406 ;; Set variables for computing the prompt for 4412 ;; Set variables for computing the prompt for
4407 ;; reading password. They can also be derived 4413 ;; reading password. They can also be derived
4408 ;; from a gateway. 4414 ;; from a gateway.
@@ -4421,7 +4427,7 @@ connection if a previous connection has died for some reason."
4421 (concat 4427 (concat
4422 ;; We do not want to see the trailing local 4428 ;; We do not want to see the trailing local
4423 ;; prompt in `start-file-process'. 4429 ;; prompt in `start-file-process'.
4424 (unless (memq system-type '(windows-nt)) "exec ") 4430 (unless r-shell "exec ")
4425 command " " 4431 command " "
4426 (mapconcat 4432 (mapconcat
4427 (lambda (x) 4433 (lambda (x)
@@ -4430,9 +4436,10 @@ connection if a previous connection has died for some reason."
4430 login-args " ") 4436 login-args " ")
4431 ;; Local shell could be a Windows COMSPEC. It 4437 ;; Local shell could be a Windows COMSPEC. It
4432 ;; doesn't know the ";" syntax, but we must exit 4438 ;; doesn't know the ";" syntax, but we must exit
4433 ;; always for `start-file-process'. "exec" does 4439 ;; always for `start-file-process'. It could
4434 ;; not work either. 4440 ;; also be a restricted shell, which does not
4435 (if (memq system-type '(windows-nt)) " && exit || exit"))) 4441 ;; allow "exec".
4442 (when r-shell " && exit || exit")))
4436 4443
4437 ;; Send the command. 4444 ;; Send the command.
4438 (tramp-message vec 3 "Sending command `%s'" command) 4445 (tramp-message vec 3 "Sending command `%s'" command)
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index 5e70bab24e9..58506ce82f7 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -405,6 +405,18 @@ interpreted as a regular expression which always matches."
405 :group 'tramp 405 :group 'tramp
406 :type 'boolean) 406 :type 'boolean)
407 407
408(defcustom tramp-restricted-shell-hosts-alist
409 (when (memq system-type '(windows-nt))
410 (list (concat "\\`" (regexp-quote (system-name)) "\\'")))
411 "List of hosts, which run a restricted shell.
412This is a list of regular expressions, which denote hosts running
413a registered shell like \"rbash\". Those hosts can be used as
414proxies only, see `tramp-default-proxies-alist'. If the local
415host runs a registered shell, it shall be added to this list, too."
416 :version "24.2"
417 :group 'tramp
418 :type '(repeat (regexp :tag "Host regexp")))
419
408;;;###tramp-autoload 420;;;###tramp-autoload
409(defconst tramp-local-host-regexp 421(defconst tramp-local-host-regexp
410 (concat 422 (concat