neilalexander / yggmail

End-to-end encrypted email for the mesh networking age

Home Page:https://matrix.to/#/#yggmail:matrix.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Non-ygg-side SMTP does not support AUTH LOGIN

parnikkapore opened this issue · comments

Describe the bug
Attempting to log into a yggmail instance with AUTH LOGIN causes a panic:

220 <Snip> ESMTP Service Ready
EHLO host
250-Hello host
250-PIPELINING
250-8BITMIME
250-ENHANCEDSTATUSCODES
250-CHUNKING
250-AUTH PLAIN LOGIN
250 SIZE 1048576
AUTH LOGIN
334 VXNlcm5hbWU6
<Snip>
334 UGFzc3dvcmQ6
<Snip>
421 4.0.0 Internal server error
Connection closed by foreign host.

To Reproduce
Try to log into the yggmail server using AUTH LOGIN. The above is an example transcript.

Expected behavior
The login should proceed as in AUTH PLAIN.

Desktop (please complete the following information):

  • OS: Linux
  • Version: latest?

Additional context
Here's the stack trace of the panic:

goroutine 57647 [running]:
runtime/debug.Stack()
	/usr/share/go/src/runtime/debug/stack.go:24 +0x65
github.com/emersion/go-smtp.(*Conn).handle.func1()
	/home/kappa/go/pkg/mod/github.com/emersion/go-smtp@v0.15.0/conn.go:102 +0xc5
panic({0x8891a0, 0xbe9040})
	/usr/share/go/src/runtime/panic.go:1038 +0x215
github.com/neilalexander/yggmail/internal/smtpserver.(*Backend).Login(0xc0000b0880, 0x0, {0xc0001ef400, 0x0}, {0xc0004e20c0, 0x14})
	/home/kappa/go/pkg/mod/github.com/neilalexander/yggmail@v0.0.0-20211021220120-f397cd4b6cfa/internal/smtpserver/backend.go:58 +0x259
main.main.func1.1.1({0xc0001ef400, 0xc0004e20a8}, {0xc0004e20c0, 0xc0004e20a8})
	/home/kappa/go/pkg/mod/github.com/neilalexander/yggmail@v0.0.0-20211021220120-f397cd4b6cfa/cmd/yggmail/main.go:183 +0x38
github.com/emersion/go-sasl.(*loginServer).Next(0xc0002b43c0, {0xc0004e20a8, 0xffffffffffffffff, 0xc000120320})
	/home/kappa/go/pkg/mod/github.com/emersion/go-sasl@v0.0.0-20200509203442-7bfe0ed36a21/login.go:81 +0x135
github.com/emersion/go-smtp.(*Conn).handleAuth(0xc000120320, {0xc000212685, 0xc000212685})
	/home/kappa/go/pkg/mod/github.com/emersion/go-smtp@v0.15.0/conn.go:549 +0x3d6
github.com/emersion/go-smtp.(*Conn).handle(0xc000120320, {0xc000212680, 0xc000120320}, {0xc000212685, 0x5})
	/home/kappa/go/pkg/mod/github.com/emersion/go-smtp@v0.15.0/conn.go:151 +0x1bf
github.com/emersion/go-smtp.(*Server).handleConn(0xc0000da000, 0xc000120320)
	/home/kappa/go/pkg/mod/github.com/emersion/go-smtp@v0.15.0/server.go:154 +0x1a5
created by github.com/emersion/go-smtp.(*Server).Serve
	/home/kappa/go/pkg/mod/github.com/emersion/go-smtp@v0.15.0/server.go:126 +0x169