summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
Diffstat (limited to 'lisp')
-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 @@
+2012-07-06 Michael Albinus <michael.albinus@gmx.de>
+
+ * net/tramp.el (tramp-restricted-shell-hosts-alist): New defcustom.
+
+ * net/tramp-sh.el (tramp-maybe-open-connection): Handle it.
+
2012-07-06 Glenn Morris <rgm@gnu.org>
* 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."
(set-process-sentinel p 'tramp-process-sentinel)
(tramp-compat-set-process-query-on-exit-flag p nil)
(setq tramp-current-connection
- (cons (butlast (append vec nil)) (current-time)))
+ (cons (butlast (append vec nil)) (current-time))
+ tramp-current-host (system-name))
(tramp-message
vec 6 "%s" (mapconcat 'identity (process-command p) " "))
@@ -4387,7 +4388,7 @@ connection if a previous connection has died for some reason."
(expand-file-name
tramp-temp-name-prefix
(tramp-compat-temporary-file-directory)))))
- spec)
+ spec r-shell)
;; Add arguments for asynchronous processes.
(when (and process-name async-args)
@@ -4403,6 +4404,11 @@ connection if a previous connection has died for some reason."
(setq l-port (match-string 2 l-host)
l-host (match-string 1 l-host)))
+ ;; Check, whether there is a restricted shell.
+ (dolist (elt tramp-restricted-shell-hosts-alist)
+ (when (string-match elt tramp-current-host)
+ (setq r-shell t)))
+
;; Set variables for computing the prompt for
;; reading password. They can also be derived
;; from a gateway.
@@ -4421,7 +4427,7 @@ connection if a previous connection has died for some reason."
(concat
;; We do not want to see the trailing local
;; prompt in `start-file-process'.
- (unless (memq system-type '(windows-nt)) "exec ")
+ (unless r-shell "exec ")
command " "
(mapconcat
(lambda (x)
@@ -4430,9 +4436,10 @@ connection if a previous connection has died for some reason."
login-args " ")
;; Local shell could be a Windows COMSPEC. It
;; doesn't know the ";" syntax, but we must exit
- ;; always for `start-file-process'. "exec" does
- ;; not work either.
- (if (memq system-type '(windows-nt)) " && exit || exit")))
+ ;; always for `start-file-process'. It could
+ ;; also be a restricted shell, which does not
+ ;; allow "exec".
+ (when r-shell " && exit || exit")))
;; Send the command.
(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."
:group 'tramp
:type 'boolean)
+(defcustom tramp-restricted-shell-hosts-alist
+ (when (memq system-type '(windows-nt))
+ (list (concat "\\`" (regexp-quote (system-name)) "\\'")))
+ "List of hosts, which run a restricted shell.
+This is a list of regular expressions, which denote hosts running
+a registered shell like \"rbash\". Those hosts can be used as
+proxies only, see `tramp-default-proxies-alist'. If the local
+host runs a registered shell, it shall be added to this list, too."
+ :version "24.2"
+ :group 'tramp
+ :type '(repeat (regexp :tag "Host regexp")))
+
;;;###tramp-autoload
(defconst tramp-local-host-regexp
(concat