mirror of
https://github.com/foxcpp/maddy.git
synced 2025-04-03 05:07:38 +03:00
endpoint/smtp: Fix auth_map ignored
This commit is contained in:
parent
c852199ec9
commit
1d044249c2
2 changed files with 71 additions and 2 deletions
|
@ -289,6 +289,8 @@ func (endp *Endpoint) setConfig(cfg *config.Map) error {
|
|||
return err
|
||||
}
|
||||
|
||||
endp.saslAuth.Log.Debug = endp.Log.Debug
|
||||
|
||||
// INTERNATIONALIZATION: See RFC 6531 Section 3.3.
|
||||
endp.serv.Domain, err = idna.ToASCII(hostname)
|
||||
if err != nil {
|
||||
|
@ -310,8 +312,6 @@ func (endp *Endpoint) setConfig(cfg *config.Map) error {
|
|||
return fmt.Errorf("%s: auth. provider must be set for submission endpoint", endp.name)
|
||||
}
|
||||
}
|
||||
endp.saslAuth.AuthNormalize = endp.authNormalize
|
||||
endp.saslAuth.AuthMap = endp.authMap
|
||||
|
||||
if ioDebug {
|
||||
endp.serv.Debug = endp.Log.DebugWriter()
|
||||
|
|
|
@ -71,26 +71,44 @@ func TestMultipleDomains_SeparateNamespace(tt *testing.T) {
|
|||
t.Run(2)
|
||||
|
||||
user1 := t.Conn("imap")
|
||||
defer user1.Close()
|
||||
user1.ExpectPattern(`\* OK *`)
|
||||
user1.Writeln(`. LOGIN user1@test1.maddy.email user1`)
|
||||
user1.ExpectPattern(`. OK *`)
|
||||
user1.Writeln(`. CREATE user1`)
|
||||
user1.ExpectPattern(`. OK *`)
|
||||
|
||||
user1SMTP := t.Conn("submission")
|
||||
defer user1SMTP.Close()
|
||||
user1SMTP.SMTPNegotation("localhost", []string{"AUTH PLAIN"}, nil)
|
||||
user1SMTP.SMTPPlainAuth("user1@test1.maddy.email", "user1", true)
|
||||
|
||||
user2 := t.Conn("imap")
|
||||
defer user2.Close()
|
||||
user2.ExpectPattern(`\* OK *`)
|
||||
user2.Writeln(`. LOGIN user2@test1.maddy.email user2`)
|
||||
user2.ExpectPattern(`. OK *`)
|
||||
user2.Writeln(`. CREATE user2`)
|
||||
user2.ExpectPattern(`. OK *`)
|
||||
|
||||
user2SMTP := t.Conn("submission")
|
||||
defer user2SMTP.Close()
|
||||
user2SMTP.SMTPNegotation("localhost", []string{"AUTH PLAIN"}, nil)
|
||||
user2SMTP.SMTPPlainAuth("user2@test1.maddy.email", "user2", true)
|
||||
|
||||
user3 := t.Conn("imap")
|
||||
defer user3.Close()
|
||||
user3.ExpectPattern(`\* OK *`)
|
||||
user3.Writeln(`. LOGIN user1@test2.maddy.email user3`)
|
||||
user3.ExpectPattern(`. OK *`)
|
||||
user3.Writeln(`. CREATE user3`)
|
||||
user3.ExpectPattern(`. OK *`)
|
||||
|
||||
user3SMTP := t.Conn("submission")
|
||||
defer user3SMTP.Close()
|
||||
user3SMTP.SMTPNegotation("localhost", []string{"AUTH PLAIN"}, nil)
|
||||
user3SMTP.SMTPPlainAuth("user3@test2.maddy.email", "user3", true)
|
||||
|
||||
user1.Writeln(`. LIST "" "*"`)
|
||||
user1.Expect(`* LIST (\HasNoChildren) "." INBOX`)
|
||||
user1.Expect(`* LIST (\HasNoChildren) "." "user1"`)
|
||||
|
@ -150,26 +168,44 @@ func TestMultipleDomains_SharedCredentials_DistinctMailboxes(tt *testing.T) {
|
|||
t.Run(2)
|
||||
|
||||
user1 := t.Conn("imap")
|
||||
defer user1.Close()
|
||||
user1.ExpectPattern(`\* OK *`)
|
||||
user1.Writeln(`. LOGIN user1@test1.maddy.email user1`)
|
||||
user1.ExpectPattern(`. OK *`)
|
||||
user1.Writeln(`. CREATE user1`)
|
||||
user1.ExpectPattern(`. OK *`)
|
||||
|
||||
user1SMTP := t.Conn("submission")
|
||||
defer user1SMTP.Close()
|
||||
user1SMTP.SMTPNegotation("localhost", []string{"AUTH PLAIN"}, nil)
|
||||
user1SMTP.SMTPPlainAuth("user1@test1.maddy.email", "user1", true)
|
||||
|
||||
user2 := t.Conn("imap")
|
||||
defer user2.Close()
|
||||
user2.ExpectPattern(`\* OK *`)
|
||||
user2.Writeln(`. LOGIN user2@test1.maddy.email user2`)
|
||||
user2.ExpectPattern(`. OK *`)
|
||||
user2.Writeln(`. CREATE user2`)
|
||||
user2.ExpectPattern(`. OK *`)
|
||||
|
||||
user2SMTP := t.Conn("submission")
|
||||
defer user2SMTP.Close()
|
||||
user2SMTP.SMTPNegotation("localhost", []string{"AUTH PLAIN"}, nil)
|
||||
user2SMTP.SMTPPlainAuth("user2@test1.maddy.email", "user2", true)
|
||||
|
||||
user3 := t.Conn("imap")
|
||||
defer user3.Close()
|
||||
user3.ExpectPattern(`\* OK *`)
|
||||
user3.Writeln(`. LOGIN user1@test2.maddy.email user1`)
|
||||
user3.ExpectPattern(`. OK *`)
|
||||
user3.Writeln(`. CREATE user3`)
|
||||
user3.ExpectPattern(`. OK *`)
|
||||
|
||||
user3SMTP := t.Conn("submission")
|
||||
defer user3SMTP.Close()
|
||||
user3SMTP.SMTPNegotation("localhost", []string{"AUTH PLAIN"}, nil)
|
||||
user3SMTP.SMTPPlainAuth("user1@test2.maddy.email", "user1", true)
|
||||
|
||||
user1.Writeln(`. LIST "" "*"`)
|
||||
user1.Expect(`* LIST (\HasNoChildren) "." INBOX`)
|
||||
user1.Expect(`* LIST (\HasNoChildren) "." "user1"`)
|
||||
|
@ -232,30 +268,62 @@ func TestMultipleDomains_SharedCredentials_SharedMailboxes(tt *testing.T) {
|
|||
t.Run(2)
|
||||
|
||||
user1 := t.Conn("imap")
|
||||
defer user1.Close()
|
||||
user1.ExpectPattern(`\* OK *`)
|
||||
user1.Writeln(`. LOGIN user1 user1`)
|
||||
user1.ExpectPattern(`. OK *`)
|
||||
user1.Writeln(`. CREATE user1`)
|
||||
user1.ExpectPattern(`. OK *`)
|
||||
|
||||
user1SMTP := t.Conn("submission")
|
||||
defer user1SMTP.Close()
|
||||
user1SMTP.SMTPNegotation("localhost", []string{"AUTH PLAIN"}, nil)
|
||||
user1SMTP.SMTPPlainAuth("user1", "user1", true)
|
||||
|
||||
user2 := t.Conn("imap")
|
||||
defer user2.Close()
|
||||
user2.ExpectPattern(`\* OK *`)
|
||||
user2.Writeln(`. LOGIN user2@test1.maddy.email user2`)
|
||||
user2.ExpectPattern(`. OK *`)
|
||||
user2.Writeln(`. CREATE user2`)
|
||||
user2.ExpectPattern(`. OK *`)
|
||||
|
||||
user2SMTP := t.Conn("submission")
|
||||
defer user2SMTP.Close()
|
||||
user2SMTP.SMTPNegotation("localhost", []string{"AUTH PLAIN"}, nil)
|
||||
user2SMTP.SMTPPlainAuth("user2", "user2", true)
|
||||
|
||||
user12 := t.Conn("imap")
|
||||
defer user12.Close()
|
||||
user12.ExpectPattern(`\* OK *`)
|
||||
user12.Writeln(`. LOGIN user1@test2.maddy.email user1`)
|
||||
user12.ExpectPattern(`. OK *`)
|
||||
user12.Writeln(`. CREATE user12`)
|
||||
user12.ExpectPattern(`. OK *`)
|
||||
|
||||
user13 := t.Conn("imap")
|
||||
defer user13.Close()
|
||||
user13.ExpectPattern(`\* OK *`)
|
||||
user13.Writeln(`. LOGIN user1@test.maddy.email user1`)
|
||||
user13.ExpectPattern(`. OK *`)
|
||||
user13.Writeln(`. CREATE user13`)
|
||||
user13.ExpectPattern(`. OK *`)
|
||||
|
||||
user12SMTP := t.Conn("submission")
|
||||
defer user12SMTP.Close()
|
||||
user12SMTP.SMTPNegotation("localhost", []string{"AUTH PLAIN"}, nil)
|
||||
user12SMTP.SMTPPlainAuth("user1", "user1", true)
|
||||
|
||||
user13SMTP := t.Conn("submission")
|
||||
defer user13SMTP.Close()
|
||||
user13SMTP.SMTPNegotation("localhost", []string{"AUTH PLAIN"}, nil)
|
||||
user13SMTP.SMTPPlainAuth("user1@test.maddy.email", "user1", true)
|
||||
|
||||
user1.Writeln(`. LIST "" "*"`)
|
||||
user1.Expect(`* LIST (\HasNoChildren) "." INBOX`)
|
||||
user1.Expect(`* LIST (\HasNoChildren) "." "user1"`)
|
||||
user1.Expect(`* LIST (\HasNoChildren) "." "user12"`)
|
||||
user1.Expect(`* LIST (\HasNoChildren) "." "user13"`)
|
||||
user1.ExpectPattern(". OK *")
|
||||
|
||||
user2.Writeln(`. LIST "" "*"`)
|
||||
|
@ -267,5 +335,6 @@ func TestMultipleDomains_SharedCredentials_SharedMailboxes(tt *testing.T) {
|
|||
user12.Expect(`* LIST (\HasNoChildren) "." INBOX`)
|
||||
user12.Expect(`* LIST (\HasNoChildren) "." "user1"`)
|
||||
user12.Expect(`* LIST (\HasNoChildren) "." "user12"`)
|
||||
user12.Expect(`* LIST (\HasNoChildren) "." "user13"`)
|
||||
user12.ExpectPattern(". OK *")
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue