From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?UTF-8?Q?Bj=C3=B6rn?= Bidar via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#72526: 31.0.50; [PATCH] Fix url-basic-auth secret search when passing username and/or port Date: Mon, 19 Aug 2024 09:54:09 +0300 Message-ID: <4807.1234415815$1724050513@news.gmane.org> References: <86bk1r661g.fsf@gnu.org> <86ed6n2zld.fsf@gnu.org> <867cce1ke4.fsf@gnu.org> <86ikvyynwg.fsf@gnu.org> Reply-To: =?UTF-8?Q?Bj=C3=B6rn?= Bidar Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="7451"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 72526@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Aug 19 08:55:05 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 1sfwID-0001nW-8C for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 19 Aug 2024 08:55:05 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sfwHn-0003GR-5z; Mon, 19 Aug 2024 02:54:39 -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 1sfwHV-0003Fz-Cy for bug-gnu-emacs@gnu.org; Mon, 19 Aug 2024 02:54:21 -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 1sfwHV-0006sq-3l for bug-gnu-emacs@gnu.org; Mon, 19 Aug 2024 02:54:21 -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:Date:References:In-Reply-To:From:To:Subject; bh=jAOh+hBCJJO+8vIz2/Tk0LIBSyd32oTZ5Ey6rjlZUL4=; b=a42sX0RFgPcfjUdqmitj8JDljUf87ATzEomlGeFOwVkgMqTDNkbGI3o5NN+A85BEQQ5ETVb6Ts4mBvMuWTUMObtknmi5utpkV0StclDNjErsj0UwyIzaVERRy/Nu+KghU6ZJsrmobIZa+KQH2d4zqXSO52Hex36MPuemstSKEQaak4X4p8rhTdtDM844BUXne017IWEWyuj++X0gq0A8MKQti+T9WVXtftH5VTjnRZ1i9zv76+10SzDmWggjy2Urseccl5vHkH+t9xJI64Ca4IfX6kJnCtsQsskhzr4hllEB1uoBGL/Fgfbh8YKKi9gBICuubbcGPpkFkDPGCVnprg==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sfwI9-0001pP-UW for bug-gnu-emacs@gnu.org; Mon, 19 Aug 2024 02:55:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: =?UTF-8?Q?Bj=C3=B6rn?= Bidar Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 19 Aug 2024 06:55: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.17240505007016 (code B ref 72526); Mon, 19 Aug 2024 06:55:01 +0000 Original-Received: (at 72526) by debbugs.gnu.org; 19 Aug 2024 06:55:00 +0000 Original-Received: from localhost ([127.0.0.1]:57528 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sfwI8-0001p6-2l for submit@debbugs.gnu.org; Mon, 19 Aug 2024 02:55:00 -0400 Original-Received: from thaodan.de ([185.216.177.71]:40938) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sfwI5-0001on-Qs for 72526@debbugs.gnu.org; Mon, 19 Aug 2024 02:54:59 -0400 Original-Received: from odin (dsl-trebng12-50dc75-154.dhcp.inet.fi [80.220.117.154]) by thaodan.de (Postfix) with ESMTPSA id 4FA5ED00057; Mon, 19 Aug 2024 09:54:10 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=thaodan.de; s=mail; t=1724050450; bh=nqN7Z/KqDPj932agPe5WjYCfVFE9jW7WsoQZbs38wZA=; h=From:To:Cc:Subject:In-Reply-To:References:Date; b=yXxlLb4hx6XbnMVlrRZdTtF7OK5mJzoa12Z0VKjin6zhpCZZv4dshAkmqNdfwTu9R rcxr/TfU6ra0+b3XSoAjcK7Qr94rBXO+UXOm+jXvFge2FAKdYsWXKKZVOV2bkDpLkI G4pxeAyE6Pccvq/aMlWkT09k/p96h/fstyCzkyF9N/9CRutW7eB5J8odoqRojeeyzl En0Rx5MQT/3XKltos/meotOGF8Y1zA6Mzi6TCefbuc58XtjSCXXE5S64/YPpnqqhBU wNH5qPOiYJIWCXA3hTWXlg981unH/uXTKeEAoRMvRQxNzhsZE1H1MkychTXEIuOXlr 4UCqTPCcdxxnwQZ3v27QqWniowt1Ab5usYv7oQjG+wi2ODs6PlAxE+nqvu9VnQdPOX ochfMbdZxqqvxoGtKg/ADL7GW89KWEgaOdnUisufLH+fJTDWqbI7c5jRf8AACMZ7nZ KrzH75zsJ2z2LkIBy52abib9HggSTI2x8Y7c9+AXgR150oKkWOhsUjL5QuqFNUWioW wJKahQGHkMoJu0NgFS+oBgE/X0j0NwZPJp5JhIfk+CIhtIeI5r11lxYFRs0VjGlKAP EFcj8hvltNEKzsY3h2I0rYenIs/m1ozCUx1WKOxBY48eYyy+PIl0kIsJWTACKQ9/+d Yb6BdWqqcveZ265wnCckhrL8= In-Reply-To: <86ikvyynwg.fsf@gnu.org> (Eli Zaretskii's message of "Sun, 18 Aug 2024 16:13:35 +0300") Autocrypt: addr=bjorn.bidar@thaodan.de; prefer-encrypt=nopreference; keydata= mDMEZNfpPhYJKwYBBAHaRw8BAQdACBEmr+0xwIIHZfIDlZmm7sa+lHHSb0g9FZrN6qE6ru60JUJq w7ZybiBCaWRhciA8Ympvcm4uYmlkYXJAdGhhb2Rhbi5kZT6IlgQTFgoAPgIbAwULCQgHAgIiAgYV CgkICwIEFgIDAQIeBwIXgBYhBFHxdut1RzAepymoq1wbdKFlHF9oBQJk1/YmAhkBAAoJEFwbdKFl HF9oB9cBAJoIIGQKXm4cpap+Flxc/EGnYl0123lcEyzuduqvlDT0AQC3OlFKm/OiqJ8IMTrzJRZ8 phFssTkSrrFXnM2jm5PYDoiTBBMWCgA7FiEEUfF263VHMB6nKairXBt0oWUcX2gFAmTX6T4CGwMF CwkIBwICIgIGFQoJCAsCBBYCAwECHgcCF4AACgkQXBt0oWUcX2hbCQEAtru7kvM8hi8zo6z9ux2h K+B5xViKuo7Z8K3IXuK5ugwA+wUfKzomzdBPhfxDsqLcEziGRxoyx0Q3ld9aermBUccHtBxCasO2 cm4gQmlkYXIgPG1lQHRoYW9kYW4uZGU+iJMEExYKADsCGwMFCwkIBwICIgIGFQoJCAsCBBYCAwEC HgcCF4AWIQRR8XbrdUcwHqcpqKtcG3ShZRxfaAUCZNf2FQAKCRBcG3ShZRxfaCzSAP4hZ7cSp0YN XYpcjHdsySh2MuBhhoPeLGXs+2kSiqBiOwD/TP8AgPEg/R+SI9GI9on7fBJJ0mp2IT8kZ2rhDOjg gA6IkwQTFgoAOxYhBFHxdut1RzAepymoq1wbdKFlH 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:290371 Archived-At: Eli Zaretskii writes: >> From: Bj=C3=B6rn Bidar >> Cc: 72526@debbugs.gnu.org >> Date: Sun, 18 Aug 2024 15:30:22 +0300 >>=20 >> Eli Zaretskii writes: >>=20 >> 1. url-basic-auth-store uses the 'server' as in the ':' in >> url-basic-auth-storage. I did not want to change the existing format >> as I don't know the implications. > > Can you calculate a separate variable once, and then use 'server' and > that new variable, each one where appropriate? It simply doesn't look > clean to recalculate the same value several times. > >> 2. I tested calling auth-source-search with :user nil and without :user >> in both cases the result was the same, from this I imply that calling >> auth-source-search with :user nil is ok. > > Wouldn't it be cleaner to omit :user if the value is nil? It would, how would one do such thing in lisp except of course having two separate calls one with :user and one without :user. For C it would be normal to just pass NULL if the argument is optional (beginner in lisp). >> Yes if auth-source-search doesn't find a user for the url >> url-basic-auth will prompt the user for a user. >> Why is it a good idea to derive the user by url-basic-auth? >> Because HTTP basic authentication uses the as specific in RFC 3986 >> section 3.2.1. Using it in this function to infer the user from the >> url just follows the standard as already in other programs/Emacs >> packages. >> If the user has specified the username they want to identify with >> at the server asking for it would be redundant and not confirming to >> the standard. > > What does the current code do in that case? Does it completely fail, > or does it prompt for the username? If the latter, it would be a > change in behavior, won't it? Currently it does ask for the user even if the caller sends the user in the url. It would be change of behavior, however it is expected that the user is used in HTTP basic authentication if the the url is 'http://user@host'. I don't think any caller would call the function in such a way without expecting that user is the username used in the call. >> PS: Reading your message was quite hard as a non-native speaker of >> English, had to search so many of the acronyms. > > Sorry about that. (I'm not a native English speaker, either.) Np, I was wondering if you are (your last name did sound interesting).