From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#72526: 31.0.50; [PATCH] Fix url-basic-auth secret search when passing username and/or port Date: Sun, 18 Aug 2024 08:15:47 +0300 Message-ID: <867cce1ke4.fsf@gnu.org> References: <86bk1r661g.fsf@gnu.org> <86ed6n2zld.fsf@gnu.org> <87zfpaswk4.fsf@> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="21788"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 72526@debbugs.gnu.org To: =?UTF-8?Q?Bj=C3=B6rn?= Bidar Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Aug 18 07:17:03 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1sfYHn-0005Xf-1I for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 18 Aug 2024 07:17:03 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sfYHJ-0001Nx-68; Sun, 18 Aug 2024 01:16:42 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sfYH8-0001NH-NJ for bug-gnu-emacs@gnu.org; Sun, 18 Aug 2024 01:16:22 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sfYH8-0001RP-DP for bug-gnu-emacs@gnu.org; Sun, 18 Aug 2024 01:16:22 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-version:References:In-Reply-To:From:Date:To:Subject; bh=KCaRzfwnkSzQn3QJh0Cg1+iPu0X5tGH23vm/quvdhsY=; b=IvzXO1BwbeFUnhNIJMjgESaliOXiJnpv++TNONNNfBDE9WHu/CEfghL3fLrHTfZ+91nHEkf5RRGHDivccsnWsnC3LasKZqzpnwF+IrXWXtWHnCrWwHGeVJUk9v7otpgfzk1siAi46CAcLD70My6gqF+83bDJAFpehLpVN3Uha+o8fBFZ2f0zTqBvyoP2xCdGy0IFgI8VsG255VUcDDKTGLSZKWt2w7LVt8JZ3oa5m2dIcgRQ9P5w/K1LWn15ku7/WBkj+xMR+M6mXjRDl/sSipZrq0pXYQm5pqBXckLPAeC+nQYw/H51JXBgdKdiLrPZ5pTr9ll2bH3RUurVRZqFow==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sfYHl-0001BA-T6 for bug-gnu-emacs@gnu.org; Sun, 18 Aug 2024 01:17:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 18 Aug 2024 05:17:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 72526 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 72526-submit@debbugs.gnu.org id=B72526.17239581994481 (code B ref 72526); Sun, 18 Aug 2024 05:17:01 +0000 Original-Received: (at 72526) by debbugs.gnu.org; 18 Aug 2024 05:16:39 +0000 Original-Received: from localhost ([127.0.0.1]:55259 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sfYHO-0001AB-8f for submit@debbugs.gnu.org; Sun, 18 Aug 2024 01:16:38 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:55540) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sfYHL-00019w-GS for 72526@debbugs.gnu.org; Sun, 18 Aug 2024 01:16:36 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sfYGb-0001LD-MN; Sun, 18 Aug 2024 01:15:49 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=KCaRzfwnkSzQn3QJh0Cg1+iPu0X5tGH23vm/quvdhsY=; b=EIVnd6yA0SkRELsdIiiv hGwPFESwCeg7q7no6Mxcm+kg62pIcco/K+xPgRS14ZDeteiyUR7FUOhws0VQbolpLF3IQYu9Mm+xG 9i4ECA2AdCXeGVMq0sYNGCtr5wEgoen1kWyUukncyNubO0tN7NBPbGTiRqgnR8TaT+vj07COxpl1O 3za0z3873r93Bog4PN4xSow+EgVEXijJF83wzqexSPcnpgmEDFlZl9zxsON4YJvSpQr8XfNZozyVS /7xsILikCoA4DJrSO2lwC661Y7ggOPeo3ygRmWdM53JE+jYE7arH44PNVJ5BQbdTw85KJGaoFJ8r9 8OntJD0ZeSIUaQ==; In-Reply-To: <87zfpaswk4.fsf@> (message from =?UTF-8?Q?Bj=C3=B6rn?= Bidar on Sat, 17 Aug 2024 23:50:51 +0300) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:290292 Archived-At: > From: Björn Bidar > Cc: 72526@debbugs.gnu.org > Date: Sat, 17 Aug 2024 23:50:51 +0300 > > Eli Zaretskii writes: > > >> > Sorry, I don't see any experts around to ask to do that. > >> > >> Maybe the maintainer of the url package? > > > > Whom did you have in mind? url.el says "emacs-devel", which is > > basically no one and everyone. > > I don't know, the person that usually deals with the package? I couldn't find him or her in the recent logs. I concluded we didn't have such a person/ > >> > Maybe if you'd posted a more detailed description of the problem and > >> > its context, someone could follow your arguments and do a meaningful > >> > review. E.g., it sounds from your description like the case of URLs > >> > where it currently fails was not meant to be supported by this > >> > library? If so, perhaps an alternative is to submit to this library > >> > only URLs that it supports, like after stripping the port part? > >> > >> The problem is that the user in url-basic-auth when handling urls like ://@ isn't > >> forwarded to auth-source. Further it also appends to port to the > >> hostname of host which means that the host is invalid since the hostname > >> includes the port number. > >> > >> >From what I read when looking at url-auth.el at line 84 it does support > >> this kind of case of url as it already handles the same type of url when > >> it deals with ://:@. > > > > So how come this code was not fixed since the day it was added to > > Emacs, so long ago? > > I don't know I assume it was never an issue at that time? > In any case amending the port to the :host key seems like a bug to me. > Similarly when the user specifies the user in the url it should be > passed to auth-source so it can find the credentials. So please take me through your changes with more detailed explanations, without assuming I know my way around this code. A few things bother me just by looking at the diffs: (1) why do we need to calculate 'server' more than once using the same code in the same function, and (2) will auth-source-search as called in url-do-auth-source-search DTRT when called with ':user nil', which will happen if the last argument is omitted. I also wonder what is the semantics of the call to auth-source-search in the current code where the user is omitted. AFAIU, in that case Emacs will prompt the user for username? If so, why is it a good idea to pass to auth-source-search USER derived by url-basic-auth, instead of prompting? IOW, I'd like to open what the current code and your changes do for a more detailed discussion, so we could be sure the change is TRT before we decide what changes to install. Thanks.