1 |
;;; tramp.el --- Transparent Remote Access, Multiple Protocol -*- coding: iso-8859-1; -*- |
;;; tramp.el --- Transparent Remote Access, Multiple Protocol -*- coding: iso-8859-1; -*- |
2 |
|
|
3 |
;; Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc. |
;; Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc. |
4 |
|
|
3836 |
(erase-buffer) |
(erase-buffer) |
3837 |
(tramp-process-actions p multi-method method user host |
(tramp-process-actions p multi-method method user host |
3838 |
tramp-actions-before-shell) |
tramp-actions-before-shell) |
|
|
|
|
;; (tramp-message 9 "Waiting for login prompt...") |
|
|
;; (unless (tramp-wait-for-regexp p nil tramp-login-prompt-regexp) |
|
|
;; (pop-to-buffer (buffer-name)) |
|
|
;; (kill-process p) |
|
|
;; (error "Couldn't find remote login prompt")) |
|
|
;; (erase-buffer) |
|
|
;; ;; Remote login defaults to local one. |
|
|
;; (tramp-message 9 "Sending login name %s" (or user (user-login-name))) |
|
|
;; (process-send-string p (concat (or user (user-login-name)) |
|
|
;; tramp-rsh-end-of-line)) |
|
|
;; (tramp-message 9 "Waiting for password prompt...") |
|
|
;; (unless (setq found (tramp-wait-for-regexp |
|
|
;; p nil tramp-password-prompt-regexp)) |
|
|
;; (pop-to-buffer (buffer-name)) |
|
|
;; (kill-process p) |
|
|
;; (error "Couldn't find remote password prompt")) |
|
|
;; (erase-buffer) |
|
|
;; (setq pw (tramp-read-passwd (car found))) |
|
|
;; (tramp-message 9 "Sending password") |
|
|
;; (process-send-string p (concat pw tramp-rsh-end-of-line)) |
|
|
;; (tramp-message 9 "Waiting 30s for remote shell to come up...") |
|
|
;; (unless (setq found |
|
|
;; (tramp-wait-for-regexp |
|
|
;; p 30 (format "\\(%s\\)\\|\\(%s\\)\\|\\(%s\\)\\'" |
|
|
;; tramp-wrong-passwd-regexp |
|
|
;; shell-prompt-pattern |
|
|
;; tramp-shell-prompt-pattern))) |
|
|
;; (pop-to-buffer (buffer-name)) |
|
|
;; (kill-process p) |
|
|
;; (error "Couldn't find remote shell prompt")) |
|
|
;; (when (nth 1 found) |
|
|
;; (pop-to-buffer (buffer-name)) |
|
|
;; (kill-process p) |
|
|
;; (error "Login failed: %s" (nth 1 found))) |
|
|
|
|
3839 |
(tramp-open-connection-setup-interactive-shell |
(tramp-open-connection-setup-interactive-shell |
3840 |
p multi-method method user host) |
p multi-method method user host) |
3841 |
(tramp-post-connection multi-method method user host))))) |
(tramp-post-connection multi-method method user host))))) |
3900 |
(set-buffer buf) |
(set-buffer buf) |
3901 |
(tramp-process-actions p multi-method method user host |
(tramp-process-actions p multi-method method user host |
3902 |
tramp-actions-before-shell) |
tramp-actions-before-shell) |
|
|
|
|
;; (tramp-message 9 "Waiting 60s for shell or passwd prompt from %s" host) |
|
|
;; (setq found |
|
|
;; (tramp-wait-for-regexp |
|
|
;; p 60 |
|
|
;; (format |
|
|
;; "\\(%s\\)\\|\\(%s\\)\\|\\(%s\\)\\'" |
|
|
;; tramp-password-prompt-regexp |
|
|
;; shell-prompt-pattern tramp-shell-prompt-pattern))) |
|
|
;; (unless found |
|
|
;; (pop-to-buffer (buffer-name)) |
|
|
;; (kill-process p) |
|
|
;; (error "Couldn't find remote shell or passwd prompt")) |
|
|
;; (when (nth 1 found) |
|
|
;; (when (tramp-method-out-of-band-p multi-method method) |
|
|
;; (pop-to-buffer (buffer-name)) |
|
|
;; (kill-process p) |
|
|
;; (error (concat "Out of band method `%s' not applicable" |
|
|
;; " for remote shell asking for a password") |
|
|
;; method)) |
|
|
;; (erase-buffer) |
|
|
;; (tramp-message 9 "Sending password...") |
|
|
;; (tramp-enter-password p (nth 1 found)) |
|
|
;; (tramp-message 9 "Sent password, waiting 60s for remote shell prompt") |
|
|
;; (setq found (tramp-wait-for-regexp |
|
|
;; p 60 |
|
|
;; (format "\\(%s\\)\\|\\(%s\\)\\|\\(%s\\)\\'" |
|
|
;; tramp-wrong-passwd-regexp |
|
|
;; shell-prompt-pattern |
|
|
;; tramp-shell-prompt-pattern)))) |
|
|
;; (unless found |
|
|
;; (pop-to-buffer (buffer-name)) |
|
|
;; (kill-process p) |
|
|
;; (error "Couldn't find remote shell prompt")) |
|
|
;; (when (nth 1 found) |
|
|
;; (pop-to-buffer (buffer-name)) |
|
|
;; (kill-process p) |
|
|
;; (error "Login failed: %s" (nth 1 found))) |
|
|
|
|
3903 |
(tramp-message 7 "Initializing remote shell") |
(tramp-message 7 "Initializing remote shell") |
3904 |
(tramp-open-connection-setup-interactive-shell |
(tramp-open-connection-setup-interactive-shell |
3905 |
p multi-method method user host) |
p multi-method method user host) |
3928 |
"Cannot connect to different host `%s' with `su' connection method" |
"Cannot connect to different host `%s' with `su' connection method" |
3929 |
host)) |
host)) |
3930 |
(when (not user) |
(when (not user) |
3931 |
(error "Must give user name for `su' connection method")) |
(setq user "root")) |
3932 |
(tramp-pre-connection multi-method method user host) |
(tramp-pre-connection multi-method method user host) |
3933 |
(tramp-message 7 "Opening connection for `%s' using `%s'..." |
(tramp-message 7 "Opening connection for `%s' using `%s'..." user method) |
|
(or user (user-login-name)) method) |
|
3934 |
(let ((process-environment (copy-sequence process-environment))) |
(let ((process-environment (copy-sequence process-environment))) |
3935 |
(setenv "TERM" tramp-terminal-type) |
(setenv "TERM" tramp-terminal-type) |
3936 |
(let* ((default-directory (tramp-temporary-file-directory)) |
(let* ((default-directory (tramp-temporary-file-directory)) |
3951 |
(set-buffer (tramp-get-buffer multi-method method user host)) |
(set-buffer (tramp-get-buffer multi-method method user host)) |
3952 |
(tramp-process-actions p multi-method method user host |
(tramp-process-actions p multi-method method user host |
3953 |
tramp-actions-before-shell) |
tramp-actions-before-shell) |
|
|
|
|
;; (tramp-message 9 "Waiting 30s for shell or password prompt...") |
|
|
;; (unless (setq found (tramp-wait-for-regexp |
|
|
;; p 30 |
|
|
;; (format "\\(%s\\)\\|\\(%s\\)\\|\\(%s\\)\\'" |
|
|
;; tramp-password-prompt-regexp |
|
|
;; shell-prompt-pattern |
|
|
;; tramp-shell-prompt-pattern))) |
|
|
;; (pop-to-buffer (buffer-name)) |
|
|
;; (kill-process p) |
|
|
;; (error "Couldn't find shell or password prompt")) |
|
|
;; (when (nth 1 found) |
|
|
;; (erase-buffer) |
|
|
;; (setq pw (tramp-read-passwd (car found))) |
|
|
;; (tramp-message 9 "Sending password") |
|
|
;; (process-send-string p (concat pw tramp-rsh-end-of-line)) |
|
|
;; (tramp-message 9 "Waiting 30s for remote shell to come up...") |
|
|
;; (unless (setq found |
|
|
;; (tramp-wait-for-regexp |
|
|
;; p 30 (format "\\(%s\\)\\|\\(%s\\)\\|\\(%s\\)\\'" |
|
|
;; tramp-wrong-passwd-regexp |
|
|
;; shell-prompt-pattern |
|
|
;; tramp-shell-prompt-pattern))) |
|
|
;; (pop-to-buffer (buffer-name)) |
|
|
;; (kill-process p) |
|
|
;; (error "Couldn't find remote shell prompt")) |
|
|
;; (when (nth 1 found) |
|
|
;; (pop-to-buffer (buffer-name)) |
|
|
;; (kill-process p) |
|
|
;; (error "`su' failed: %s" (nth 1 found)))) |
|
|
|
|
3954 |
(tramp-open-connection-setup-interactive-shell |
(tramp-open-connection-setup-interactive-shell |
3955 |
p multi-method method user host) |
p multi-method method user host) |
3956 |
(tramp-post-connection multi-method method |
(tramp-post-connection multi-method method |
4013 |
(entry (assoc m tramp-multi-connection-function-alist)) |
(entry (assoc m tramp-multi-connection-function-alist)) |
4014 |
(multi-func (nth 1 entry)) |
(multi-func (nth 1 entry)) |
4015 |
(command (nth 2 entry))) |
(command (nth 2 entry))) |
4016 |
;; The multi-funcs don't need to do save-match-data, as that |
;; The multi-funcs don't need to do save-match-data, as that |
4017 |
;; is done here. |
;; is done here. |
4018 |
(funcall multi-func p m u h command) |
(funcall multi-func p m u h command) |
4019 |
(erase-buffer) |
(erase-buffer) |
4043 |
(tramp-message 9 "Sending telnet command `%s'" cmd1) |
(tramp-message 9 "Sending telnet command `%s'" cmd1) |
4044 |
(process-send-string p cmd) |
(process-send-string p cmd) |
4045 |
(tramp-process-multi-actions p method user host |
(tramp-process-multi-actions p method user host |
4046 |
tramp-multi-actions) |
tramp-multi-actions))) |
|
|
|
|
;; (tramp-message 9 "Waiting 30s for login prompt from %s" host) |
|
|
;; (unless (tramp-wait-for-regexp p 30 tramp-login-prompt-regexp) |
|
|
;; (pop-to-buffer (buffer-name)) |
|
|
;; (kill-process p) |
|
|
;; (error "Couldn't find login prompt from host %s" host)) |
|
|
;; (erase-buffer) |
|
|
;; (tramp-message 9 "Sending login name %s" (or user (user-login-name))) |
|
|
;; (process-send-string p (concat (or user (user-login-name)) tramp-rsh-end-of-line)) |
|
|
;; (tramp-message 9 "Waiting for password prompt") |
|
|
;; (unless (setq found (tramp-wait-for-regexp p nil tramp-password-prompt-regexp)) |
|
|
;; (pop-to-buffer (buffer-name)) |
|
|
;; (kill-process p) |
|
|
;; (error "Couldn't find password prompt from host %s" host)) |
|
|
;; (erase-buffer) |
|
|
;; (setq pw (tramp-read-passwd |
|
|
;; (format "Password for %s@%s, %s" (or user (user-login-name)) host found))) |
|
|
;; (tramp-message 9 "Sending password") |
|
|
;; (process-send-string p (concat pw tramp-rsh-end-of-line)) |
|
|
;; (tramp-message 9 "Waiting 60s for remote shell to come up...") |
|
|
;; (unless (setq found (tramp-wait-for-regexp |
|
|
;; p 60 (format "\\(%s\\)\\|\\(%s\\)\\|\\(%s\\)\\'" |
|
|
;; tramp-wrong-passwd-regexp |
|
|
;; shell-prompt-pattern |
|
|
;; tramp-shell-prompt-pattern))) |
|
|
;; (pop-to-buffer (buffer-name)) |
|
|
;; (kill-process p) |
|
|
;; (error "Couldn't find shell prompt from host %s" host)) |
|
|
;; (when (nth 1 found) |
|
|
;; (pop-to-buffer (buffer-name)) |
|
|
;; (kill-process p) |
|
|
;; (error "Login to %s failed: %s" (nth 2 found))) |
|
|
)) |
|
4047 |
|
|
4048 |
;; HHH: Changed. Multi method. Don't know how to handle this in the case |
;; HHH: Changed. Multi method. Don't know how to handle this in the case |
4049 |
;; of no user name provided. Hack to make it work as it did before: |
;; of no user name provided. Hack to make it work as it did before: |
4069 |
(tramp-message 9 "Sending rlogin command `%s'" cmd1) |
(tramp-message 9 "Sending rlogin command `%s'" cmd1) |
4070 |
(process-send-string p cmd) |
(process-send-string p cmd) |
4071 |
(tramp-process-multi-actions p method user host |
(tramp-process-multi-actions p method user host |
4072 |
tramp-multi-actions) |
tramp-multi-actions))) |
|
;; (tramp-message 9 "Waiting 60s for shell or passwd prompt from %s" host) |
|
|
;; (unless (setq found |
|
|
;; (tramp-wait-for-regexp p 60 |
|
|
;; (format "\\(%s\\)\\|\\(%s\\)\\|\\(%s\\)\\'" |
|
|
;; tramp-password-prompt-regexp |
|
|
;; shell-prompt-pattern |
|
|
;; tramp-shell-prompt-pattern))) |
|
|
;; (pop-to-buffer (buffer-name)) |
|
|
;; (kill-process p) |
|
|
;; (error "Couldn't find remote shell or passwd prompt")) |
|
|
;; (when (nth 1 found) |
|
|
;; (erase-buffer) |
|
|
;; (tramp-message 9 "Sending password...") |
|
|
;; (tramp-enter-password p (nth 1 found)) |
|
|
;; (tramp-message 9 "Sent password, waiting 60s for remote shell prompt") |
|
|
;; (setq found (tramp-wait-for-regexp p 60 |
|
|
;; (format "\\(%s\\)\\|\\(%s\\)\\|\\(%s\\)\\'" |
|
|
;; tramp-wrong-passwd-regexp |
|
|
;; shell-prompt-pattern |
|
|
;; tramp-shell-prompt-pattern)))) |
|
|
;; (unless found |
|
|
;; (pop-to-buffer (buffer-name)) |
|
|
;; (kill-process p) |
|
|
;; (error "Couldn't find remote shell prompt")) |
|
|
;; (when (nth 1 found) |
|
|
;; (pop-to-buffer (buffer-name)) |
|
|
;; (kill-process p) |
|
|
;; (error "Login failed: %s" (nth 1 found))) |
|
|
)) |
|
4073 |
|
|
4074 |
;; HHH: Changed. Multi method. Don't know how to handle this in the case |
;; HHH: Changed. Multi method. Don't know how to handle this in the case |
4075 |
;; of no user name provided. Hack to make it work as it did before: |
;; of no user name provided. Hack to make it work as it did before: |
4096 |
(tramp-message 9 "Sending su command `%s'" cmd1) |
(tramp-message 9 "Sending su command `%s'" cmd1) |
4097 |
(process-send-string p cmd) |
(process-send-string p cmd) |
4098 |
(tramp-process-multi-actions p method user host |
(tramp-process-multi-actions p method user host |
4099 |
tramp-multi-actions) |
tramp-multi-actions))) |
|
;; (tramp-message 9 "Waiting 60s for shell or passwd prompt for %s" (or user (user-login-name))) |
|
|
;; (unless (setq found (tramp-wait-for-regexp |
|
|
;; p 60 (format "\\(%s\\)\\|\\(%s\\)\\|\\(%s\\)\\'" |
|
|
;; tramp-password-prompt-regexp |
|
|
;; shell-prompt-pattern |
|
|
;; tramp-shell-prompt-pattern))) |
|
|
;; (pop-to-buffer (buffer-name)) |
|
|
;; (kill-process p) |
|
|
;; (error "Couldn't find shell or passwd prompt for %s" |
|
|
;; (or user (user-login-name)))) |
|
|
;; (when (nth 1 found) |
|
|
;; (tramp-message 9 "Sending password...") |
|
|
;; (tramp-enter-password p (nth 1 found)) |
|
|
;; (erase-buffer) |
|
|
;; (tramp-message 9 "Sent password, waiting 60s for remote shell prompt") |
|
|
;; (setq found (tramp-wait-for-regexp p 60 |
|
|
;; (format "\\(%s\\)\\|\\(%s\\)\\|\\(%s\\)\\'" |
|
|
;; tramp-wrong-passwd-regexp |
|
|
;; shell-prompt-pattern |
|
|
;; tramp-shell-prompt-pattern)))) |
|
|
;; (unless found |
|
|
;; (pop-to-buffer (buffer-name)) |
|
|
;; (kill-process p) |
|
|
;; (error "Couldn't find remote shell prompt")) |
|
|
;; (when (nth 1 found) |
|
|
;; (pop-to-buffer (buffer-name)) |
|
|
;; (kill-process p) |
|
|
;; (error "Login failed: %s" (nth 1 found))) |
|
|
)) |
|
4100 |
|
|
4101 |
;; Utility functions. |
;; Utility functions. |
4102 |
|
|