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/
This commit is contained in:
Luke Drummond 2019-10-29 17:11:38 +00:00 committed by Drew DeVault
parent 6dc537fbe3
commit 331b915139
4 changed files with 10 additions and 1 deletions

View File

@ -92,6 +92,9 @@ func (Send) Execute(aerc *widgets.Aerc, args []string) error {
fallthrough fallthrough
case "none": case "none":
saslClient = nil saslClient = nil
case "login":
password, _ := uri.User.Password()
saslClient = sasl.NewLoginClient(uri.User.Username(), password)
case "plain": case "plain":
password, _ := uri.User.Password() password, _ := uri.User.Password()
saslClient = sasl.NewPlainClient("", uri.User.Username(), password) saslClient = sasl.NewPlainClient("", uri.User.Username(), password)

View File

@ -39,6 +39,10 @@ available:
Authenticate with a username and password using AUTH PLAIN. This is the Authenticate with a username and password using AUTH PLAIN. This is the
default behavior. 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* *outgoing-cred-cmd*
Specifies the command to run to get the password for the SMTP Specifies the command to run to get the password for the SMTP
account. This command will be run using `sh -c [command]`. If a account. This command will be run using `sh -c [command]`. If a

2
go.mod
View File

@ -11,7 +11,7 @@ require (
github.com/emersion/go-imap-idle v0.0.0-20190519112320-2704abd7050e 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-maildir v0.0.0-20190727102040-941194b0ac70
github.com/emersion/go-message v0.10.7 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/emersion/go-smtp v0.11.2
github.com/fsnotify/fsnotify v1.4.7 github.com/fsnotify/fsnotify v1.4.7
github.com/gdamore/tcell v1.1.5-0.20190724020331-84b54971b46c github.com/gdamore/tcell v1.1.5-0.20190724020331-84b54971b46c

2
go.sum
View File

@ -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-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 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-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 h1:5PO2Kwsx+HXuytntCfMvcworC/iq45TPGkwjnaBZFSg=
github.com/emersion/go-smtp v0.11.2/go.mod h1:byi9Y32SuKwjTJt9DO2tTWYjtF3lEh154tE1AcaJQSY= github.com/emersion/go-smtp v0.11.2/go.mod h1:byi9Y32SuKwjTJt9DO2tTWYjtF3lEh154tE1AcaJQSY=
github.com/emersion/go-textwrapper v0.0.0-20160606182133-d0e65e56babe h1:40SWqY0zE3qCi6ZrtTf5OUdNm5lDnGnjRSq9GgmeTrg= github.com/emersion/go-textwrapper v0.0.0-20160606182133-d0e65e56babe h1:40SWqY0zE3qCi6ZrtTf5OUdNm5lDnGnjRSq9GgmeTrg=