From: Tamás Gulácsi <tamas@gulacsi.eu>
Fixes ~rjarry/aerc#282
---
lib/send/sasl.go | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/lib/send/sasl.go b/lib/send/sasl.go
index 01e006e3..13451ce3 100644
--- a/lib/send/sasl.go
+++ b/lib/send/sasl.go
@@ -2,6 +2,7 @@ package send
import (
"fmt"
+ "net/smtp"
"net/url"
"github.com/emersion/go-sasl"
@@ -23,6 +24,10 @@ func newSaslClient(auth string, uri *url.URL) (sasl.Client, error) {
case "plain":
password, _ := uri.User.Password()
saslClient = sasl.NewPlainClient("", uri.User.Username(), password)
+ case "cram-md5":
+ password, _ := uri.User.Password()
+ saslClient = stdSaslClient{smtp.CRAMMD5Auth(uri.User.Username(), password)}
+
case "oauthbearer":
q := uri.Query()
oauth2 := &oauth2.Config{}
@@ -70,8 +75,22 @@ func newSaslClient(auth string, uri *url.URL) (sasl.Client, error) {
password = token.AccessToken
}
saslClient = lib.NewXoauth2Client(uri.User.Username(), password)
+
default:
return nil, fmt.Errorf("Unsupported auth mechanism %s", auth)
}
return saslClient, nil
}
+
+type stdSaslClient struct {
+ smtp.Auth
+}
+
+var _ sasl.Client = stdSaslClient{}
+
+func (c stdSaslClient) Start() (mech string, ir []byte, err error) {
+ return c.Auth.Start(nil)
+}
+func (c stdSaslClient) Next(challenge []byte) (response []byte, err error) {
+ return c.Auth.Next(challenge, len(challenge) != 0)
+}
--
2.45.2
Hi Tamás,
On Sat Oct 19, 2024 at 12:09, ~tgulacsi <tgulacsi@git.sr.ht> wrote:
> From: Tamás Gulácsi <tamas@gulacsi.eu>
>
> Fixes ~rjarry/aerc#282
> ---
thanks for the patch! You probably want to run `gmake gitconfig` and `make
lint` before sending (although the former will only help with git-send-email).
Fixes works like this on sourcehut:
Fixes: https://todo.sr.ht/~rjarry/aerc/16
Also your commit title is missing a prefix, a body explaining the change and
I guess a Changelog-added: trailer and needs to be signed off.
Contributing.md should have the details.
Thanks,
Bence
--
bence.ferdinandy.com
On Sat Oct 19, 2024 at 5:17 AM CDT, ~tgulacsi wrote:
> From: Tamás Gulácsi <tamas@gulacsi.eu>
>
> Fixes ~rjarry/aerc#282
> ---
Hey Tamás -
In addition to Bence's comments, we need to add this to the docs:
doc/aerc-smtp.5.scd
Thanks!
--
Tim