Redact IMAP login errors
This commit is contained in:
parent
9a6150c355
commit
4e51aee1a9
1 changed files with 6 additions and 2 deletions
|
|
@ -123,7 +123,7 @@ func dialIMAP(host string, port int, security string, insecure bool) (*simpleIMA
|
|||
}
|
||||
|
||||
func (c *simpleIMAP) login(user, pass string) error {
|
||||
return c.simple("LOGIN " + imapQuote(user) + " " + imapQuote(pass))
|
||||
return c.simpleLabel("LOGIN "+imapQuote(user)+" "+imapQuote(pass), "LOGIN "+imapQuote(user)+" <redacted>")
|
||||
}
|
||||
|
||||
func (c *simpleIMAP) selectMailbox(name string) error {
|
||||
|
|
@ -131,6 +131,10 @@ func (c *simpleIMAP) selectMailbox(name string) error {
|
|||
}
|
||||
|
||||
func (c *simpleIMAP) simple(cmd string) error {
|
||||
return c.simpleLabel(cmd, cmd)
|
||||
}
|
||||
|
||||
func (c *simpleIMAP) simpleLabel(cmd, label string) error {
|
||||
tag := c.nextTag()
|
||||
if _, err := fmt.Fprintf(c.w, "%s %s\r\n", tag, cmd); err != nil {
|
||||
return err
|
||||
|
|
@ -147,7 +151,7 @@ func (c *simpleIMAP) simple(cmd string) error {
|
|||
if strings.Contains(line, " OK") {
|
||||
return nil
|
||||
}
|
||||
return fmt.Errorf("imap %s failed: %s", cmd, strings.TrimSpace(line))
|
||||
return fmt.Errorf("imap %s failed: %s", label, strings.TrimSpace(line))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue