188 |
|
|
189 |
(defcustom tramp-methods |
(defcustom tramp-methods |
190 |
'( ("rcp" (tramp-connection-function tramp-open-connection-rsh) |
'( ("rcp" (tramp-connection-function tramp-open-connection-rsh) |
|
(tramp-completion-function tramp-get-completion-rsh) |
|
191 |
(tramp-rsh-program "rsh") |
(tramp-rsh-program "rsh") |
192 |
(tramp-rcp-program "rcp") |
(tramp-rcp-program "rcp") |
193 |
(tramp-remote-sh "/bin/sh") |
(tramp-remote-sh "/bin/sh") |
199 |
(tramp-telnet-program nil) |
(tramp-telnet-program nil) |
200 |
(tramp-telnet-args nil)) |
(tramp-telnet-args nil)) |
201 |
("scp" (tramp-connection-function tramp-open-connection-rsh) |
("scp" (tramp-connection-function tramp-open-connection-rsh) |
|
(tramp-completion-function tramp-get-completion-ssh) |
|
202 |
(tramp-rsh-program "ssh") |
(tramp-rsh-program "ssh") |
203 |
(tramp-rcp-program "scp") |
(tramp-rcp-program "scp") |
204 |
(tramp-remote-sh "/bin/sh") |
(tramp-remote-sh "/bin/sh") |
210 |
(tramp-telnet-program nil) |
(tramp-telnet-program nil) |
211 |
(tramp-telnet-args nil)) |
(tramp-telnet-args nil)) |
212 |
("scp1" (tramp-connection-function tramp-open-connection-rsh) |
("scp1" (tramp-connection-function tramp-open-connection-rsh) |
|
(tramp-completion-function tramp-get-completion-ssh) |
|
213 |
(tramp-rsh-program "ssh") |
(tramp-rsh-program "ssh") |
214 |
(tramp-rcp-program "scp") |
(tramp-rcp-program "scp") |
215 |
(tramp-remote-sh "/bin/sh") |
(tramp-remote-sh "/bin/sh") |
221 |
(tramp-telnet-program nil) |
(tramp-telnet-program nil) |
222 |
(tramp-telnet-args nil)) |
(tramp-telnet-args nil)) |
223 |
("scp2" (tramp-connection-function tramp-open-connection-rsh) |
("scp2" (tramp-connection-function tramp-open-connection-rsh) |
|
(tramp-completion-function tramp-get-completion-ssh) |
|
224 |
(tramp-rsh-program "ssh") |
(tramp-rsh-program "ssh") |
225 |
(tramp-rcp-program "scp") |
(tramp-rcp-program "scp") |
226 |
(tramp-remote-sh "/bin/sh") |
(tramp-remote-sh "/bin/sh") |
233 |
(tramp-telnet-args nil)) |
(tramp-telnet-args nil)) |
234 |
("scp1-old" |
("scp1-old" |
235 |
(tramp-connection-function tramp-open-connection-rsh) |
(tramp-connection-function tramp-open-connection-rsh) |
|
(tramp-completion-function tramp-get-completion-ssh) |
|
236 |
(tramp-rsh-program "ssh1") |
(tramp-rsh-program "ssh1") |
237 |
(tramp-rcp-program "scp1") |
(tramp-rcp-program "scp1") |
238 |
(tramp-remote-sh "/bin/sh") |
(tramp-remote-sh "/bin/sh") |
245 |
(tramp-telnet-args nil)) |
(tramp-telnet-args nil)) |
246 |
("scp2-old" |
("scp2-old" |
247 |
(tramp-connection-function tramp-open-connection-rsh) |
(tramp-connection-function tramp-open-connection-rsh) |
|
(tramp-completion-function tramp-get-completion-ssh) |
|
248 |
(tramp-rsh-program "ssh2") |
(tramp-rsh-program "ssh2") |
249 |
(tramp-rcp-program "scp2") |
(tramp-rcp-program "scp2") |
250 |
(tramp-remote-sh "/bin/sh") |
(tramp-remote-sh "/bin/sh") |
256 |
(tramp-telnet-program nil) |
(tramp-telnet-program nil) |
257 |
(tramp-telnet-args nil)) |
(tramp-telnet-args nil)) |
258 |
("rsync" (tramp-connection-function tramp-open-connection-rsh) |
("rsync" (tramp-connection-function tramp-open-connection-rsh) |
|
(tramp-completion-function tramp-get-completion-ssh) |
|
259 |
(tramp-rsh-program "ssh") |
(tramp-rsh-program "ssh") |
260 |
(tramp-rcp-program "rsync") |
(tramp-rcp-program "rsync") |
261 |
(tramp-remote-sh "/bin/sh") |
(tramp-remote-sh "/bin/sh") |
267 |
(tramp-telnet-program nil) |
(tramp-telnet-program nil) |
268 |
(tramp-telnet-args nil)) |
(tramp-telnet-args nil)) |
269 |
("rsh" (tramp-connection-function tramp-open-connection-rsh) |
("rsh" (tramp-connection-function tramp-open-connection-rsh) |
|
(tramp-completion-function tramp-get-completion-rsh) |
|
270 |
(tramp-rsh-program "rsh") |
(tramp-rsh-program "rsh") |
271 |
(tramp-rcp-program nil) |
(tramp-rcp-program nil) |
272 |
(tramp-remote-sh "/bin/sh") |
(tramp-remote-sh "/bin/sh") |
278 |
(tramp-telnet-program nil) |
(tramp-telnet-program nil) |
279 |
(tramp-telnet-args nil)) |
(tramp-telnet-args nil)) |
280 |
("ssh" (tramp-connection-function tramp-open-connection-rsh) |
("ssh" (tramp-connection-function tramp-open-connection-rsh) |
|
(tramp-completion-function tramp-get-completion-ssh) |
|
281 |
(tramp-rsh-program "ssh") |
(tramp-rsh-program "ssh") |
282 |
(tramp-rcp-program nil) |
(tramp-rcp-program nil) |
283 |
(tramp-remote-sh "/bin/sh") |
(tramp-remote-sh "/bin/sh") |
289 |
(tramp-telnet-program nil) |
(tramp-telnet-program nil) |
290 |
(tramp-telnet-args nil)) |
(tramp-telnet-args nil)) |
291 |
("ssh1" (tramp-connection-function tramp-open-connection-rsh) |
("ssh1" (tramp-connection-function tramp-open-connection-rsh) |
|
(tramp-completion-function tramp-get-completion-ssh) |
|
292 |
(tramp-rsh-program "ssh") |
(tramp-rsh-program "ssh") |
293 |
(tramp-rcp-program nil) |
(tramp-rcp-program nil) |
294 |
(tramp-remote-sh "/bin/sh") |
(tramp-remote-sh "/bin/sh") |
300 |
(tramp-telnet-program nil) |
(tramp-telnet-program nil) |
301 |
(tramp-telnet-args nil)) |
(tramp-telnet-args nil)) |
302 |
("ssh2" (tramp-connection-function tramp-open-connection-rsh) |
("ssh2" (tramp-connection-function tramp-open-connection-rsh) |
|
(tramp-completion-function tramp-get-completion-ssh) |
|
303 |
(tramp-rsh-program "ssh") |
(tramp-rsh-program "ssh") |
304 |
(tramp-rcp-program nil) |
(tramp-rcp-program nil) |
305 |
(tramp-remote-sh "/bin/sh") |
(tramp-remote-sh "/bin/sh") |
312 |
(tramp-telnet-args nil)) |
(tramp-telnet-args nil)) |
313 |
("ssh1-old" |
("ssh1-old" |
314 |
(tramp-connection-function tramp-open-connection-rsh) |
(tramp-connection-function tramp-open-connection-rsh) |
|
(tramp-completion-function tramp-get-completion-ssh) |
|
315 |
(tramp-rsh-program "ssh1") |
(tramp-rsh-program "ssh1") |
316 |
(tramp-rcp-program nil) |
(tramp-rcp-program nil) |
317 |
(tramp-remote-sh "/bin/sh") |
(tramp-remote-sh "/bin/sh") |
324 |
(tramp-telnet-args nil)) |
(tramp-telnet-args nil)) |
325 |
("ssh2-old" |
("ssh2-old" |
326 |
(tramp-connection-function tramp-open-connection-rsh) |
(tramp-connection-function tramp-open-connection-rsh) |
|
(tramp-completion-function tramp-get-completion-ssh) |
|
327 |
(tramp-rsh-program "ssh2") |
(tramp-rsh-program "ssh2") |
328 |
(tramp-rcp-program nil) |
(tramp-rcp-program nil) |
329 |
(tramp-remote-sh "/bin/sh") |
(tramp-remote-sh "/bin/sh") |
336 |
(tramp-telnet-args nil)) |
(tramp-telnet-args nil)) |
337 |
("telnet" |
("telnet" |
338 |
(tramp-connection-function tramp-open-connection-telnet) |
(tramp-connection-function tramp-open-connection-telnet) |
|
(tramp-completion-function tramp-get-completion-telnet) |
|
339 |
(tramp-rsh-program nil) |
(tramp-rsh-program nil) |
340 |
(tramp-rcp-program nil) |
(tramp-rcp-program nil) |
341 |
(tramp-remote-sh "/bin/sh") |
(tramp-remote-sh "/bin/sh") |
347 |
(tramp-telnet-program "telnet") |
(tramp-telnet-program "telnet") |
348 |
(tramp-telnet-args nil)) |
(tramp-telnet-args nil)) |
349 |
("su" (tramp-connection-function tramp-open-connection-su) |
("su" (tramp-connection-function tramp-open-connection-su) |
|
(tramp-completion-function tramp-get-completion-su) |
|
350 |
(tramp-rsh-program nil) |
(tramp-rsh-program nil) |
351 |
(tramp-rcp-program nil) |
(tramp-rcp-program nil) |
352 |
(tramp-remote-sh "/bin/sh") |
(tramp-remote-sh "/bin/sh") |
358 |
(tramp-telnet-program nil) |
(tramp-telnet-program nil) |
359 |
(tramp-telnet-args nil)) |
(tramp-telnet-args nil)) |
360 |
("sudo" (tramp-connection-function tramp-open-connection-su) |
("sudo" (tramp-connection-function tramp-open-connection-su) |
|
(tramp-completion-function tramp-get-completion-su) |
|
361 |
(tramp-rsh-program nil) |
(tramp-rsh-program nil) |
362 |
(tramp-rcp-program nil) |
(tramp-rcp-program nil) |
363 |
(tramp-remote-sh "/bin/sh") |
(tramp-remote-sh "/bin/sh") |
369 |
(tramp-telnet-program nil) |
(tramp-telnet-program nil) |
370 |
(tramp-telnet-args nil)) |
(tramp-telnet-args nil)) |
371 |
("multi" (tramp-connection-function tramp-open-connection-multi) |
("multi" (tramp-connection-function tramp-open-connection-multi) |
|
(tramp-completion-function nil) |
|
372 |
(tramp-rsh-program nil) |
(tramp-rsh-program nil) |
373 |
(tramp-rcp-program nil) |
(tramp-rcp-program nil) |
374 |
(tramp-remote-sh "/bin/sh") |
(tramp-remote-sh "/bin/sh") |
380 |
(tramp-telnet-program nil) |
(tramp-telnet-program nil) |
381 |
(tramp-telnet-args nil)) |
(tramp-telnet-args nil)) |
382 |
("scpx" (tramp-connection-function tramp-open-connection-rsh) |
("scpx" (tramp-connection-function tramp-open-connection-rsh) |
|
(tramp-completion-function tramp-get-completion-ssh) |
|
383 |
(tramp-rsh-program "ssh") |
(tramp-rsh-program "ssh") |
384 |
(tramp-rcp-program "scp") |
(tramp-rcp-program "scp") |
385 |
(tramp-remote-sh "/bin/sh") |
(tramp-remote-sh "/bin/sh") |
389 |
(tramp-telnet-program nil) |
(tramp-telnet-program nil) |
390 |
(tramp-telnet-args nil)) |
(tramp-telnet-args nil)) |
391 |
("sshx" (tramp-connection-function tramp-open-connection-rsh) |
("sshx" (tramp-connection-function tramp-open-connection-rsh) |
|
(tramp-completion-function tramp-get-completion-ssh) |
|
392 |
(tramp-rsh-program "ssh") |
(tramp-rsh-program "ssh") |
393 |
(tramp-rcp-program nil) |
(tramp-rcp-program nil) |
394 |
(tramp-remote-sh "/bin/sh") |
(tramp-remote-sh "/bin/sh") |
401 |
(tramp-telnet-args nil)) |
(tramp-telnet-args nil)) |
402 |
("krlogin" |
("krlogin" |
403 |
(tramp-connection-function tramp-open-connection-rsh) |
(tramp-connection-function tramp-open-connection-rsh) |
|
(tramp-completion-function tramp-get-completion-rsh) |
|
404 |
(tramp-rsh-program "krlogin") |
(tramp-rsh-program "krlogin") |
405 |
(tramp-rcp-program nil) |
(tramp-rcp-program nil) |
406 |
(tramp-remote-sh "/bin/sh") |
(tramp-remote-sh "/bin/sh") |
413 |
(tramp-telnet-args nil)) |
(tramp-telnet-args nil)) |
414 |
("plink" |
("plink" |
415 |
(tramp-connection-function tramp-open-connection-rsh) |
(tramp-connection-function tramp-open-connection-rsh) |
|
(tramp-completion-function tramp-get-completion-ssh) |
|
416 |
(tramp-rsh-program "plink") |
(tramp-rsh-program "plink") |
417 |
(tramp-rcp-program nil) |
(tramp-rcp-program nil) |
418 |
(tramp-remote-sh "/bin/sh") |
(tramp-remote-sh "/bin/sh") |
425 |
(tramp-telnet-args nil)) |
(tramp-telnet-args nil)) |
426 |
("pscp" |
("pscp" |
427 |
(tramp-connection-function tramp-open-connection-rsh) |
(tramp-connection-function tramp-open-connection-rsh) |
|
(tramp-completion-function tramp-get-completion-ssh) |
|
428 |
(tramp-rsh-program "plink") |
(tramp-rsh-program "plink") |
429 |
(tramp-rcp-program "pscp") |
(tramp-rcp-program "pscp") |
430 |
(tramp-remote-sh "/bin/sh") |
(tramp-remote-sh "/bin/sh") |
437 |
(tramp-telnet-args nil)) |
(tramp-telnet-args nil)) |
438 |
("fcp" |
("fcp" |
439 |
(tramp-connection-function tramp-open-connection-rsh) |
(tramp-connection-function tramp-open-connection-rsh) |
|
(tramp-completion-function nil) |
|
440 |
(tramp-rsh-program "fsh") |
(tramp-rsh-program "fsh") |
441 |
(tramp-rcp-program "fcp") |
(tramp-rcp-program "fcp") |
442 |
(tramp-remote-sh "/bin/sh -i") |
(tramp-remote-sh "/bin/sh -i") |
452 |
This is a list of entries of the form (NAME PARAM1 PARAM2 ...). |
This is a list of entries of the form (NAME PARAM1 PARAM2 ...). |
453 |
Each NAME stands for a remote access method. Each PARAM is a |
Each NAME stands for a remote access method. Each PARAM is a |
454 |
pair of the form (KEY VALUE). The following KEYs are defined: |
pair of the form (KEY VALUE). The following KEYs are defined: |
455 |
* `tramp-connection-function' |
* `tramp-connection-function' |
456 |
This specifies the function to use to connect to the remote host. |
This specifies the function to use to connect to the remote host. |
457 |
Currently, `tramp-open-connection-rsh', `tramp-open-connection-telnet' |
Currently, `tramp-open-connection-rsh', `tramp-open-connection-telnet' |
458 |
and `tramp-open-connection-su' are defined. See the documentation |
and `tramp-open-connection-su' are defined. See the documentation |
459 |
of these functions for more details. |
of these functions for more details. |
|
* `tramp-completion-function' |
|
|
This specifies the function to use to complete the file name. |
|
|
Currently, `tramp-get-completion-rsh', `tramp-get-completion-ssh', |
|
|
`tramp-get-completion-telnet' and `tramp-get-completion-su' are defined. |
|
|
See the documentation of these functions for more details. |
|
460 |
* `tramp-remote-sh' |
* `tramp-remote-sh' |
461 |
This specifies the Bourne shell to use on the remote host. This |
This specifies the Bourne shell to use on the remote host. This |
462 |
MUST be a Bourne-like shell. It is normally not necessary to set |
MUST be a Bourne-like shell. It is normally not necessary to set |
573 |
:type '(repeat |
:type '(repeat |
574 |
(cons string |
(cons string |
575 |
(set (list (const tramp-connection-function) function) |
(set (list (const tramp-connection-function) function) |
|
(list (const tramp-completion-function) |
|
|
(choice (const nil) function)) |
|
576 |
(list (const tramp-rsh-program) |
(list (const tramp-rsh-program) |
577 |
(choice (const nil) string)) |
(choice (const nil) string)) |
578 |
(list (const tramp-rcp-program) |
(list (const tramp-rcp-program) |
665 |
:group 'tramp |
:group 'tramp |
666 |
:type 'string) |
:type 'string) |
667 |
|
|
668 |
|
;; Default values for non-Unices seeked |
669 |
|
(defconst tramp-completion-function-alist-rsh |
670 |
|
(unless (memq system-type '(windows-nt)) |
671 |
|
'((tramp-parse-rhosts "/etc/hosts.equiv") |
672 |
|
(tramp-parse-rhosts "~/.rhosts"))) |
673 |
|
"Default list of (FUNNCTION FILE) pairs to be examined for rsh methods." |
674 |
|
) |
675 |
|
|
676 |
|
;; Default values for non-Unices seeked |
677 |
|
(defconst tramp-completion-function-alist-ssh |
678 |
|
(unless (memq system-type '(windows-nt)) |
679 |
|
'((tramp-parse-rhosts "/etc/hosts.equiv") |
680 |
|
(tramp-parse-rhosts "/etc/shosts.equiv") |
681 |
|
(tramp-parse-shosts "/etc/ssh_known_hosts") |
682 |
|
(tramp-parse-rhosts "~/.rhosts") |
683 |
|
(tramp-parse-rhosts "~/.shosts") |
684 |
|
(tramp-parse-shosts "~/.ssh/known_hosts"))) |
685 |
|
"Default list of (FUNNCTION FILE) pairs to be examined for ssh methods." |
686 |
|
) |
687 |
|
|
688 |
|
;; Default values for non-Unices seeked |
689 |
|
(defconst tramp-completion-function-alist-telnet |
690 |
|
(unless (memq system-type '(windows-nt)) |
691 |
|
'((tramp-parse-hosts "/etc/hosts"))) |
692 |
|
"Default list of (FUNNCTION FILE) pairs to be examined for telnet methods." |
693 |
|
) |
694 |
|
|
695 |
|
;; Default values for non-Unices seeked |
696 |
|
(defconst tramp-completion-function-alist-su |
697 |
|
(unless (memq system-type '(windows-nt)) |
698 |
|
'((tramp-parse-passwd "/etc/passwd"))) |
699 |
|
"Default list of (FUNNCTION FILE) pairs to be examined for su methods." |
700 |
|
) |
701 |
|
|
702 |
|
(defcustom tramp-completion-function-alist |
703 |
|
(list (cons "rcp" tramp-completion-function-alist-rsh) |
704 |
|
(cons "scp" tramp-completion-function-alist-ssh) |
705 |
|
(cons "scp1" tramp-completion-function-alist-ssh) |
706 |
|
(cons "scp2" tramp-completion-function-alist-ssh) |
707 |
|
(cons "scp1-old" tramp-completion-function-alist-ssh) |
708 |
|
(cons "scp2-old" tramp-completion-function-alist-ssh) |
709 |
|
(cons "rsync" tramp-completion-function-alist-rsh) |
710 |
|
(cons "rsh" tramp-completion-function-alist-rsh) |
711 |
|
(cons "ssh" tramp-completion-function-alist-ssh) |
712 |
|
(cons "ssh1" tramp-completion-function-alist-ssh) |
713 |
|
(cons "ssh2" tramp-completion-function-alist-ssh) |
714 |
|
(cons "ssh1-old" tramp-completion-function-alist-ssh) |
715 |
|
(cons "ssh2-old" tramp-completion-function-alist-ssh) |
716 |
|
(cons "telnet" tramp-completion-function-alist-telnet) |
717 |
|
(cons "su" tramp-completion-function-alist-su) |
718 |
|
(cons "sudo" tramp-completion-function-alist-su) |
719 |
|
(cons "multi" nil) |
720 |
|
(cons "scpx" tramp-completion-function-alist-ssh) |
721 |
|
(cons "sshx" tramp-completion-function-alist-ssh) |
722 |
|
(cons "krlogin" tramp-completion-function-alist-rsh) |
723 |
|
(cons "plink" tramp-completion-function-alist-ssh) |
724 |
|
(cons "pscp" tramp-completion-function-alist-ssh) |
725 |
|
(cons "fcp" nil) |
726 |
|
) |
727 |
|
"*Alist of methods for remote files. |
728 |
|
This is a list of entries of the form (NAME PAIR1 PAIR2 ...). |
729 |
|
Each NAME stands for a remote access method. Each PAIR is of the form |
730 |
|
(FUNCTION FILE). FUNCTION is responsible to extract user names and host |
731 |
|
names from FILE for completion. The following predefined FUNCTIONs exists: |
732 |
|
|
733 |
|
* `tramp-parse-rhosts' for \".rhosts\" like files, |
734 |
|
* `tramp-parse-shosts' for \"ssh_known_hosts\" like files, |
735 |
|
* `tramp-parse-hosts' for \"/etc/hosts\" like files, and |
736 |
|
* `tramp-parse-passwd' for \"/etc/passwd\" like files. |
737 |
|
|
738 |
|
A FUNCTION parsing \".netrc\" file syntax doesn't exist in TRAMP. This |
739 |
|
task is delegated to ange-ftp; its customization should be used instead. |
740 |
|
|
741 |
|
FUNCTION can also see a customer defined function. For more details see |
742 |
|
the info pages." |
743 |
|
:group 'tramp |
744 |
|
:type '(repeat |
745 |
|
(cons string |
746 |
|
(choice (const nil) (repeat (list function file)))))) |
747 |
|
|
748 |
(defcustom tramp-rsh-end-of-line "\n" |
(defcustom tramp-rsh-end-of-line "\n" |
749 |
"*String used for end of line in rsh connections. |
"*String used for end of line in rsh connections. |
750 |
I don't think this ever needs to be changed, so please tell me about it |
I don't think this ever needs to be changed, so please tell me about it |
1250 |
In the connection buffer, this variable has the value of the like-named |
In the connection buffer, this variable has the value of the like-named |
1251 |
method parameter, as specified in `tramp-methods' (which see).") |
method parameter, as specified in `tramp-methods' (which see).") |
1252 |
|
|
|
(defvar tramp-completion-function nil |
|
|
"This internal variable holds a parameter for `tramp-methods'. |
|
|
In the connection buffer, this variable has the value of the like-named |
|
|
method parameter, as specified in `tramp-methods' (which see).") |
|
|
|
|
1253 |
(defvar tramp-remote-sh nil |
(defvar tramp-remote-sh nil |
1254 |
"This internal variable holds a parameter for `tramp-methods'. |
"This internal variable holds a parameter for `tramp-methods'. |
1255 |
In the connection buffer, this variable has the value of the like-named |
In the connection buffer, this variable has the value of the like-named |
1682 |
|
|
1683 |
(put 'with-parsed-tramp-file-name 'lisp-indent-function 2) |
(put 'with-parsed-tramp-file-name 'lisp-indent-function 2) |
1684 |
|
|
1685 |
|
;;; Config Manipulation Functions: |
1686 |
|
|
1687 |
|
(defun tramp-set-completion-function (method function-list) |
1688 |
|
"Sets the list of completion functions for METHOD. |
1689 |
|
FUNCTION-LIST is a list of entries of the form (FUNCTION FILE). |
1690 |
|
The FUNCTION is intended to parse FILE according its syntax. |
1691 |
|
It might be a predefined FUNCTION, or a user defined FUNCTION. |
1692 |
|
Predefined FUNCTIONs are `tramp-parse-rhosts', `tramp-parse-shosts', |
1693 |
|
`tramp-parse-hosts', and `tramp-parse-passwd'. |
1694 |
|
Example: |
1695 |
|
|
1696 |
|
(tramp-set-completion-function |
1697 |
|
\"ssh\" |
1698 |
|
'((tramp-parse-shosts \"/etc/ssh_known_hosts\") |
1699 |
|
(tramp-parse-shosts \"~/.ssh/known_hosts\")))" |
1700 |
|
|
1701 |
|
(let ((v (cdr (assoc method tramp-completion-function-alist)))) |
1702 |
|
(when v (setcdr v function-list)))) |
1703 |
|
|
1704 |
|
(defun tramp-get-completion-function (method) |
1705 |
|
"Returns list of completion functions for METHOD. |
1706 |
|
For definition of that list see `tramp-set-completion-function'." |
1707 |
|
(cdr (assoc method tramp-completion-function-alist))) |
1708 |
|
|
1709 |
;;; File Name Handler Functions: |
;;; File Name Handler Functions: |
1710 |
|
|
1711 |
(defun tramp-handle-make-symbolic-link |
(defun tramp-handle-make-symbolic-link |
3536 |
(tramp-setup-complete) |
(tramp-setup-complete) |
3537 |
(eval-after-load "complete" '(tramp-setup-complete))) |
(eval-after-load "complete" '(tramp-setup-complete))) |
3538 |
|
|
3539 |
|
;;; File name handler functions for completion mode |
3540 |
|
|
3541 |
;; Necessary because `tramp-file-name-regexp-unified' and |
;; Necessary because `tramp-file-name-regexp-unified' and |
3542 |
;; `tramp-completion-file-name-regexp-unified' aren't different. |
;; `tramp-completion-file-name-regexp-unified' aren't different. |
3543 |
;; If nil, `tramp-completion-run-real-handler' is called (i.e. forwarding to |
;; If nil, `tramp-completion-run-real-handler' is called (i.e. forwarding to |
3619 |
(method (tramp-file-name-method car)) |
(method (tramp-file-name-method car)) |
3620 |
(user (tramp-file-name-user car)) |
(user (tramp-file-name-user car)) |
3621 |
(host (tramp-file-name-host car)) |
(host (tramp-file-name-host car)) |
3622 |
(path (tramp-file-name-path car))) |
(path (tramp-file-name-path car)) |
3623 |
|
(m (or method (tramp-find-default-method user host))) |
3624 |
(unless (or multi-method ;; Not handled (yet). |
all-user-hosts) |
|
path) ;; Nothing to complete |
|
3625 |
|
|
3626 |
(let* ((m (or method (tramp-find-default-method user host))) |
(unless (or multi-method ;; Not handled (yet). |
3627 |
(fn (tramp-get-completion-function nil m))) |
path) ;; Nothing to complete |
3628 |
|
|
3629 |
(if (or user host) |
(if (or user host) |
3630 |
;; method dependent user / host combinations |
|
3631 |
(when fn |
;; Method dependent user / host combinations |
3632 |
(setq result (append result (funcall fn method user host)))) |
(progn |
3633 |
;; possible methods |
(mapcar |
3634 |
|
'(lambda (x) |
3635 |
|
(setq all-user-hosts |
3636 |
|
(append all-user-hosts |
3637 |
|
(funcall (nth 0 x) (nth 1 x))))) |
3638 |
|
(tramp-get-completion-function m)) |
3639 |
|
|
3640 |
|
(setq result (append result |
3641 |
|
(mapcar |
3642 |
|
'(lambda (x) |
3643 |
|
(tramp-get-completion-user-host |
3644 |
|
method user host (nth 0 x) (nth 1 x))) |
3645 |
|
(delq nil all-user-hosts))))) |
3646 |
|
|
3647 |
|
;; Possible methods |
3648 |
(setq result |
(setq result |
3649 |
(append result (tramp-get-completion-methods m)))) |
(append result (tramp-get-completion-methods m)))) |
3650 |
|
|
3664 |
(if fix-ange-ftp |
(if fix-ange-ftp |
3665 |
(substring filename (length fix-ange-ftp-string)) |
(substring filename (length fix-ange-ftp-string)) |
3666 |
filename) |
filename) |
3667 |
directory)))))))) |
directory))))))) |
3668 |
|
|
3669 |
(setq v (delq car v)))) |
(setq v (delq car v)))) |
3670 |
|
|
3844 |
;; we must remove leading "/". |
;; we must remove leading "/". |
3845 |
(substring (tramp-make-tramp-file-name nil method user host nil) 1))) |
(substring (tramp-make-tramp-file-name nil method user host nil) 1))) |
3846 |
|
|
|
;; This function isn't as good as it should because necessary information is |
|
|
;; accessible on remote hosts where we want to go. So we use the local files, |
|
|
;; hoping that the information is shared. |
|
|
;; A better implementation could be a learning function: store information |
|
|
;; whenever it has been collected, and reuse it in later sessions. |
|
|
;; Shining example: .newsrc.eld |
|
|
(defun tramp-get-completion-rsh (method user host) |
|
|
"Returns all user / host combinations for rsh-like methods. |
|
|
Parsed files are \"/etc/hosts.equiv\" and \"~/.rhosts\"." |
|
|
|
|
|
(mapcar |
|
|
'(lambda (l) |
|
|
(let ((u (nth 0 l)) (h (nth 1 l))) |
|
|
(tramp-get-completion-user-host method user host u h))) |
|
|
|
|
|
(delq nil (append (tramp-parse-rhosts "/etc/hosts.equiv") |
|
|
(tramp-parse-rhosts "~/.rhosts"))))) |
|
|
|
|
3847 |
(defun tramp-parse-rhosts (filename) |
(defun tramp-parse-rhosts (filename) |
3848 |
"Return a list of (user host) tuples allowed to access. |
"Return a list of (user host) tuples allowed to access. |
3849 |
Either user or host may be nil" |
Either user or host may be nil" |
3881 |
(forward-line 1) |
(forward-line 1) |
3882 |
result)) |
result)) |
3883 |
|
|
|
;; Same comment as with `tramp-get-completion-rsh' |
|
|
(defun tramp-get-completion-ssh (method user host) |
|
|
"Returns all user / host combinations for ssh-like methods. |
|
|
Parsed files are \"/etc/{s}hosts.equiv\", \"/etc/ssh_known_hosts\", |
|
|
\"~/.{r,s}hosts\" and \"~/.ssh/known_hosts\"." |
|
|
|
|
|
(mapcar |
|
|
'(lambda (l) |
|
|
(let ((u (nth 0 l)) (h (nth 1 l))) |
|
|
(tramp-get-completion-user-host method user host u h))) |
|
|
|
|
|
(delq nil (append (tramp-parse-rhosts "/etc/hosts.equiv") |
|
|
(tramp-parse-rhosts "/etc/shosts.equiv") |
|
|
(tramp-parse-shosts "/etc/ssh_known_hosts") |
|
|
(tramp-parse-rhosts "~/.rhosts") |
|
|
(tramp-parse-rhosts "~/.shosts") |
|
|
(tramp-parse-shosts "~/.ssh/known_hosts"))))) |
|
|
|
|
3884 |
(defun tramp-parse-shosts (filename) |
(defun tramp-parse-shosts (filename) |
3885 |
"Return a list of (user host) tuples allowed to access. |
"Return a list of (user host) tuples allowed to access. |
3886 |
User is always nil." |
User is always nil." |
3910 |
(forward-line 1)) |
(forward-line 1)) |
3911 |
result)) |
result)) |
3912 |
|
|
|
;; Expand host names from "/etc/hosts". |
|
|
(defun tramp-get-completion-telnet (method user host) |
|
|
"Returns all user / host combinations for telnet-like methods. |
|
|
Parsed file is \"/etc/hosts\"." |
|
|
|
|
|
(mapcar |
|
|
'(lambda (l) |
|
|
(let ((u (nth 0 l)) (h (nth 1 l))) |
|
|
(tramp-get-completion-user-host method user host u h))) |
|
|
|
|
|
(delq nil (append (tramp-parse-hosts "/etc/hosts"))))) |
|
|
|
|
3913 |
(defun tramp-parse-hosts (filename) |
(defun tramp-parse-hosts (filename) |
3914 |
"Return a list of (user host) tuples allowed to access. |
"Return a list of (user host) tuples allowed to access. |
3915 |
User is always nil." |
User is always nil." |
3939 |
(forward-line 1)) |
(forward-line 1)) |
3940 |
result)) |
result)) |
3941 |
|
|
|
;; Expand user names names from "/etc/passwd". Not very clever bacuase of |
|
|
;; NIS and shadow passwords. |
|
|
(defun tramp-get-completion-su (method user host) |
|
|
"Returns all user / host combinations for su-like methods. |
|
|
Parsed file is \"/etc/passwd\". |
|
|
If no user name is given use user name \"root\". |
|
|
If no host name is given use host name \"localhost\"." |
|
|
|
|
|
(when user |
|
|
(if (string-equal user "") |
|
|
(list (tramp-get-completion-user-host |
|
|
method user host "root" "localhost")) |
|
|
(mapcar |
|
|
'(lambda (l) |
|
|
(let ((u (nth 0 l)) (h (nth 1 l))) |
|
|
(tramp-get-completion-user-host method user host u "localhost"))) |
|
|
|
|
|
(delq nil (append (tramp-parse-passwd "/etc/passwd"))))))) |
|
|
|
|
3942 |
(defun tramp-parse-passwd (filename) |
(defun tramp-parse-passwd (filename) |
3943 |
"Return a list of (user host) tuples allowed to access. |
"Return a list of (user host) tuples allowed to access. |
3944 |
Host is always \"localhost\"." |
Host is always \"localhost\"." |
3945 |
|
|
3946 |
(let (res) |
(let (res) |
3947 |
(when (file-exists-p filename) |
(if (and (symbolp 'user) (zerop (length user))) |
3948 |
(with-temp-buffer |
'(("root" nil)) |
3949 |
(insert-file-contents filename) |
(when (file-exists-p filename) |
3950 |
(goto-char (point-min)) |
(with-temp-buffer |
3951 |
(while (not (eobp)) |
(insert-file-contents filename) |
3952 |
(add-to-list 'res (tramp-parse-passwd-group))))) |
(goto-char (point-min)) |
3953 |
res)) |
(while (not (eobp)) |
3954 |
|
(add-to-list 'res (tramp-parse-passwd-group))))) |
3955 |
|
res))) |
3956 |
|
|
3957 |
(defun tramp-parse-passwd-group () |
(defun tramp-parse-passwd-group () |
3958 |
"Return a (user host) tuple allowed to access. |
"Return a (user host) tuple allowed to access. |
5858 |
(error "Method `%s' didn't specify a connection function" |
(error "Method `%s' didn't specify a connection function" |
5859 |
(or multi-method method))))) |
(or multi-method method))))) |
5860 |
|
|
|
(defun tramp-get-completion-function (multi-method method) |
|
|
(second (assoc 'tramp-completion-function |
|
|
(assoc (or multi-method method tramp-default-method) |
|
|
tramp-methods)))) |
|
|
|
|
5861 |
(defun tramp-get-remote-sh (multi-method method) |
(defun tramp-get-remote-sh (multi-method method) |
5862 |
(second (or (assoc 'tramp-remote-sh |
(second (or (assoc 'tramp-remote-sh |
5863 |
(assoc (or multi-method method tramp-default-method) |
(assoc (or multi-method method tramp-default-method) |
6377 |
;; all the "*-old" methods? Or rename them to "*_old"? |
;; all the "*-old" methods? Or rename them to "*_old"? |
6378 |
;; ** Write documentation for "tramp.texi". |
;; ** Write documentation for "tramp.texi". |
6379 |
;; ** Extend `tramp-get-completion-su' for NIS and shadow passwords. |
;; ** Extend `tramp-get-completion-su' for NIS and shadow passwords. |
6380 |
;; ** Unify `tramp-get-completion-{rsh,ssh,telnet,su}' and |
;; ** Unify `tramp-parse-{rhosts,shosts,hosts,passwd}'. |
6381 |
;; `tramp-parse-{rhosts,shosts,hosts,passwd}'. Code is nearly identical. |
;; Code is nearly identical. |
6382 |
;; ** Decide whiche files to take for searching user/host names depending on |
;; ** Decide whiche files to take for searching user/host names depending on |
6383 |
;; operating system (w32!). |
;; operating system (windows-nt) in `tramp-completion-function-alist'. |
|
;; ** Make files to be used for searching user/host names |
|
|
;; configurable. Something like |
|
|
;; ("ssh" ('tramp-parse-rhosts "/etc/hosts.equiv") |
|
|
;; ('tramp-parse-rhosts "/etc/shosts.equiv") |
|
|
;; ('tramp-parse-shosts "/etc/ssh_known_hosts") |
|
|
;; ('tramp-parse-rhosts "~/.rhosts") |
|
|
;; ('tramp-parse-rhosts "~/.shosts") |
|
|
;; ('tramp-parse-shosts "~/.ssh/known_hosts")) |
|
6384 |
;; ** Enhance variables for debug. |
;; ** Enhance variables for debug. |
6385 |
;; ** Implement "/multi:" completion. |
;; ** Implement "/multi:" completion. |
6386 |
;; ** Add a learning mode for completion. Make results persistent. |
;; ** Add a learning mode for completion. Make results persistent. |