From 331b915139e23073aa42bf28d67901383dd859ca Mon Sep 17 00:00:00 2001 From: Luke Drummond Date: Tue, 29 Oct 2019 17:11:38 +0000 Subject: [PATCH] Add support for AUTH LOGIN submission `go-sasl` upstream added support [1] for the obsolete [2] AUTH LOGIN method which enables aerc to send email via servers which remain common in the wild. Fixes ~sircmpwn/aerc2#263 [1] https://github.com/emersion/go-sasl/commit/61afe53d [2] https://datatracker.ietf.org/doc/draft-murchison-sasl-login/ --- commands/compose/send.go | 3 +++ doc/aerc-smtp.5.scd | 4 ++++ go.mod | 2 +- go.sum | 2 ++ 4 files changed, 10 insertions(+), 1 deletion(-) diff --git a/commands/compose/send.go b/commands/compose/send.go index 5a12428..2d994bf 100644 --- a/commands/compose/send.go +++ b/commands/compose/send.go @@ -92,6 +92,9 @@ func (Send) Execute(aerc *widgets.Aerc, args []string) error { fallthrough case "none": saslClient = nil + case "login": + password, _ := uri.User.Password() + saslClient = sasl.NewLoginClient(uri.User.Username(), password) case "plain": password, _ := uri.User.Password() saslClient = sasl.NewPlainClient("", uri.User.Username(), password) diff --git a/doc/aerc-smtp.5.scd b/doc/aerc-smtp.5.scd index e455001..da9b1ac 100644 --- a/doc/aerc-smtp.5.scd +++ b/doc/aerc-smtp.5.scd @@ -39,6 +39,10 @@ available: Authenticate with a username and password using AUTH PLAIN. This is the default behavior. + *+login*: + Authenticate with a username and password using AUTH LOGIN. This is an obsolete + protocol, but is required for some common webmail providers. + *outgoing-cred-cmd* Specifies the command to run to get the password for the SMTP account. This command will be run using `sh -c [command]`. If a diff --git a/go.mod b/go.mod index aeb7f8c..0595a0f 100644 --- a/go.mod +++ b/go.mod @@ -11,7 +11,7 @@ require ( github.com/emersion/go-imap-idle v0.0.0-20190519112320-2704abd7050e github.com/emersion/go-maildir v0.0.0-20190727102040-941194b0ac70 github.com/emersion/go-message v0.10.7 - github.com/emersion/go-sasl v0.0.0-20190704090222-36b50694675c + github.com/emersion/go-sasl v0.0.0-20190817083125-240c8404624e github.com/emersion/go-smtp v0.11.2 github.com/fsnotify/fsnotify v1.4.7 github.com/gdamore/tcell v1.1.5-0.20190724020331-84b54971b46c diff --git a/go.sum b/go.sum index 2749ac5..f111fc5 100644 --- a/go.sum +++ b/go.sum @@ -28,6 +28,8 @@ github.com/emersion/go-sasl v0.0.0-20190520160400-47d427600317 h1:tYZxAY8nu3JJQK github.com/emersion/go-sasl v0.0.0-20190520160400-47d427600317/go.mod h1:G/dpzLu16WtQpBfQ/z3LYiYJn3ZhKSGWn83fyoyQe/k= github.com/emersion/go-sasl v0.0.0-20190704090222-36b50694675c h1:Spm8jy+jWYG/Dn6ygbq/LBW/6M27kg59GK+FkKjexuw= github.com/emersion/go-sasl v0.0.0-20190704090222-36b50694675c/go.mod h1:G/dpzLu16WtQpBfQ/z3LYiYJn3ZhKSGWn83fyoyQe/k= +github.com/emersion/go-sasl v0.0.0-20190817083125-240c8404624e h1:ba7YsgX5OV8FjGi5ZWml8Jng6oBrJAb3ahqWMJ5Ce8Q= +github.com/emersion/go-sasl v0.0.0-20190817083125-240c8404624e/go.mod h1:G/dpzLu16WtQpBfQ/z3LYiYJn3ZhKSGWn83fyoyQe/k= github.com/emersion/go-smtp v0.11.2 h1:5PO2Kwsx+HXuytntCfMvcworC/iq45TPGkwjnaBZFSg= github.com/emersion/go-smtp v0.11.2/go.mod h1:byi9Y32SuKwjTJt9DO2tTWYjtF3lEh154tE1AcaJQSY= github.com/emersion/go-textwrapper v0.0.0-20160606182133-d0e65e56babe h1:40SWqY0zE3qCi6ZrtTf5OUdNm5lDnGnjRSq9GgmeTrg=