emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/lisp/net/tramp.el


From: Kai Großjohann
Subject: [Emacs-diffs] Changes to emacs/lisp/net/tramp.el
Date: Sun, 22 Sep 2002 13:39:18 -0400

Index: emacs/lisp/net/tramp.el
diff -c emacs/lisp/net/tramp.el:1.25 emacs/lisp/net/tramp.el:1.26
*** emacs/lisp/net/tramp.el:1.25        Sun Sep 22 09:55:13 2002
--- emacs/lisp/net/tramp.el     Sun Sep 22 13:39:18 2002
***************
*** 72,78 ****
  ;; In the Tramp CVS repository, the version numer is auto-frobbed from
  ;; the Makefile, so you should edit the top-level Makefile to change
  ;; the version number.
! (defconst tramp-version "2.0.21"
    "This version of tramp.")
  
  (defconst tramp-bug-report-address "address@hidden"
--- 72,78 ----
  ;; In the Tramp CVS repository, the version numer is auto-frobbed from
  ;; the Makefile, so you should edit the top-level Makefile to change
  ;; the version number.
! (defconst tramp-version "2.0.22"
    "This version of tramp.")
  
  (defconst tramp-bug-report-address "address@hidden"
***************
*** 656,662 ****
    (unless (memq system-type '(windows-nt))
      '((tramp-parse-rhosts "/etc/hosts.equiv")
        (tramp-parse-rhosts "~/.rhosts")))
!   "Default list of (FUNNCTION FILE) pairs to be examined for rsh methods."
  )
  
  ;; Default values for non-Unices seeked
--- 656,662 ----
    (unless (memq system-type '(windows-nt))
      '((tramp-parse-rhosts "/etc/hosts.equiv")
        (tramp-parse-rhosts "~/.rhosts")))
!   "Default list of (FUNCTION FILE) pairs to be examined for rsh methods."
  )
  
  ;; Default values for non-Unices seeked
***************
*** 668,688 ****
        (tramp-parse-rhosts "~/.rhosts")
        (tramp-parse-rhosts "~/.shosts")
        (tramp-parse-shosts "~/.ssh/known_hosts")))
!   "Default list of (FUNNCTION FILE) pairs to be examined for ssh methods."
  )
  
  ;; Default values for non-Unices seeked
  (defconst tramp-completion-function-alist-telnet
    (unless (memq system-type '(windows-nt))
      '((tramp-parse-hosts "/etc/hosts")))
!   "Default list of (FUNNCTION FILE) pairs to be examined for telnet methods."
  )
  
  ;; Default values for non-Unices seeked
  (defconst tramp-completion-function-alist-su
    (unless (memq system-type '(windows-nt))
      '((tramp-parse-passwd "/etc/passwd")))
!   "Default list of (FUNNCTION FILE) pairs to be examined for su methods."
  )
  
  (defcustom tramp-completion-function-alist
--- 668,695 ----
        (tramp-parse-rhosts "~/.rhosts")
        (tramp-parse-rhosts "~/.shosts")
        (tramp-parse-shosts "~/.ssh/known_hosts")))
!   "Default list of (FUNCTION FILE) pairs to be examined for ssh methods."
  )
  
  ;; Default values for non-Unices seeked
  (defconst tramp-completion-function-alist-telnet
    (unless (memq system-type '(windows-nt))
      '((tramp-parse-hosts "/etc/hosts")))
!   "Default list of (FUNCTION FILE) pairs to be examined for telnet methods."
  )
  
  ;; Default values for non-Unices seeked
  (defconst tramp-completion-function-alist-su
    (unless (memq system-type '(windows-nt))
      '((tramp-parse-passwd "/etc/passwd")))
!   "Default list of (FUNCTION FILE) pairs to be examined for su methods."
! )
! 
! ;; Default values for non-Unices seeked
! (defconst tramp-completion-function-alist-ftp
!   (unless (memq system-type '(windows-nt))
!     '((tramp-parse-netrc "~/.netrc")))
!   "Default list of (FUNCTION FILE) pairs to be examined for ftp methods."
  )
  
  (defcustom tramp-completion-function-alist
***************
*** 708,713 ****
--- 715,721 ----
        (cons "krlogin"  tramp-completion-function-alist-rsh)
        (cons "plink"    tramp-completion-function-alist-ssh)
        (cons "pscp"     tramp-completion-function-alist-ssh)
+       (cons "ftp"      tramp-completion-function-alist-ftp)
        (cons "fcp"      nil)
       )
    "*Alist of methods for remote files.
***************
*** 720,728 ****
   * `tramp-parse-shosts' for \"ssh_known_hosts\" like files,
   * `tramp-parse-hosts'  for \"/etc/hosts\" like files, and
   * `tramp-parse-passwd' for \"/etc/passwd\" like files.
! 
! A FUNCTION parsing \".netrc\" file syntax doesn't exist in TRAMP. This
! task is delegated to ange-ftp; its customization should be used instead.
  
  FUNCTION can also see a customer defined function.  For more details see
  the info pages."
--- 728,734 ----
   * `tramp-parse-shosts' for \"ssh_known_hosts\" like files,
   * `tramp-parse-hosts'  for \"/etc/hosts\" like files, and
   * `tramp-parse-passwd' for \"/etc/passwd\" like files.
!  * `tramp-parse-netrc ' for \".netrc\" like files.
  
  FUNCTION can also see a customer defined function.  For more details see
  the info pages."
***************
*** 934,940 ****
    :type 'regexp)
  
  (defcustom tramp-user-regexp
!   "[^:@/]*"
    "*Regexp matching user names."
    :group 'tramp
    :type 'regexp)
--- 940,946 ----
    :type 'regexp)
  
  (defcustom tramp-user-regexp
!   "[^:@/ \t]*"
    "*Regexp matching user names."
    :group 'tramp
    :type 'regexp)
***************
*** 3611,3620 ****
  
    (let*
        ((fullname (concat directory filename))
-        ;; prepare ange-ftp fix
-        (fix-ange-ftp-string
-       (concat tramp-ftp-method tramp-postfix-single-method-format))
-        (fix-ange-ftp (string-match (concat "^" fix-ange-ftp-string) filename))
         ;; local files
         (result
        (if (tramp-completion-mode fullname)
--- 3617,3622 ----
***************
*** 3658,3682 ****
  
            ;; Possible methods
            (setq result
!                 (append result (tramp-get-completion-methods m))))
! 
!         ;; Ange-ftp completions.
!         ;; Filename might have the form "ftp:xxx". Ange-ftp isn't able to
!         ;; handle the prefix "ftp:" correctly in
!         ;; `ange-ftp-file-name-all-completions'; it simply calls 
!         ;;`(all-completions file (ange-ftp-generate-root-prefixes))'.
!         ;; So we must wrap around.
!         (when (tramp-ange-ftp-file-name-p nil m)
!           (setq result (append result
!             (mapcar
!              '(lambda (x) (if fix-ange-ftp (concat fix-ange-ftp-string x) x))
!              (catch 'tramp-forward-to-ange-ftp
!                (tramp-invoke-ange-ftp
!                 'file-name-all-completions
!                 (if fix-ange-ftp
!                     (substring filename (length fix-ange-ftp-string))
!                   filename)
!                 directory)))))))
  
        (setq v (delq car v))))
  
--- 3660,3666 ----
  
            ;; Possible methods
            (setq result
!                 (append result (tramp-get-completion-methods m)))))
  
        (setq v (delq car v))))
  
***************
*** 3852,3864 ****
     (t (setq user nil
            host nil)))
  
!   (when (or user host)
      ;; we must remove leading "/".
      (substring (tramp-make-tramp-file-name nil method user host nil) 1)))
  
  (defun tramp-parse-rhosts (filename)
    "Return a list of (user host) tuples allowed to access.
! Either user or host may be nil"
  
    (let (res)
      (when (file-exists-p filename)
--- 3836,3848 ----
     (t (setq user nil
            host nil)))
  
!   (unless (zerop (+ (length user) (length host)))
      ;; we must remove leading "/".
      (substring (tramp-make-tramp-file-name nil method user host nil) 1)))
  
  (defun tramp-parse-rhosts (filename)
    "Return a list of (user host) tuples allowed to access.
! Either user or host may be nil."
  
    (let (res)
      (when (file-exists-p filename)
***************
*** 3866,3872 ****
        (insert-file-contents filename)
        (goto-char (point-min))
        (while (not (eobp))
!         (add-to-list 'res (tramp-parse-rhosts-group)))))
      res))
  
  ;; Taken from gnus/netrc.el
--- 3850,3856 ----
        (insert-file-contents filename)
        (goto-char (point-min))
        (while (not (eobp))
!         (push (tramp-parse-rhosts-group) res))))
      res))
  
  ;; Taken from gnus/netrc.el
***************
*** 3878,3884 ****
  
  (defun tramp-parse-rhosts-group ()
     "Return a (user host) tuple allowed to access.
! Either user or host may be nil"
  
     (let ((result)
         (regexp
--- 3862,3868 ----
  
  (defun tramp-parse-rhosts-group ()
     "Return a (user host) tuple allowed to access.
! Either user or host may be nil."
  
     (let ((result)
         (regexp
***************
*** 3903,3909 ****
        (insert-file-contents filename)
        (goto-char (point-min))
        (while (not (eobp))
!         (add-to-list 'res (tramp-parse-shosts-group)))))
      res))
  
  (defun tramp-parse-shosts-group ()
--- 3887,3893 ----
        (insert-file-contents filename)
        (goto-char (point-min))
        (while (not (eobp))
!         (push (tramp-parse-shosts-group) res))))
      res))
  
  (defun tramp-parse-shosts-group ()
***************
*** 3932,3938 ****
        (insert-file-contents filename)
        (goto-char (point-min))
        (while (not (eobp))
!         (add-to-list 'res (tramp-parse-hosts-group)))))
      res))
  
  (defun tramp-parse-hosts-group ()
--- 3916,3922 ----
        (insert-file-contents filename)
        (goto-char (point-min))
        (while (not (eobp))
!         (push (tramp-parse-hosts-group) res))))
      res))
  
  (defun tramp-parse-hosts-group ()
***************
*** 3964,3975 ****
          (insert-file-contents filename)
          (goto-char (point-min))
          (while (not (eobp))
!           (add-to-list 'res (tramp-parse-passwd-group)))))
        res)))
  
  (defun tramp-parse-passwd-group ()
     "Return a (user host) tuple allowed to access.
! User is always nil."
  
     (let ((result)
         (regexp (concat "^\\(" tramp-user-regexp "\\):")))
--- 3948,3959 ----
          (insert-file-contents filename)
          (goto-char (point-min))
          (while (not (eobp))
!           (push (tramp-parse-passwd-group) res))))
        res)))
  
  (defun tramp-parse-passwd-group ()
     "Return a (user host) tuple allowed to access.
! Host is always \"localhost\"."
  
     (let ((result)
         (regexp (concat "^\\(" tramp-user-regexp "\\):")))
***************
*** 3981,3986 ****
--- 3965,4000 ----
       (forward-line 1)
       result))
  
+ (defun tramp-parse-netrc (filename)
+   "Return a list of (user host) tuples allowed to access.
+ User may be nil."
+ 
+   (let (res)
+     (when (file-exists-p filename)
+       (with-temp-buffer
+       (insert-file-contents filename)
+       (goto-char (point-min))
+       (while (not (eobp))
+         (push (tramp-parse-netrc-group) res))))
+     res))
+ 
+ (defun tramp-parse-netrc-group ()
+    "Return a (user host) tuple allowed to access.
+ User may be nil."
+ 
+    (let ((result)
+        (regexp
+         (concat
+          "^[ \t]*machine[ \t]+" "\\(" tramp-host-regexp "\\)"
+          "\\([ \t]+login[ \t]+" "\\(" tramp-user-regexp "\\)" "\\)?")))
+ 
+      (narrow-to-region (point) (tramp-point-at-eol))
+      (when (re-search-forward regexp nil t)
+        (setq result (list (match-string 3) (match-string 1))))
+      (widen)
+      (forward-line 1)
+      result))
+ 
  (defun tramp-completion-handle-expand-file-name (name &optional dir)
    "Like `expand-file-name' for tramp files."
    (let ((fullname (concat (or dir default-directory) name)))
***************
*** 6461,6467 ****
  ;;    without ":". Hmm. Worth a bug report?
  ;; ** Acknowledge port numbers.
  ;; ** Extend `tramp-get-completion-su' for NIS and shadow passwords.
! ;; ** Unify `tramp-parse-{rhosts,shosts,hosts,passwd}'.
  ;;    Code is nearly identical.
  ;; ** Decide whiche files to take for searching user/host names depending on
  ;;    operating system (windows-nt) in `tramp-completion-function-alist'.
--- 6475,6481 ----
  ;;    without ":". Hmm. Worth a bug report?
  ;; ** Acknowledge port numbers.
  ;; ** Extend `tramp-get-completion-su' for NIS and shadow passwords.
! ;; ** Unify `tramp-parse-{rhosts,shosts,hosts,passwd,netrc}'.
  ;;    Code is nearly identical.
  ;; ** Decide whiche files to take for searching user/host names depending on
  ;;    operating system (windows-nt) in `tramp-completion-function-alist'.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]