(username, password string)
| 159 | } |
| 160 | |
| 161 | func (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 | |
| 183 | func (s *Session) startDelivery(ctx context.Context, from string, opts smtp.MailOptions) (string, error) { |
| 184 | var err error |
nothing calls this directly
no test coverage detected