2351 |
;; Method, host, etc, are unchanged. Does it make sense to try |
;; Method, host, etc, are unchanged. Does it make sense to try |
2352 |
;; to avoid parsing the filename? |
;; to avoid parsing the filename? |
2353 |
(with-parsed-tramp-file-name directory nil |
(with-parsed-tramp-file-name directory nil |
2354 |
(if (and (eq (aref path (1- (length path))) ?/) |
(if (and (not (zerop (length path))) |
2355 |
|
(eq (aref path (1- (length path))) ?/) |
2356 |
(not (string= path "/"))) |
(not (string= path "/"))) |
2357 |
(substring directory 0 -1) |
(substring directory 0 -1) |
2358 |
directory))) |
directory))) |
3627 |
(host (tramp-file-name-host car)) |
(host (tramp-file-name-host car)) |
3628 |
(path (tramp-file-name-path car)) |
(path (tramp-file-name-path car)) |
3629 |
(m (tramp-find-method multi-method method user host)) |
(m (tramp-find-method multi-method method user host)) |
3630 |
|
(tramp-current-user user) ; see `tramp-parse-passwd' |
3631 |
all-user-hosts) |
all-user-hosts) |
3632 |
|
|
3633 |
(unless (or multi-method ;; Not handled (yet). |
(unless (or multi-method ;; Not handled (yet). |
3955 |
(forward-line 1)) |
(forward-line 1)) |
3956 |
result)) |
result)) |
3957 |
|
|
3958 |
|
;; For su-alike methods it would be desirable to return "root@localhost" |
3959 |
|
;; as default. Unfortunately, we have no information whether any user name |
3960 |
|
;; has been typed already. So we (mis-)use tramp-current-user as indication, |
3961 |
|
;; assuming it is set in `tramp-completion-handle-file-name-all-completions'. |
3962 |
(defun tramp-parse-passwd (filename) |
(defun tramp-parse-passwd (filename) |
3963 |
"Return a list of (user host) tuples allowed to access. |
"Return a list of (user host) tuples allowed to access. |
3964 |
Host is always \"localhost\"." |
Host is always \"localhost\"." |
3965 |
|
|
3966 |
(let (res) |
(let (res) |
3967 |
(if (and (symbolp 'user) (zerop (length user))) |
(if (zerop (length tramp-current-user)) |
3968 |
'(("root" nil)) |
'(("root" nil)) |
3969 |
(when (file-readable-p filename) |
(when (file-readable-p filename) |
3970 |
(with-temp-buffer |
(with-temp-buffer |
5618 |
(tramp-get-buffer multi-method method user host)))) |
(tramp-get-buffer multi-method method user host)))) |
5619 |
(unless proc |
(unless proc |
5620 |
(error "Can't send region to remote host -- not logged in")) |
(error "Can't send region to remote host -- not logged in")) |
5621 |
(if tramp-chunksize |
(if (not (zerop tramp-chunksize)) |
5622 |
(let ((pos start)) |
(let ((pos start)) |
5623 |
(while (< pos end) |
(while (< pos end) |
5624 |
(tramp-message-for-buffer |
(tramp-message-for-buffer |