aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKai Großjohann2002-09-22 17:39:18 +0000
committerKai Großjohann2002-09-22 17:39:18 +0000
commit292ffc15564ef7a1e869b7735804794c5a347f45 (patch)
tree66c6e6426f4bbfb019a7b92fbddd879533da6756
parent91879624ba4e260553f5f66978fba871ff0b6ab9 (diff)
downloademacs-292ffc15564ef7a1e869b7735804794c5a347f45.tar.gz
emacs-292ffc15564ef7a1e869b7735804794c5a347f45.zip
Version 2.0.22 released.
(tramp-parse-rhosts, tramp-parse-shosts) (tramp-parse-hosts, tramp-parse-passwd): Apply `push' but `add-to-list' for performance reasons. (tramp-get-completion-user-host): Return `nil' in case both `user' and 'host' are empty (not necessarily `nil'. (tramp-parse-netrc, tramp-parse-netrc-group): New functions. (tramp-user-regexp): " \t" are not user regexp characters. (tramp-completion-handle-file-name-all-completions): Remove Ange-FTP cmpletion. It has a bug not handling the "/ftp:" prefix completely, and it returns local completions as well. (tramp-completion-function-alist-ftp): New constant. (tramp-completion-function-alist): Add completion function for "ftp". From Michael Albinus <Michael.Albinus@alcatel.de>.
-rw-r--r--lisp/ChangeLog18
-rw-r--r--lisp/net/tramp.el96
-rw-r--r--man/tramp.texi17
3 files changed, 81 insertions, 50 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 9ee6f601adc..0f71c5c6d2d 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,21 @@
12002-09-22 Kai Gro,b_(Bjohann <grossjoh@ls6.informatik.uni-dortmund.de>
2
3 * net/tramp.el: Version 2.0.22 released.
4 (tramp-parse-rhosts, tramp-parse-shosts)
5 (tramp-parse-hosts, tramp-parse-passwd): Apply `push' but
6 `add-to-list' for performance reasons.
7 (tramp-get-completion-user-host): Return `nil' in case both `user'
8 and 'host' are empty (not necessarily `nil'.
9 (tramp-parse-netrc, tramp-parse-netrc-group): New functions.
10 (tramp-user-regexp): " \t" are not user regexp characters.
11 (tramp-completion-handle-file-name-all-completions): Remove
12 Ange-FTP cmpletion. It has a bug not handling the "/ftp:" prefix
13 completely, and it returns local completions as well.
14 (tramp-completion-function-alist-ftp): New constant.
15 (tramp-completion-function-alist): Add completion function for
16 "ftp".
17 From Michael Albinus <Michael.Albinus@alcatel.de>.
18
12002-09-22 Kai Gro,b_(Bjohann <Kai.Grossjohann@CS.Uni-Dortmund.DE> 192002-09-22 Kai Gro,b_(Bjohann <Kai.Grossjohann@CS.Uni-Dortmund.DE>
2 20
3 * net/tramp.el: Version 2.0.21 released. 21 * net/tramp.el: Version 2.0.21 released.
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index 58ec71b312d..36f81005ec5 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -72,7 +72,7 @@
72;; In the Tramp CVS repository, the version numer is auto-frobbed from 72;; In the Tramp CVS repository, the version numer is auto-frobbed from
73;; the Makefile, so you should edit the top-level Makefile to change 73;; the Makefile, so you should edit the top-level Makefile to change
74;; the version number. 74;; the version number.
75(defconst tramp-version "2.0.21" 75(defconst tramp-version "2.0.22"
76 "This version of tramp.") 76 "This version of tramp.")
77 77
78(defconst tramp-bug-report-address "tramp-devel@mail.freesoftware.fsf.org" 78(defconst tramp-bug-report-address "tramp-devel@mail.freesoftware.fsf.org"
@@ -656,7 +656,7 @@ See `tramp-methods' for a list of possibilities for METHOD."
656 (unless (memq system-type '(windows-nt)) 656 (unless (memq system-type '(windows-nt))
657 '((tramp-parse-rhosts "/etc/hosts.equiv") 657 '((tramp-parse-rhosts "/etc/hosts.equiv")
658 (tramp-parse-rhosts "~/.rhosts"))) 658 (tramp-parse-rhosts "~/.rhosts")))
659 "Default list of (FUNNCTION FILE) pairs to be examined for rsh methods." 659 "Default list of (FUNCTION FILE) pairs to be examined for rsh methods."
660) 660)
661 661
662;; Default values for non-Unices seeked 662;; Default values for non-Unices seeked
@@ -668,21 +668,28 @@ See `tramp-methods' for a list of possibilities for METHOD."
668 (tramp-parse-rhosts "~/.rhosts") 668 (tramp-parse-rhosts "~/.rhosts")
669 (tramp-parse-rhosts "~/.shosts") 669 (tramp-parse-rhosts "~/.shosts")
670 (tramp-parse-shosts "~/.ssh/known_hosts"))) 670 (tramp-parse-shosts "~/.ssh/known_hosts")))
671 "Default list of (FUNNCTION FILE) pairs to be examined for ssh methods." 671 "Default list of (FUNCTION FILE) pairs to be examined for ssh methods."
672) 672)
673 673
674;; Default values for non-Unices seeked 674;; Default values for non-Unices seeked
675(defconst tramp-completion-function-alist-telnet 675(defconst tramp-completion-function-alist-telnet
676 (unless (memq system-type '(windows-nt)) 676 (unless (memq system-type '(windows-nt))
677 '((tramp-parse-hosts "/etc/hosts"))) 677 '((tramp-parse-hosts "/etc/hosts")))
678 "Default list of (FUNNCTION FILE) pairs to be examined for telnet methods." 678 "Default list of (FUNCTION FILE) pairs to be examined for telnet methods."
679) 679)
680 680
681;; Default values for non-Unices seeked 681;; Default values for non-Unices seeked
682(defconst tramp-completion-function-alist-su 682(defconst tramp-completion-function-alist-su
683 (unless (memq system-type '(windows-nt)) 683 (unless (memq system-type '(windows-nt))
684 '((tramp-parse-passwd "/etc/passwd"))) 684 '((tramp-parse-passwd "/etc/passwd")))
685 "Default list of (FUNNCTION FILE) pairs to be examined for su methods." 685 "Default list of (FUNCTION FILE) pairs to be examined for su methods."
686)
687
688;; Default values for non-Unices seeked
689(defconst tramp-completion-function-alist-ftp
690 (unless (memq system-type '(windows-nt))
691 '((tramp-parse-netrc "~/.netrc")))
692 "Default list of (FUNCTION FILE) pairs to be examined for ftp methods."
686) 693)
687 694
688(defcustom tramp-completion-function-alist 695(defcustom tramp-completion-function-alist
@@ -708,6 +715,7 @@ See `tramp-methods' for a list of possibilities for METHOD."
708 (cons "krlogin" tramp-completion-function-alist-rsh) 715 (cons "krlogin" tramp-completion-function-alist-rsh)
709 (cons "plink" tramp-completion-function-alist-ssh) 716 (cons "plink" tramp-completion-function-alist-ssh)
710 (cons "pscp" tramp-completion-function-alist-ssh) 717 (cons "pscp" tramp-completion-function-alist-ssh)
718 (cons "ftp" tramp-completion-function-alist-ftp)
711 (cons "fcp" nil) 719 (cons "fcp" nil)
712 ) 720 )
713 "*Alist of methods for remote files. 721 "*Alist of methods for remote files.
@@ -720,9 +728,7 @@ names from FILE for completion. The following predefined FUNCTIONs exists:
720 * `tramp-parse-shosts' for \"ssh_known_hosts\" like files, 728 * `tramp-parse-shosts' for \"ssh_known_hosts\" like files,
721 * `tramp-parse-hosts' for \"/etc/hosts\" like files, and 729 * `tramp-parse-hosts' for \"/etc/hosts\" like files, and
722 * `tramp-parse-passwd' for \"/etc/passwd\" like files. 730 * `tramp-parse-passwd' for \"/etc/passwd\" like files.
723 731 * `tramp-parse-netrc ' for \".netrc\" like files.
724A FUNCTION parsing \".netrc\" file syntax doesn't exist in TRAMP. This
725task is delegated to ange-ftp; its customization should be used instead.
726 732
727FUNCTION can also see a customer defined function. For more details see 733FUNCTION can also see a customer defined function. For more details see
728the info pages." 734the info pages."
@@ -934,7 +940,7 @@ Derived from `tramp-postfix-multi-hop-format'."
934 :type 'regexp) 940 :type 'regexp)
935 941
936(defcustom tramp-user-regexp 942(defcustom tramp-user-regexp
937 "[^:@/]*" 943 "[^:@/ \t]*"
938 "*Regexp matching user names." 944 "*Regexp matching user names."
939 :group 'tramp 945 :group 'tramp
940 :type 'regexp) 946 :type 'regexp)
@@ -3611,10 +3617,6 @@ Return (nil) if arg is nil."
3611 3617
3612 (let* 3618 (let*
3613 ((fullname (concat directory filename)) 3619 ((fullname (concat directory filename))
3614 ;; prepare ange-ftp fix
3615 (fix-ange-ftp-string
3616 (concat tramp-ftp-method tramp-postfix-single-method-format))
3617 (fix-ange-ftp (string-match (concat "^" fix-ange-ftp-string) filename))
3618 ;; local files 3620 ;; local files
3619 (result 3621 (result
3620 (if (tramp-completion-mode fullname) 3622 (if (tramp-completion-mode fullname)
@@ -3658,25 +3660,7 @@ Return (nil) if arg is nil."
3658 3660
3659 ;; Possible methods 3661 ;; Possible methods
3660 (setq result 3662 (setq result
3661 (append result (tramp-get-completion-methods m)))) 3663 (append result (tramp-get-completion-methods m)))))
3662
3663 ;; Ange-ftp completions.
3664 ;; Filename might have the form "ftp:xxx". Ange-ftp isn't able to
3665 ;; handle the prefix "ftp:" correctly in
3666 ;; `ange-ftp-file-name-all-completions'; it simply calls
3667 ;;`(all-completions file (ange-ftp-generate-root-prefixes))'.
3668 ;; So we must wrap around.
3669 (when (tramp-ange-ftp-file-name-p nil m)
3670 (setq result (append result
3671 (mapcar
3672 '(lambda (x) (if fix-ange-ftp (concat fix-ange-ftp-string x) x))
3673 (catch 'tramp-forward-to-ange-ftp
3674 (tramp-invoke-ange-ftp
3675 'file-name-all-completions
3676 (if fix-ange-ftp
3677 (substring filename (length fix-ange-ftp-string))
3678 filename)
3679 directory)))))))
3680 3664
3681 (setq v (delq car v)))) 3665 (setq v (delq car v))))
3682 3666
@@ -3852,13 +3836,13 @@ PARTIAL-USER must match USER, PARTIAL-HOST must match HOST."
3852 (t (setq user nil 3836 (t (setq user nil
3853 host nil))) 3837 host nil)))
3854 3838
3855 (when (or user host) 3839 (unless (zerop (+ (length user) (length host)))
3856 ;; we must remove leading "/". 3840 ;; we must remove leading "/".
3857 (substring (tramp-make-tramp-file-name nil method user host nil) 1))) 3841 (substring (tramp-make-tramp-file-name nil method user host nil) 1)))
3858 3842
3859(defun tramp-parse-rhosts (filename) 3843(defun tramp-parse-rhosts (filename)
3860 "Return a list of (user host) tuples allowed to access. 3844 "Return a list of (user host) tuples allowed to access.
3861Either user or host may be nil" 3845Either user or host may be nil."
3862 3846
3863 (let (res) 3847 (let (res)
3864 (when (file-exists-p filename) 3848 (when (file-exists-p filename)
@@ -3866,7 +3850,7 @@ Either user or host may be nil"
3866 (insert-file-contents filename) 3850 (insert-file-contents filename)
3867 (goto-char (point-min)) 3851 (goto-char (point-min))
3868 (while (not (eobp)) 3852 (while (not (eobp))
3869 (add-to-list 'res (tramp-parse-rhosts-group))))) 3853 (push (tramp-parse-rhosts-group) res))))
3870 res)) 3854 res))
3871 3855
3872;; Taken from gnus/netrc.el 3856;; Taken from gnus/netrc.el
@@ -3878,7 +3862,7 @@ Either user or host may be nil"
3878 3862
3879(defun tramp-parse-rhosts-group () 3863(defun tramp-parse-rhosts-group ()
3880 "Return a (user host) tuple allowed to access. 3864 "Return a (user host) tuple allowed to access.
3881Either user or host may be nil" 3865Either user or host may be nil."
3882 3866
3883 (let ((result) 3867 (let ((result)
3884 (regexp 3868 (regexp
@@ -3903,7 +3887,7 @@ User is always nil."
3903 (insert-file-contents filename) 3887 (insert-file-contents filename)
3904 (goto-char (point-min)) 3888 (goto-char (point-min))
3905 (while (not (eobp)) 3889 (while (not (eobp))
3906 (add-to-list 'res (tramp-parse-shosts-group))))) 3890 (push (tramp-parse-shosts-group) res))))
3907 res)) 3891 res))
3908 3892
3909(defun tramp-parse-shosts-group () 3893(defun tramp-parse-shosts-group ()
@@ -3932,7 +3916,7 @@ User is always nil."
3932 (insert-file-contents filename) 3916 (insert-file-contents filename)
3933 (goto-char (point-min)) 3917 (goto-char (point-min))
3934 (while (not (eobp)) 3918 (while (not (eobp))
3935 (add-to-list 'res (tramp-parse-hosts-group))))) 3919 (push (tramp-parse-hosts-group) res))))
3936 res)) 3920 res))
3937 3921
3938(defun tramp-parse-hosts-group () 3922(defun tramp-parse-hosts-group ()
@@ -3964,12 +3948,12 @@ Host is always \"localhost\"."
3964 (insert-file-contents filename) 3948 (insert-file-contents filename)
3965 (goto-char (point-min)) 3949 (goto-char (point-min))
3966 (while (not (eobp)) 3950 (while (not (eobp))
3967 (add-to-list 'res (tramp-parse-passwd-group))))) 3951 (push (tramp-parse-passwd-group) res))))
3968 res))) 3952 res)))
3969 3953
3970(defun tramp-parse-passwd-group () 3954(defun tramp-parse-passwd-group ()
3971 "Return a (user host) tuple allowed to access. 3955 "Return a (user host) tuple allowed to access.
3972User is always nil." 3956Host is always \"localhost\"."
3973 3957
3974 (let ((result) 3958 (let ((result)
3975 (regexp (concat "^\\(" tramp-user-regexp "\\):"))) 3959 (regexp (concat "^\\(" tramp-user-regexp "\\):")))
@@ -3981,6 +3965,36 @@ User is always nil."
3981 (forward-line 1) 3965 (forward-line 1)
3982 result)) 3966 result))
3983 3967
3968(defun tramp-parse-netrc (filename)
3969 "Return a list of (user host) tuples allowed to access.
3970User may be nil."
3971
3972 (let (res)
3973 (when (file-exists-p filename)
3974 (with-temp-buffer
3975 (insert-file-contents filename)
3976 (goto-char (point-min))
3977 (while (not (eobp))
3978 (push (tramp-parse-netrc-group) res))))
3979 res))
3980
3981(defun tramp-parse-netrc-group ()
3982 "Return a (user host) tuple allowed to access.
3983User may be nil."
3984
3985 (let ((result)
3986 (regexp
3987 (concat
3988 "^[ \t]*machine[ \t]+" "\\(" tramp-host-regexp "\\)"
3989 "\\([ \t]+login[ \t]+" "\\(" tramp-user-regexp "\\)" "\\)?")))
3990
3991 (narrow-to-region (point) (tramp-point-at-eol))
3992 (when (re-search-forward regexp nil t)
3993 (setq result (list (match-string 3) (match-string 1))))
3994 (widen)
3995 (forward-line 1)
3996 result))
3997
3984(defun tramp-completion-handle-expand-file-name (name &optional dir) 3998(defun tramp-completion-handle-expand-file-name (name &optional dir)
3985 "Like `expand-file-name' for tramp files." 3999 "Like `expand-file-name' for tramp files."
3986 (let ((fullname (concat (or dir default-directory) name))) 4000 (let ((fullname (concat (or dir default-directory) name)))
@@ -6461,7 +6475,7 @@ report.
6461;; without ":". Hmm. Worth a bug report? 6475;; without ":". Hmm. Worth a bug report?
6462;; ** Acknowledge port numbers. 6476;; ** Acknowledge port numbers.
6463;; ** Extend `tramp-get-completion-su' for NIS and shadow passwords. 6477;; ** Extend `tramp-get-completion-su' for NIS and shadow passwords.
6464;; ** Unify `tramp-parse-{rhosts,shosts,hosts,passwd}'. 6478;; ** Unify `tramp-parse-{rhosts,shosts,hosts,passwd,netrc}'.
6465;; Code is nearly identical. 6479;; Code is nearly identical.
6466;; ** Decide whiche files to take for searching user/host names depending on 6480;; ** Decide whiche files to take for searching user/host names depending on
6467;; operating system (windows-nt) in `tramp-completion-function-alist'. 6481;; operating system (windows-nt) in `tramp-completion-function-alist'.
diff --git a/man/tramp.texi b/man/tramp.texi
index c5b8e9ca7b4..f2566590411 100644
--- a/man/tramp.texi
+++ b/man/tramp.texi
@@ -12,7 +12,7 @@
12@c Makefile, so you should edit the top-level Makefile to change 12@c Makefile, so you should edit the top-level Makefile to change
13@c the version number. 13@c the version number.
14@macro trampver{} 14@macro trampver{}
152.0.21 152.0.22
16@end macro 16@end macro
17 17
18@c Entries for @command{install-info} to use 18@c Entries for @command{install-info} to use
@@ -1317,15 +1317,14 @@ host names only.
1317@item @code{tramp-parse-passwd} 1317@item @code{tramp-parse-passwd}
1318@findex tramp-parse-passwd 1318@findex tramp-parse-passwd
1319 1319
1320Finally a method which parses @file{/etc/passwd} like files. 1320A function which parses @file{/etc/passwd} like files. Obviously, it
1321Obviously, it can return user names only. 1321can return user names only.
1322@end table
1323 1322
1324@ifset emacs 1323@item @code{tramp-parse-netrc}
1325A function which parses @file{~/.netrc"} file syntax doesn't exist in 1324@findex tramp-parse-netrc
1326@tramp{}, because this task is delegated to 1325
1327@value{ftp-package-name}. Its customization should be used instead. 1326Finally, a function which parses @file{~/.netrc} like files.
1328@end ifset 1327@end table
1329 1328
1330If you want to keep your own data in a file, with your own structure, 1329If you want to keep your own data in a file, with your own structure,
1331you might provide such a function as well. This function must meet 1330you might provide such a function as well. This function must meet