From e8709e790006c75e1c91dbf0d50d5dbc816329f6 Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Fri, 10 May 2019 14:48:07 +0200 Subject: [PATCH] Handle subdomains in Tramp ad-hoc proxies * lisp/net/tramp-sh.el (tramp-compute-multi-hops): Add proper regexps to `tramp-default-proxies-alist'. --- lisp/net/tramp-sh.el | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index b9df4033098..95fa61af983 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el @@ -4622,21 +4622,19 @@ Goes through the list `tramp-inline-compress-commands'." ;; Ad-hoc proxy definitions. (dolist (proxy (reverse (split-string hops tramp-postfix-hop-regexp 'omit))) - (let ((user-domain (tramp-file-name-user-domain item)) - (host-port (tramp-file-name-host-port item)) - (proxy (concat - tramp-prefix-format proxy tramp-postfix-host-format))) - (tramp-message - vec 5 "Add proxy (\"%s\" \"%s\" \"%s\")" - (and (stringp host-port) (regexp-quote host-port)) - (and (stringp user-domain) (regexp-quote user-domain)) - proxy) + (let* ((host-port (tramp-file-name-host-port item)) + (user-domain (tramp-file-name-user-domain item)) + (proxy (concat + tramp-prefix-format proxy tramp-postfix-host-format)) + (entry + (list (and (stringp host-port) + (concat "^" (regexp-quote host-port) "$")) + (and (stringp user-domain) + (concat "^" (regexp-quote user-domain) "$")) + (propertize proxy 'tramp-ad-hoc t)))) + (tramp-message vec 5 "Add %S to `tramp-default-proxies-alist'" entry) ;; Add the hop. - (add-to-list - 'tramp-default-proxies-alist - (list (and (stringp host-port) (regexp-quote host-port)) - (and (stringp user-domain) (regexp-quote user-domain)) - (propertize proxy 'tramp-ad-hoc t))) + (add-to-list 'tramp-default-proxies-alist entry) (setq item (tramp-dissect-file-name proxy)))) ;; Save the new value. (when (and hops tramp-save-ad-hoc-proxies) -- 2.39.2