GNU bug report logs - #57373
28.1; authinfo keyword smtp-auth does not work

Previous Next

Package: emacs;

Reported by: John Kehayias <john.kehayias <at> protonmail.com>

Date: Tue, 23 Aug 2022 22:02:02 UTC

Severity: normal

Tags: fixed, moreinfo

Found in version 28.1

Fixed in versions 29.1, 28.2

Done: Robert Pluim <rpluim <at> gmail.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 57373 in the body.
You can then email your comments to 57373 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#57373; Package emacs. (Tue, 23 Aug 2022 22:02:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to John Kehayias <john.kehayias <at> protonmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Tue, 23 Aug 2022 22:02:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: John Kehayias <john.kehayias <at> protonmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 28.1; authinfo keyword smtp-auth does not work
Date: Tue, 23 Aug 2022 22:01:10 +0000
Hello,

I have been trying to use a specific auth method for different smtp servers, which should be supported by specifying the "smpt-auth" keyword in .authinfo. However, this does not work, for any value put there (whether quoted, unquoted, etc.), Emacs always saying e.g. "Mechanism plain not implemented" when authinfo for the server contains "smtp-auth plain".

I believe the problem is that in smtpmail-try-auth-methods the smtp-auth keyword is read in by auth-source-search as a string, while the call to smtpmail-try-auth-method that uses it all match with eql, eg. as (eql 'plain).

I have tried different ways to get the smtp-auth value read differently in my authinfo, to no avail. Looking back at the devel mailing list, there was some confusion that this feature needed plstore, but in the end did not: <https://lists.gnu.org/archive/html/emacs-devel/2020-09/msg00002.html>  I can confirm that reading the authinfo does provide the smtp-auth keyword, it just won't match any method to call.

Perhaps there is a different format for specifying smtp-auth that I didn't find?

Below is the build information for my current Emacs.

Thanks!
John

In GNU Emacs 28.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.33, cairo version 1.17.6)
 of 2022-04-27 built on frederik
Windowing system distributor 'The X.Org Foundation', version 11.0.12101004
System Description: Arch Linux

Configured using:
 'configure --with-x-toolkit=gtk3 --with-native-compilation --sysconfdir=/etc
 --prefix=/usr --libexecdir=/usr/lib --localstatedir=/var --with-cairo --with-harfbuzz
 --with-libsystemd --with-modules 'CFLAGS=-march=x86-64 -mtune=generic -O2 -pipe -fno-plt
 -fexceptions -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security
 -fstack-clash-protection -fcf-protection -g
 -ffile-prefix-map=/build/emacs/src=/usr/src/debug -flto=auto'
 'LDFLAGS=-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now -flto=auto''

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG JSON LCMS2 LIBOTF
LIBSYSTEMD LIBXML2 M17N_FLT MODULES NATIVE_COMP NOTIFY INOTIFY PDUMPER PNG RSVG SECCOMP
SOUND THREADS TIFF TOOLKIT_SCROLL_BARS X11 XDBE XIM XPM GTK3 ZLIB

Important settings:
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Memory information:
((conses 16 1068719 151325)
 (symbols 48 57665 0)
 (strings 32 248488 6921)
 (string-bytes 1 8756410)
 (vectors 16 122100)
 (vector-slots 8 2564346 97616)
 (floats 8 1553 949)
 (intervals 56 22635 2271)
 (buffers 992 40))





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#57373; Package emacs. (Wed, 24 Aug 2022 09:31:01 GMT) Full text and rfc822 format available.

Message #8 received at 57373 <at> debbugs.gnu.org (full text, mbox):

From: Robert Pluim <rpluim <at> gmail.com>
To: 57373 <at> debbugs.gnu.org
Cc: John Kehayias <john.kehayias <at> protonmail.com>
Subject: Re: bug#57373: 28.1; authinfo keyword smtp-auth does not work
Date: Wed, 24 Aug 2022 11:30:27 +0200
>>>>> On Tue, 23 Aug 2022 22:01:10 +0000, John Kehayias via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org> said:

    John> I believe the problem is that in smtpmail-try-auth-methods
    John> the smtp-auth keyword is read in by auth-source-search as a
    John> string, while the call to smtpmail-try-auth-method that uses
    John> it all match with eql, eg. as (eql 'plain).

Yep.

    John> I have tried different ways to get the smtp-auth value read
    John> differently in my authinfo, to no avail. Looking back at the
    John> devel mailing list, there was some confusion that this
    John> feature needed plstore, but in the end did not:
    John> <https://lists.gnu.org/archive/html/emacs-devel/2020-09/msg00002.html>
    John> I can confirm that reading the authinfo does provide the
    John> smtp-auth keyword, it just won't match any method to call.

    John> Perhaps there is a different format for specifying smtp-auth that I didn't find?

auth-source search always returns a plist containg strings as the key
values. Does the following work for you

diff --git a/lisp/mail/smtpmail.el b/lisp/mail/smtpmail.el
index c2f8f27377..8573532eac 100644
--- a/lisp/mail/smtpmail.el
+++ b/lisp/mail/smtpmail.el
@@ -577,7 +577,7 @@ smtpmail-try-auth-methods
                     (stringp result))
           (setq result (catch 'done
 		         (smtpmail-try-auth-method
-                          process (pop mechs) user password))))
+                          process (intern-soft (pop mechs)) user password))))
         ;; A string result is an error.
         (if (stringp result)
             (progn


Robert
-- 




Added tag(s) moreinfo. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Wed, 24 Aug 2022 11:46:01 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#57373; Package emacs. (Wed, 24 Aug 2022 11:47:01 GMT) Full text and rfc822 format available.

Message #13 received at 57373 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Robert Pluim <rpluim <at> gmail.com>
Cc: John Kehayias <john.kehayias <at> protonmail.com>, 57373 <at> debbugs.gnu.org
Subject: Re: bug#57373: 28.1; authinfo keyword smtp-auth does not work
Date: Wed, 24 Aug 2022 13:46:15 +0200
Robert Pluim <rpluim <at> gmail.com> writes:

> +                          process (intern-soft (pop mechs)) user password))))

Is there any reason to not just use `intern' here?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#57373; Package emacs. (Wed, 24 Aug 2022 15:21:02 GMT) Full text and rfc822 format available.

Message #16 received at 57373 <at> debbugs.gnu.org (full text, mbox):

From: John Kehayias <john.kehayias <at> protonmail.com>
To: Robert Pluim <rpluim <at> gmail.com>
Cc: 57373 <at> debbugs.gnu.org
Subject: Re: bug#57373: 28.1; authinfo keyword smtp-auth does not work
Date: Wed, 24 Aug 2022 15:20:48 +0000
Hello Robert,

Thanks for such a quick response and fix! Let me just add my use case being that some SMTP servers I use have different authentication methods, but will try and fail with the others. I could work around this by modifying the ordering in smtpmail-auth-supported, at least for my current sent of servers. Anyway, was happy to see this feature for exactly this reason.

On Wed, Aug 24, 2022 at 11:30 AM, Robert Pluim wrote:

>>>>>> On Tue, 23 Aug 2022 22:01:10 +0000, John Kehayias via "Bug reports for GNU Emacs,
> the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org> said:
>
>     John> I believe the problem is that in smtpmail-try-auth-methods
>     John> the smtp-auth keyword is read in by auth-source-search as a
>     John> string, while the call to smtpmail-try-auth-method that uses
>     John> it all match with eql, eg. as (eql 'plain).
>
> Yep.
>
>     John> I have tried different ways to get the smtp-auth value read
>     John> differently in my authinfo, to no avail. Looking back at the
>     John> devel mailing list, there was some confusion that this
>     John> feature needed plstore, but in the end did not:
>     John> <https://lists.gnu.org/archive/html/emacs-devel/2020-09/msg00002.html>
>     John> I can confirm that reading the authinfo does provide the
>     John> smtp-auth keyword, it just won't match any method to call.
>
>     John> Perhaps there is a different format for specifying smtp-auth that I didn't find?
>
> auth-source search always returns a plist containg strings as the key
> values. Does the following work for you

Understood, just wanted to be sure I wasn't missing something obvious.

>
> diff --git a/lisp/mail/smtpmail.el b/lisp/mail/smtpmail.el
> index c2f8f27377..8573532eac 100644
> --- a/lisp/mail/smtpmail.el
> +++ b/lisp/mail/smtpmail.el
> @@ -577,7 +577,7 @@ smtpmail-try-auth-methods
>                      (stringp result))
>            (setq result (catch 'done
>  		         (smtpmail-try-auth-method
> -                          process (pop mechs) user password))))
> +                          process (intern-soft (pop mechs)) user password))))
>          ;; A string result is an error.
>          (if (stringp result)
>              (progn
>

Yes that works for me! Note that I am not on Emacs 29, nor my Guix machine where I could easily rebuild with a patch, so I just did a local redefinition of smtpmail-try-auth-methods with (intern-soft mech) in the call to smtpmail-try-auth-method. So I didn't backport the full changes to that function I see. I can certainly try that later, but wanted to a quick check. I was able to send mail with smtp-auth specified in my authinfo.

Thanks!
John





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#57373; Package emacs. (Thu, 25 Aug 2022 08:00:02 GMT) Full text and rfc822 format available.

Message #19 received at 57373 <at> debbugs.gnu.org (full text, mbox):

From: Robert Pluim <rpluim <at> gmail.com>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: John Kehayias <john.kehayias <at> protonmail.com>, 57373 <at> debbugs.gnu.org
Subject: Re: bug#57373: 28.1; authinfo keyword smtp-auth does not work
Date: Thu, 25 Aug 2022 09:59:45 +0200
>>>>> On Wed, 24 Aug 2022 13:46:15 +0200, Lars Ingebrigtsen <larsi <at> gnus.org> said:

    Lars> Robert Pluim <rpluim <at> gmail.com> writes:
    >> +                          process (intern-soft (pop mechs)) user password))))

    Lars> Is there any reason to not just use `intern' here?

`mechs' can be either the intersection of `smtpmail-auth-supported'
 and `supported-extensions' or the result from `auth-info'. In the
 latter case it contains strings, in the former symbols, and `intern'
 only accepts symbols.

Robert
-- 




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#57373; Package emacs. (Thu, 25 Aug 2022 09:48:02 GMT) Full text and rfc822 format available.

Message #22 received at 57373 <at> debbugs.gnu.org (full text, mbox):

From: Robert Pluim <rpluim <at> gmail.com>
To: John Kehayias <john.kehayias <at> protonmail.com>
Cc: Lars Ingebrigtsen <larsi <at> gnus.org>, 57373 <at> debbugs.gnu.org
Subject: Re: bug#57373: 28.1; authinfo keyword smtp-auth does not work
Date: Thu, 25 Aug 2022 11:47:09 +0200
>>>>> On Wed, 24 Aug 2022 15:20:48 +0000, John Kehayias via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org> said:

    John> Hello Robert,
    John> Thanks for such a quick response and fix! Let me just add my use case
    John> being that some SMTP servers I use have different authentication
    John> methods, but will try and fail with the others. I could work around
    John> this by modifying the ordering in smtpmail-auth-supported, at least
    John> for my current sent of servers. Anyway, was happy to see this feature
    John> for exactly this reason.

SMTP AUTH is standard, except when itʼs not :-)

    John> I was able to send mail with
    John> smtp-auth specified in my authinfo.

Good to know. Iʼll push it to master once Lars is OK with it.

Thanks

Robert
-- 




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#57373; Package emacs. (Thu, 25 Aug 2022 11:21:01 GMT) Full text and rfc822 format available.

Message #25 received at 57373 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Robert Pluim <rpluim <at> gmail.com>
Cc: John Kehayias <john.kehayias <at> protonmail.com>, 57373 <at> debbugs.gnu.org
Subject: Re: bug#57373: 28.1; authinfo keyword smtp-auth does not work
Date: Thu, 25 Aug 2022 13:20:15 +0200
Robert Pluim <rpluim <at> gmail.com> writes:

> `mechs' can be either the intersection of `smtpmail-auth-supported'
>  and `supported-extensions' or the result from `auth-info'. In the
>  latter case it contains strings, in the former symbols, and `intern'
>  only accepts symbols.

(The last "symbols" should be "strings" presumably 😀)

Then the patch looks good to me; please go ahead and push.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#57373; Package emacs. (Thu, 25 Aug 2022 13:28:02 GMT) Full text and rfc822 format available.

Message #28 received at 57373 <at> debbugs.gnu.org (full text, mbox):

From: Robert Pluim <rpluim <at> gmail.com>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: John Kehayias <john.kehayias <at> protonmail.com>, 57373 <at> debbugs.gnu.org
Subject: Re: bug#57373: 28.1; authinfo keyword smtp-auth does not work
Date: Thu, 25 Aug 2022 15:27:37 +0200
tags 57373 fixed
close 57373 29.1
quit

>>>>> On Thu, 25 Aug 2022 13:20:15 +0200, Lars Ingebrigtsen <larsi <at> gnus.org> said:

    Lars> Robert Pluim <rpluim <at> gmail.com> writes:
    >> `mechs' can be either the intersection of `smtpmail-auth-supported'
    >> and `supported-extensions' or the result from `auth-info'. In the
    >> latter case it contains strings, in the former symbols, and `intern'
    >> only accepts symbols.

    Lars> (The last "symbols" should be "strings" presumably 😀)

Yes. I plead youth and inexperience and long and faithful service :-)

    Lars> Then the patch looks good to me; please go ahead and push.

Done.

Closing.
Committed as 2385bf3397

Robert
-- 




Added tag(s) fixed. Request was from Robert Pluim <rpluim <at> gmail.com> to control <at> debbugs.gnu.org. (Thu, 25 Aug 2022 13:28:02 GMT) Full text and rfc822 format available.

bug marked as fixed in version 29.1, send any further explanations to 57373 <at> debbugs.gnu.org and John Kehayias <john.kehayias <at> protonmail.com> Request was from Robert Pluim <rpluim <at> gmail.com> to control <at> debbugs.gnu.org. (Thu, 25 Aug 2022 13:28:02 GMT) Full text and rfc822 format available.

bug marked as fixed in version 28.2, send any further explanations to 57373 <at> debbugs.gnu.org and John Kehayias <john.kehayias <at> protonmail.com> Request was from Robert Pluim <rpluim <at> gmail.com> to control <at> debbugs.gnu.org. (Thu, 25 Aug 2022 16:19:01 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#57373; Package emacs. (Thu, 25 Aug 2022 21:29:02 GMT) Full text and rfc822 format available.

Message #37 received at 57373 <at> debbugs.gnu.org (full text, mbox):

From: John Kehayias <john.kehayias <at> protonmail.com>
To: Robert Pluim <rpluim <at> gmail.com>
Cc: Lars Ingebrigtsen <larsi <at> gnus.org>, 57373 <at> debbugs.gnu.org
Subject: Re: bug#57373: 28.1; authinfo keyword smtp-auth does not work
Date: Thu, 25 Aug 2022 21:28:04 +0000
On Thu, Aug 25, 2022 at 03:27 PM, Robert Pluim wrote:

> tags 57373 fixed
> close 57373 29.1
> quit
>

Thank you both!





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#57373; Package emacs. (Fri, 26 Aug 2022 07:53:01 GMT) Full text and rfc822 format available.

Message #40 received at 57373 <at> debbugs.gnu.org (full text, mbox):

From: Robert Pluim <rpluim <at> gmail.com>
To: John Kehayias <john.kehayias <at> protonmail.com>
Cc: Lars Ingebrigtsen <larsi <at> gnus.org>, 57373 <at> debbugs.gnu.org
Subject: Re: bug#57373: 28.1; authinfo keyword smtp-auth does not work
Date: Fri, 26 Aug 2022 09:52:42 +0200
>>>>> On Thu, 25 Aug 2022 21:28:04 +0000, John Kehayias <john.kehayias <at> protonmail.com> said:

    John> On Thu, Aug 25, 2022 at 03:27 PM, Robert Pluim wrote:
    >> tags 57373 fixed
    >> close 57373 29.1
    >> quit
    >> 

    John> Thank you both!

np. And despite this message, the fix will actually appear in
emacs-28.2 and emacs-29.1

Thanks

Robert
-- 




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 23 Sep 2022 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 274 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.