From 70300430f281bac71046d8c4179c7912db97623d Mon Sep 17 00:00:00 2001 From: Runxi Yu Date: Thu, 16 Jan 2025 12:33:46 +0800 Subject: IMAP: Parse SASL --- serve_imap.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/serve_imap.go b/serve_imap.go index b62f384..524f130 100644 --- a/serve_imap.go +++ b/serve_imap.go @@ -2,6 +2,7 @@ package main import ( "bufio" + "bytes" "context" "crypto/tls" "encoding/base64" @@ -68,7 +69,12 @@ func (session *imap_recv_session) handle(ctx context.Context) error { _ = session.buf_conn.Flush() break switch_cmd } - clog.Debug(fmt.Sprintf("argumetn=%#v", string(argument))) + segments := bytes.Split(argument, []byte{0}) + if len(segments) != 3 { + session.buf_conn.WriteString(" TODO need three sasl segments\r\n") + break switch_cmd + } + authcid, passwd := segments[1], segments[2] default: _, _ = session.buf_conn.WriteString(line + " TODO i don't know this authentication method\r\n") _ = session.buf_conn.Flush() -- cgit v1.2.3