[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#45711: 27.1; Ambiguous account match in .authinfo still used by smtp
From: |
Duncan Bayne |
Subject: |
bug#45711: 27.1; Ambiguous account match in .authinfo still used by smtpmail |
Date: |
Sun, 10 Jan 2021 10:30:13 +1100 |
User-agent: |
mu4e 1.4.13; emacs 27.1 |
Ted Zlatanov writes:
> On Thu, 07 Jan 2021 23:12:09 +1100 Duncan Bayne <duncan@bayne.id.au> 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.