MCPcopy Create free account
hub / github.com/foxcpp/maddy / AuthPlain

Method AuthPlain

internal/endpoint/smtp/session.go:161–181  ·  view source on GitHub ↗
(username, password string)

Source from the content-addressed store, hash-verified

159}
160
161func (s *Session) AuthPlain(username, password string) error {
162 // Executed before authentication and session initialization.
163 if err := s.endp.pipeline.RunEarlyChecks(context.TODO(), &s.connState); err != nil {
164 return s.endp.wrapErr("", true, "AUTH", err)
165 }
166
167 // saslAuth will handle AuthMap and AuthNormalize.
168 err := s.endp.saslAuth.AuthPlain(username, password)
169 if err != nil {
170 s.endp.log.Error("authentication failed", err, "username", username, "src_ip", s.connState.RemoteAddr)
171
172 failedLogins.WithLabelValues(s.endp.name).Inc()
173
174 return s.endp.authErrorMap(err)
175 }
176
177 s.connState.AuthUser = username
178 s.connState.AuthPassword = password
179
180 return nil
181}
182
183func (s *Session) startDelivery(ctx context.Context, from string, opts smtp.MailOptions) (string, error) {
184 var err error

Callers

nothing calls this directly

Calls 5

RunEarlyChecksMethod · 0.80
wrapErrMethod · 0.80
authErrorMapMethod · 0.80
AuthPlainMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected