unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#57373: 28.1; authinfo keyword smtp-auth does not work
@ 2022-08-23 22:01 John Kehayias via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2022-08-24  9:30 ` Robert Pluim
  0 siblings, 1 reply; 10+ messages in thread
From: John Kehayias via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2022-08-23 22:01 UTC (permalink / raw)
  To: 57373

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))






^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#57373: 28.1; authinfo keyword smtp-auth does not work
  2022-08-23 22:01 bug#57373: 28.1; authinfo keyword smtp-auth does not work John Kehayias via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2022-08-24  9:30 ` Robert Pluim
  2022-08-24 11:46   ` Lars Ingebrigtsen
  2022-08-24 15:20   ` John Kehayias via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 2 replies; 10+ messages in thread
From: Robert Pluim @ 2022-08-24  9:30 UTC (permalink / raw)
  To: 57373; +Cc: John Kehayias

>>>>> 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@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
-- 





^ permalink raw reply related	[flat|nested] 10+ messages in thread

* bug#57373: 28.1; authinfo keyword smtp-auth does not work
  2022-08-24  9:30 ` Robert Pluim
@ 2022-08-24 11:46   ` Lars Ingebrigtsen
  2022-08-25  7:59     ` Robert Pluim
  2022-08-24 15:20   ` John Kehayias via Bug reports for GNU Emacs, the Swiss army knife of text editors
  1 sibling, 1 reply; 10+ messages in thread
From: Lars Ingebrigtsen @ 2022-08-24 11:46 UTC (permalink / raw)
  To: Robert Pluim; +Cc: John Kehayias, 57373

Robert Pluim <rpluim@gmail.com> writes:

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

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





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#57373: 28.1; authinfo keyword smtp-auth does not work
  2022-08-24  9:30 ` Robert Pluim
  2022-08-24 11:46   ` Lars Ingebrigtsen
@ 2022-08-24 15:20   ` John Kehayias via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2022-08-25  9:47     ` Robert Pluim
  1 sibling, 1 reply; 10+ messages in thread
From: John Kehayias via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2022-08-24 15:20 UTC (permalink / raw)
  To: Robert Pluim; +Cc: 57373

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@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






^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#57373: 28.1; authinfo keyword smtp-auth does not work
  2022-08-24 11:46   ` Lars Ingebrigtsen
@ 2022-08-25  7:59     ` Robert Pluim
  2022-08-25 11:20       ` Lars Ingebrigtsen
  0 siblings, 1 reply; 10+ messages in thread
From: Robert Pluim @ 2022-08-25  7:59 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: John Kehayias, 57373

>>>>> On Wed, 24 Aug 2022 13:46:15 +0200, Lars Ingebrigtsen <larsi@gnus.org> said:

    Lars> Robert Pluim <rpluim@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
-- 





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#57373: 28.1; authinfo keyword smtp-auth does not work
  2022-08-24 15:20   ` John Kehayias via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2022-08-25  9:47     ` Robert Pluim
  0 siblings, 0 replies; 10+ messages in thread
From: Robert Pluim @ 2022-08-25  9:47 UTC (permalink / raw)
  To: John Kehayias; +Cc: Lars Ingebrigtsen, 57373

>>>>> 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@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
-- 





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#57373: 28.1; authinfo keyword smtp-auth does not work
  2022-08-25  7:59     ` Robert Pluim
@ 2022-08-25 11:20       ` Lars Ingebrigtsen
  2022-08-25 13:27         ` Robert Pluim
  0 siblings, 1 reply; 10+ messages in thread
From: Lars Ingebrigtsen @ 2022-08-25 11:20 UTC (permalink / raw)
  To: Robert Pluim; +Cc: John Kehayias, 57373

Robert Pluim <rpluim@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.





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#57373: 28.1; authinfo keyword smtp-auth does not work
  2022-08-25 11:20       ` Lars Ingebrigtsen
@ 2022-08-25 13:27         ` Robert Pluim
  2022-08-25 21:28           ` John Kehayias via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 10+ messages in thread
From: Robert Pluim @ 2022-08-25 13:27 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: John Kehayias, 57373

tags 57373 fixed
close 57373 29.1
quit

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

    Lars> Robert Pluim <rpluim@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
-- 





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#57373: 28.1; authinfo keyword smtp-auth does not work
  2022-08-25 13:27         ` Robert Pluim
@ 2022-08-25 21:28           ` John Kehayias via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2022-08-26  7:52             ` Robert Pluim
  0 siblings, 1 reply; 10+ messages in thread
From: John Kehayias via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2022-08-25 21:28 UTC (permalink / raw)
  To: Robert Pluim; +Cc: Lars Ingebrigtsen, 57373

On Thu, Aug 25, 2022 at 03:27 PM, Robert Pluim wrote:

> tags 57373 fixed
> close 57373 29.1
> quit
>

Thank you both!






^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#57373: 28.1; authinfo keyword smtp-auth does not work
  2022-08-25 21:28           ` John Kehayias via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2022-08-26  7:52             ` Robert Pluim
  0 siblings, 0 replies; 10+ messages in thread
From: Robert Pluim @ 2022-08-26  7:52 UTC (permalink / raw)
  To: John Kehayias; +Cc: Lars Ingebrigtsen, 57373

>>>>> On Thu, 25 Aug 2022 21:28:04 +0000, John Kehayias <john.kehayias@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
-- 





^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2022-08-26  7:52 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-23 22:01 bug#57373: 28.1; authinfo keyword smtp-auth does not work John Kehayias via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-08-24  9:30 ` Robert Pluim
2022-08-24 11:46   ` Lars Ingebrigtsen
2022-08-25  7:59     ` Robert Pluim
2022-08-25 11:20       ` Lars Ingebrigtsen
2022-08-25 13:27         ` Robert Pluim
2022-08-25 21:28           ` John Kehayias via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-08-26  7:52             ` Robert Pluim
2022-08-24 15:20   ` John Kehayias via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-08-25  9:47     ` Robert Pluim

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).