From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Duncan Bayne Newsgroups: gmane.emacs.bugs Subject: bug#45711: 27.1; Ambiguous account match in .authinfo still used by smtpmail Date: Sun, 10 Jan 2021 10:30:13 +1100 Message-ID: <875z45adtm.fsf@bayne.id.au> References: <87lfd5osiu.fsf@bayne.id.au> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="27817"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: mu4e 1.4.13; emacs 27.1 Cc: 45711@debbugs.gnu.org To: Ted Zlatanov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Jan 10 00:31:32 2021 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 1kyNhi-00077c-Nu for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 10 Jan 2021 00:31:31 +0100 Original-Received: from localhost ([::1]:36440 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kyNhh-0002W7-Oa for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 09 Jan 2021 18:31:29 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:40598) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kyNhG-0002Sz-Sg for bug-gnu-emacs@gnu.org; Sat, 09 Jan 2021 18:31:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:41190) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kyNhG-0002mF-Is for bug-gnu-emacs@gnu.org; Sat, 09 Jan 2021 18:31:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kyNhG-0003U4-Ft for bug-gnu-emacs@gnu.org; Sat, 09 Jan 2021 18:31:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Duncan Bayne Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 09 Jan 2021 23:31:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 45711 X-GNU-PR-Package: emacs Original-Received: via spool by 45711-submit@debbugs.gnu.org id=B45711.161023503413349 (code B ref 45711); Sat, 09 Jan 2021 23:31:02 +0000 Original-Received: (at 45711) by debbugs.gnu.org; 9 Jan 2021 23:30:34 +0000 Original-Received: from localhost ([127.0.0.1]:52736 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kyNgn-0003TF-P7 for submit@debbugs.gnu.org; Sat, 09 Jan 2021 18:30:34 -0500 Original-Received: from wout5-smtp.messagingengine.com ([64.147.123.21]:56707) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kyNgl-0003T1-EK for 45711@debbugs.gnu.org; Sat, 09 Jan 2021 18:30:32 -0500 Original-Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id DC2862153; Sat, 9 Jan 2021 18:30:24 -0500 (EST) Original-Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Sat, 09 Jan 2021 18:30:25 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bayne.id.au; h= references:from:to:cc:subject:in-reply-to:message-id:date :mime-version:content-type; s=fm2; bh=nNvEiBnHEIYOfLxsh62X8qAC0N jRr9nefFt7ugjA+cI=; b=vYHF12yYc6NrqEX6ty8tRvsVFKVq94PLs4pKPylcWj JNISEQsUPi8/jWcA6HyqHle4qyvgvoCBBMVYn08L+gNNYp7mURvNcqaE8AoUahwH JDSqhErrfEwo0lMs4v+HCKCt12+qjp5ocH4N96bw+mZ1tcMhjolW/Ppn2D10Si1z 5yGhldrqDifPjWvLXg7li6BIT44bhnnVYRksDTeT2KBj1K0h8etXS/T/UCIjuFwg P7uB6NWZUK0OeZ9jCtn/W+w7zSVEZn6sIMzSQcyH+RwTAPbf4wr3weWJoMXPnhAq vPhu5lVqrNstvZKEyS5WU65fbww5N0liJsDlKRLA7Rag== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=nNvEiB nHEIYOfLxsh62X8qAC0NjRr9nefFt7ugjA+cI=; b=JUG7rQgY3QWQ5HfKZNgEGC nUZbdG1qXZUSK59HY6AG4xM/2TX0RfewVZgbh3cs1Cdf2flPUe7cR+eMxKQUic6s QInNh6B0wsWhXWZqLtLxqHvbvKVgT/WH7r9QQBDdn0T/W7zUDGYs8wOFjeAnG7w8 LLlBEWt8/OJDz1JU503KngoMnzG+cNUHDPTO3ParnS7zaiR+saqQ6ogGzLPgBNUF LUIEvi09p++OemplmDmmDuehNqSoycvK+JeAQw+hRL2vLyFfx5a76nesNAP5VNxT 71ZlrGWvdNwqyRLXesWRwfcRYeXcNx+XDhxqm9xEegML8tU6Hw4vI7Jxtxst/Djw == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrvdegkedguddtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpehffgfhvffujgfkffggtgesthdtre dttdertdenucfhrhhomhepffhunhgtrghnuceurgihnhgvuceoughunhgtrghnsegsrgih nhgvrdhiugdrrghuqeenucggtffrrghtthgvrhhnpefhgfelffevuddtvdffkeefvdduge euveelhfevteehiefhgeegjeefgfduvdfgleenucffohhmrghinhepsggrhihnvgdrihgu rdgruhenucfkphepuddutddrudejgedrudekfedruddufeenucevlhhushhtvghrufhiii gvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpeguuhhntggrnhessggrhihnvgdrihgu rdgruh X-ME-Proxy: Original-Received: from duncan-w540 (110-174-183-113.tpgi.com.au [110.174.183.113]) by mail.messagingengine.com (Postfix) with ESMTPA id 8A7C624005B; Sat, 9 Jan 2021 18:30:22 -0500 (EST) In-reply-to: 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" Xref: news.gmane.io gmane.emacs.bugs:197575 Archived-At: Ted Zlatanov writes: > On Thu, 07 Jan 2021 23:12:09 +1100 Duncan Bayne wrote: > > DB> I think the correct behaviour here would be to have smtpmail to refuse > DB> to send if there's an ambiguous account match in .authinfo. I can't > DB> off-hand think of a single case where I'd *want* it to just take the > DB> first matching account where there are several possibilities. > > I think it's common to have more specific matches on top, and less > specific matches down the list. That's why returning the first one makes > sense, and potentially there's always an ambiguous entry. It would break > such setups to do what you're suggesting. To be clear here I meant smtpmail as 'it'. I think it's the right thing for auth-source-search to return a list of matches, but I think it's a bug for smtpmail-try-auth-methods to just quietly use the first match in that case. The code in question is in smtpmail.el:510 ... (defun smtpmail-try-auth-methods (process supported-extensions host port &optional ask-for-password) ;; snip (auth-info (car (auth-source-search :host host :port port :user smtpmail-smtp-user :max 1 :require (and ask-for-password '(:user :secret)) :create ask-for-password))) What it seems to be doing with (car (... :max 1) is to simply take the first match and use that. What I *think* it should do is either a) error out in the case of an ambiguous match, or b) prompt the use to ask which of the various matches it should use. Meta: this is my first Emacs bug report, and I'm planning to write a patch to address it. Not sure whether the discussion of whether it's a bug, and if so, what the appropriate fix is, belongs here or on the emacs-devel list. Happy to take the conversation there if that's protocol. -- Duncan Bayne +61 420 817 082 | https://duncan.bayne.id.au/ I usually check my mail every 24 - 48 hours. If there's something urgent going on, please send me an SMS or call me.