The port can take any @value{tramp} method (@pxref{Inline methods},
@pxref{External methods}). Omitting port values matches all
-@value{tramp} methods.
+@value{tramp} methods. Domain and ports, as used in @value{tramp}
+file name syntax, must be appended to the machine and login items:
-Setting @code{auth-source-debug} to @code{t} to debug messages.
+@example
+machine melancholia#4711 port davs login daniel%DOMAIN password geheim
+@end example
+
+@vindex auth-source-debug
+Set @code{auth-source-debug} to @code{t} to debug messages.
@anchor{Caching passwords}
(unless (tramp-get-connection-property l "first-password-request" nil)
(tramp-clear-passwd l))
+ ;; Set variables for computing the prompt for reading password.
(setq tramp-current-method l-method
tramp-current-user user
+ tramp-current-domain l-domain
tramp-current-host l-host
+ tramp-current-port l-port
password (tramp-read-passwd
(tramp-get-connection-process l) pw-prompt))
(expand-file-name ".." tmpfile) 'recursive)
(delete-file tmpfile)))))
- ;; Set variables for computing the prompt for reading
- ;; password.
+ ;; Set variables for computing the prompt for reading password.
(setq tramp-current-method (tramp-file-name-method v)
tramp-current-user (or (tramp-file-name-user v)
(tramp-get-connection-property
v "login-as" nil))
- tramp-current-host (tramp-file-name-host v))
+ tramp-current-domain (tramp-file-name-domain v)
+ tramp-current-host (tramp-file-name-host v)
+ tramp-current-port (tramp-file-name-port v))
;; Check which ones of source and target are Tramp files.
(setq source (funcall
(let* ((hop (car target-alist))
(l-method (tramp-file-name-method hop))
(l-user (tramp-file-name-user hop))
+ (l-domain (tramp-file-name-domain hop))
(l-host (tramp-file-name-host hop))
(l-port (tramp-file-name-port hop))
(login-program
;; reading password.
(setq tramp-current-method l-method
tramp-current-user l-user
- tramp-current-host l-host)
+ tramp-current-domain l-domain
+ tramp-current-host l-host
+ tramp-current-port l-port)
;; Add login environment.
(when login-env
(if (not (file-directory-p newname))
(make-directory newname parents))
+ ;; Set variables for computing the prompt for reading password.
(setq tramp-current-method method
tramp-current-user user
- tramp-current-host host)
+ tramp-current-domain domain
+ tramp-current-host host
+ tramp-current-port port)
(let* ((share (tramp-smb-get-share v))
(localname (file-name-as-directory
(with-parsed-tramp-file-name filename nil
(with-tramp-file-property v localname "file-acl"
(when (executable-find tramp-smb-acl-program)
-
+ ;; Set variables for computing the prompt for reading password.
(setq tramp-current-method method
tramp-current-user user
- tramp-current-host host)
+ tramp-current-domain domain
+ tramp-current-host host
+ tramp-current-port port)
(let* ((share (tramp-smb-get-share v))
(localname (replace-regexp-in-string
(ignore-errors
(with-parsed-tramp-file-name filename nil
(when (and (stringp acl-string) (executable-find tramp-smb-acl-program))
+ ;; Set variables for computing the prompt for reading password.
(setq tramp-current-method method
tramp-current-user user
- tramp-current-host host)
+ tramp-current-domain domain
+ tramp-current-host host
+ tramp-current-port port)
(tramp-set-file-property v localname "file-acl" 'undef)
(let* ((share (tramp-smb-get-share v))
;; Set variables for computing the prompt for reading password.
(setq tramp-current-method tramp-smb-method
tramp-current-user user
- tramp-current-host host)
+ tramp-current-domain domain
+ tramp-current-host host
+ tramp-current-port port)
(condition-case err
(let (tramp-message-show-message)
PROC and VEC indicate the remote connection to be used. POS, if
set, is the starting point of the region to be deleted in the
connection buffer."
- ;; Enable `auth-source'. We must use tramp-current-* variables in
+ ;; Enable `auth-source'. We must use `tramp-current-*' variables in
;; case we have several hops.
(tramp-set-connection-property
- (tramp-dissect-file-name
- (tramp-make-tramp-file-name
- tramp-current-method tramp-current-user tramp-current-domain
- tramp-current-host tramp-current-port ""))
+ (make-tramp-file-name
+ :method tramp-current-method :user tramp-current-user
+ :domain tramp-current-domain :host tramp-current-host
+ :port tramp-current-port)
"first-password-request" t)
(save-restriction
(with-tramp-progress-reporter
(auth-source-search
:max 1
(and tramp-current-user :user)
- tramp-current-user
- :host tramp-current-host
+ (if tramp-current-domain
+ (format
+ "%s%s%s"
+ tramp-current-user tramp-prefix-domain-format
+ tramp-current-domain)
+ tramp-current-user)
+ :host
+ (if tramp-current-port
+ (format
+ "%s%s%s"
+ tramp-current-host tramp-prefix-port-format
+ tramp-current-port)
+ tramp-current-host)
:port tramp-current-method
:require
(cons
(let ((method (tramp-file-name-method vec))
(user (tramp-file-name-user vec))
(domain (tramp-file-name-domain vec))
+ (user-domain (tramp-file-name-user-domain vec))
(host (tramp-file-name-host vec))
(port (tramp-file-name-port vec))
+ (host-port (tramp-file-name-host-port vec))
(hop (tramp-file-name-hop vec)))
(when hop
;; Clear also the passwords of the hops.
(concat tramp-postfix-hop-regexp "$")
(tramp-postfix-host-format) hop)))))
(auth-source-forget
- `(:max 1 ,(and user :user) ,user :host ,host :port ,method))
+ `(:max 1 ,(and user-domain :user) ,user-domain
+ :host ,host-port :port ,method))
(password-cache-remove
(tramp-make-tramp-file-name method user domain host port ""))))