aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRunxi Yu <me@runxiyu.org>2025-01-16 12:33:46 +0800
committerRunxi Yu <me@runxiyu.org>2025-01-16 12:33:46 +0800
commit70300430f281bac71046d8c4179c7912db97623d (patch)
tree6ee796bacc91f2d0ccaba4d1fdd97cbd15eef4de
parentIMAP: Update error message for IMAP (diff)
downloadmaild-70300430f281bac71046d8c4179c7912db97623d.tar.gz
maild-70300430f281bac71046d8c4179c7912db97623d.tar.zst
maild-70300430f281bac71046d8c4179c7912db97623d.zip
IMAP: Parse SASL
-rw-r--r--serve_imap.go8
1 files changed, 7 insertions, 1 deletions
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()