~tgulacsi


#282 Add support for CRAM-MD5 authentication 8 months ago

Comment by ~tgulacsi on ~rjarry/aerc

lib/send/sasl.go misses CRAM-MD5 - it is an insecure protocol, after all (https://github.com/golang/go/issues/61952), but net/smtp implements it, and cannot remove it for backwards compatibility, so we can use it, does not need to reimplement it:

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

#58 Automatic reconnection 4 years ago

Comment by ~tgulacsi on ~sircmpwn/aerc2

679~fourstepper (https://todo.sr.ht/~sircmpwn/aerc2/58#event-72428): 23707ffd826ad1d02c0a5b5ebd75ffbc71364 is on master

#58 Automatic reconnection 4 years ago

Comment by ~tgulacsi on ~sircmpwn/aerc2

I've been bitten just like https://todo.sr.ht/~sircmpwn/aerc2/58#event-58950 so could aerc save the message first somewhere locally, before trying to send/copy to send?

#448 Forward: Template loading failed: message: malformed MIME header key: 4 years ago

Comment by ~tgulacsi on ~sircmpwn/aerc2

Ok, sorry for the noise - after I've copied the lates aerc.conf, "forward" became working.

REPORTED RESOLVED NOT_OUR_BUG

#448 Forward: Template loading failed: message: malformed MIME header key: 4 years ago

Comment by ~tgulacsi on ~sircmpwn/aerc2

Strange. I've checked out a fresh copy of https://git.sr.ht/~sircmpwn/aerc, compiled it with 1.15.2, but still produces the same error (and the notmuch "no address", too, that's was fixed in my branch).

! git log |head
commit 72d81ba6034d31924a346c7c327e38b0db538c53
Author: Seán C McCord <scm@cycoresys.com>
Date:   Sun Sep 13 15:17:36 2020 -0400

    doc: add oauth to aerc-smtp

    Signed-off-by: Seán C McCord <ulexus@gmail.com>

commit 9d801414084470340f4cc1a9e0597d0a8d792587
Author: Reto Brunner <reto@labrat.space>
:gthomas@redpath: ~/src/git.sr.ht/~sircmpwn/aerc
$ go version -m aerc
aerc: go1.15.2
        path    git.sr.ht/~sircmpwn/aerc
        mod     git.sr.ht/~sircmpwn/aerc        (devel)
        dep     git.sr.ht/~sircmpwn/getopt      v0.0.0-20190808004552-daaf1274538b      h1:da5JBQ6dcW14aWnEf/pFRIMV2PsqTQEWmR+V2sw5oxU=
        dep     github.com/creack/pty   v1.1.10 h1:Xv3/hZlzZeTSMk5upBEt3iFdxWaPS3xYIm+BBySIqlY=
        dep     github.com/danwakefield/fnmatch v0.0.0-20160403171240-cbb64ac3d964      h1:y5HC9v93H5EPKqaS1UYVg1uYah5Xf51mBfIoWehClUQ=
        dep     github.com/ddevault/go-libvterm v0.0.0-20190526194226-b7d861da3810      h1:VlHKuIrEvuGlED53TkovT4AVUjrqTyeCt3wiqw1OsFc=
        dep     github.com/emersion/go-imap     v1.0.4  h1:uiCAIHM6Z5Jwkma1zdNDWWXxSCqb+/xHBkHflD7XBro=
        dep     github.com/emersion/go-imap-idle        v0.0.0-20190519112320-2704abd7050e      h1:L7bswVJZcf2YHofgom49oFRwVqmBj/qZqDy9/SJpZMY=
        dep     github.com/emersion/go-maildir  v0.2.0  h1:fC4+UVGl8GcQGbFF7AWab2JMf4VbKz+bMNv07xxhzs8=
        dep     github.com/emersion/go-message  v0.12.1-0.20200824204225-9094bd0b8bc0   h1:G2VV/Wp2opDvR0ecue3UY/IX1/8OlTmMKKi+ENe1nG0=
        dep     github.com/emersion/go-pgpmail  v0.0.0-20200303213726-db035a3a4139      h1:JTUbkRuQFtDrl5KHWR2jrh9SUeSDEEEjUcHJkXdAE2Q=
        dep     github.com/emersion/go-sasl     v0.0.0-20191210011802-430746ea8b9b      h1:uhWtEWBHgop1rqEk2klKaxPAkVDCXexai6hSuRQ7Nvs=
        dep     github.com/emersion/go-smtp     v0.12.1 h1:1R8BDqrR2HhlGwgFYcOi+BVTvK1bMjAB65QcVpJ5sNA=
        dep     github.com/emersion/go-textwrapper      v0.0.0-20160606182133-d0e65e56babe      h1:40SWqY0zE3qCi6ZrtTf5OUdNm5lDnGnjRSq9GgmeTrg=
        dep     github.com/fsnotify/fsnotify    v1.4.7  h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I=
        dep     github.com/gdamore/encoding     v1.0.0  h1:+7OoQ1Bc6eTm5niUzBa0Ctsh6JbMW6Ra+YNuAtDBdko=
        dep     github.com/gdamore/tcell        v1.3.0
        =>      git.sr.ht/~sircmpwn/tcell       v0.0.0-20190807054800-3fdb6bc01a50      h1:GEZXdK3vfsEGlRwlybiAvOnYLA4YKaVWxAQSn/BSkNw=
        dep     github.com/go-ini/ini   v1.52.0 h1:3UeUAveYUTCYV/G0jNDiIrrtIeAl1oAjshYyU2PaAlQ=
        dep     github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510      h1:El6M4kTTCOh6aBiKaUGG7oYTSPP8MxqL4YI3kZKwcP4=
        dep     github.com/imdario/mergo        v0.3.8  h1:CGgOkSJeqMRmt0D9XLWExdT4m4F1vd3FV3VPt+0VxkQ=
        dep     github.com/kyoh86/xdg   v1.2.0  h1:CERuT/ShdTDj+A2UaX3hQ3mOV369+Sj+wyn2nIRIIkI=
        dep     github.com/lucasb-eyer/go-colorful      v1.0.3  h1:QIbQXiugsb+q10B+MI+7DI1oQLdmnep86tWFlaaUAac=
        dep     github.com/martinlindhe/base36  v1.0.0  h1:eYsumTah144C0A8P1T/AVSUk5ZoLnhfYFM3OGQxB52A=
        dep     github.com/mattn/go-isatty      v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY=
        dep     github.com/mattn/go-pointer     v0.0.0-20190911064623-a0a44394634f      h1:QTRRO+ozoYgT3CQRIzNVYJRU3DB8HRnkZv6mr4ISmMA=
        dep     github.com/mattn/go-runewidth   v0.0.8  h1:3tS41NlGYSmhhe/8fhGRzc+z3AYCw1Fe1WAyLuujKs0=
        dep     github.com/miolini/datacounter  v1.0.2  h1:mGTL0vqEAtH7mwNJS1JIpd6jwTAP6cBQQ2P8apaCIm8=
        dep     github.com/mitchellh/go-homedir v1.1.0  h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y=
        dep     github.com/pkg/errors   v0.9.1  h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
        dep     github.com/riywo/loginshell     v0.0.0-20190610082906-2ed199a032f6      h1:0QWE8TiOGSB+korydW5z4hPQ5QBVqLos+M2ta4pHaY0=
        dep     github.com/zenhack/go.notmuch   v0.0.0-20190821052706-5a1961965cfb      h1:eZBIw4TilXSAEYcWKf51bERhwH431YwntDYus0Bgxh0=
        dep     golang.org/x/crypto     v0.0.0-20200302210943-78000ba7a073
        =>      github.com/ProtonMail/crypto    v0.0.0-20200420072808-71bec3603bf3      h1:JW27/kGLQzeM1Fxg5YQhdkTEAU7HIAHMgSag35zVTnY=
        dep     golang.org/x/net        v0.0.0-20200301022130-244492dfa37a      h1:GuSPYbZzB5/dcLNCwLQLsg3obCJtX9IJhpXkvY7kzk0=
        dep     golang.org/x/oauth2     v0.0.0-20200107190931-bf48bf16ab8d      h1:TzXSXBo42m9gQenoE3b9BGiEpg5IG2JkU5FkPIawgtw=
        dep     golang.org/x/sys        v0.0.0-20200302150141-5c8b2ff67527      h1:uYVVQ9WP/Ds2ROhcaGPeIdVq0RIXVLwsHlnvJ+cT1So=
        dep     golang.org/x/text       v0.3.2  h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs=

#448 Forward: Template loading failed: message: malformed MIME header key: 4 years ago

Comment by ~tgulacsi on ~sircmpwn/aerc2

Maybe, but

  1. I use the official, unmodified forward_as_body template
  2. If I empty it, it throws the same error.

RESOLVED NOT_OUR_BUG REPORTED

#448 Forward: Template loading failed: message: malformed MIME header key: 4 years ago

bug added by ~tgulacsi on ~sircmpwn/aerc2

#448 Forward: Template loading failed: message: malformed MIME header key: 4 years ago

Ticket created by ~tgulacsi on ~sircmpwn/aerc2

With

$ git diff
diff --git a/widgets/compose.go b/widgets/compose.go
index 03c9175..a9f4140 100644
--- a/widgets/compose.go
+++ b/widgets/compose.go
@@ -103,7 +103,8 @@ func NewComposer(aerc *Aerc, acct *AccountView, conf *config.AercConfig,
        }

        if err := c.AddTemplate(template, templateData); err != nil {
-               return nil, err
+               aerc.logger.Printf("ERROR template=%v data=%#v origFrom=%v errors=%w", template, templateData, templateData.OriginalFrom[0], err)
+               return nil, fmt.Errorf("data=%#v errors=%w", template, templateData, err)
        }
        c.AddSignature()

I see

origFrom==?utf-8?b?VGFrw6FjcyBUYW3DoXMgKFVuaUNyZWRpdCBCYW5rIC0gSCAtIFVuaUNyZWRp?= =?utf-8?b?dCBHcm91cCk=?= <Tamas.Takacs@unicreditgroup.hu> errors=%!w(*errors.errorString=&{Template loading failed: message: malformed MIME header key: Forwarded message from Takács Tamás (UniCredit Bank - H - UniCredit Group) on Mon Sep 14, 2020 at 8})

The same is with a simple address:

origFrom="sourcehut" <outgoing@sr.ht> errors=%
!w(*errors.errorString=&{Template loading failed: message: malformed MIME header key: Forwarded message from sourcehut on Mon Sep 14, 2020 at 12}