1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-24 07:20:37 +00:00

Fix secret search with basic auth with a port in URL

* lisp/url/url-auth.el (url-basic-auth): Fix retrieving of
secrets when the URL contains a port.  Amending the port to
server breaks 'auth-source-search' matching for :host which
is redundant as it already specified in :port.  (Bug#72526)
This commit is contained in:
Björn Bidar 2024-08-08 17:31:20 +03:00 committed by Eli Zaretskii
parent 632cc76fb5
commit a7a22e7c22

View File

@ -72,8 +72,7 @@ instead of the filename inheritance method."
(pass (url-password href))
(enable-recursive-minibuffers t) ; for url-handler-mode (bug#10298)
byserv retval data)
(setq server (format "%s:%d" server port)
file (cond
(setq file (cond
(realm realm)
((string= "" file) "/")
((string-match "/$" file) file)
@ -94,6 +93,7 @@ instead of the filename inheritance method."
(url-do-auth-source-search server type :secret)
(and (url-interactive-p)
(read-passwd "Password: " nil (or pass "")))))
(setq server (format "%s:%d" server port))
(set url-basic-auth-storage
(cons (list server
(cons file
@ -129,6 +129,7 @@ instead of the filename inheritance method."
(url-do-auth-source-search server type :secret)
(and (url-interactive-p)
(read-passwd "Password: ")))
server (format "%s:%d" server port)
retval (base64-encode-string (format "%s:%s" user pass) t)
byserv (assoc server (symbol-value url-basic-auth-storage)))
(setcdr byserv