aboutsummaryrefslogtreecommitdiff
path: root/forged/internal/unsorted/lmtp_server.go
diff options
context:
space:
mode:
authorRunxi Yu <me@runxiyu.org>2025-09-07 17:44:34 +0800
committerRunxi Yu <me@runxiyu.org>2025-09-07 17:44:34 +0800
commit0cf6c4a9a28485ea85e85f79bbbf4522abe9eed8 (patch)
treee87014223756b7438f7c2f71e2763914d13c2e8d /forged/internal/unsorted/lmtp_server.go
parentUpdate deps (diff)
downloadforge-0cf6c4a9a28485ea85e85f79bbbf4522abe9eed8.tar.gz
forge-0cf6c4a9a28485ea85e85f79bbbf4522abe9eed8.tar.zst
forge-0cf6c4a9a28485ea85e85f79bbbf4522abe9eed8.zip
Fix LMTP server not getting the server config
Diffstat (limited to 'forged/internal/unsorted/lmtp_server.go')
-rw-r--r--forged/internal/unsorted/lmtp_server.go10
1 files changed, 6 insertions, 4 deletions
diff --git a/forged/internal/unsorted/lmtp_server.go b/forged/internal/unsorted/lmtp_server.go
index 1e94894..a006679 100644
--- a/forged/internal/unsorted/lmtp_server.go
+++ b/forged/internal/unsorted/lmtp_server.go
@@ -20,14 +20,14 @@ import (
"go.lindenii.runxiyu.org/forge/forged/internal/misc"
)
-type lmtpHandler struct{}
+type lmtpHandler struct{s *Server}
type lmtpSession struct {
from string
to []string
ctx context.Context
cancel context.CancelFunc
- s Server
+ s *Server
}
func (session *lmtpSession) Reset() {
@@ -54,17 +54,18 @@ func (session *lmtpSession) Rcpt(to string, _ *smtp.RcptOptions) error {
return nil
}
-func (*lmtpHandler) NewSession(_ *smtp.Conn) (smtp.Session, error) {
+func (h *lmtpHandler) NewSession(_ *smtp.Conn) (smtp.Session, error) {
ctx, cancel := context.WithCancel(context.Background())
session := &lmtpSession{
ctx: ctx,
cancel: cancel,
+ s: h.s,
}
return session, nil
}
func (s *Server) serveLMTP(listener net.Listener) error {
- smtpServer := smtp.NewServer(&lmtpHandler{})
+ smtpServer := smtp.NewServer(&lmtpHandler{s: s})
smtpServer.LMTP = true
smtpServer.Domain = s.config.LMTP.Domain
smtpServer.Addr = s.config.LMTP.Socket
@@ -85,6 +86,7 @@ func (session *lmtpSession) Data(r io.Reader) error {
n int64
)
+ fmt.Printf("%#v\n", session.s)
n, err = io.CopyN(&buf, r, session.s.config.LMTP.MaxSize)
switch {
case n == session.s.config.LMTP.MaxSize: