1
0
mirror of https://blitiri.com.ar/repos/chasquid synced 2025-12-22 15:27:02 +00:00

chasquid: Fail at RCPT TO time if a user does not exist

It's more convenient and in line with standard practice to fail RCPT TO if the
user does not exist.

This involves making the server and client aware of aliases, but it doesn't
end up being very convoluted, and simplifies other code.
This commit is contained in:
Alberto Bertogli
2016-09-25 21:46:32 +01:00
parent ce379dea3e
commit 0995eac474
8 changed files with 163 additions and 20 deletions

View File

@@ -283,3 +283,29 @@ func TestRemoveUser(t *testing.T) {
t.Errorf("removal of unknown user succeeded")
}
}
func TestHasUser(t *testing.T) {
fname := mustCreateDB(t, "")
defer removeIfSuccessful(t, fname)
db := mustLoad(t, fname)
if ok := db.HasUser("unknown"); ok {
t.Errorf("unknown user exists")
}
if err := db.AddUser("user", "passwd"); err != nil {
t.Fatalf("error adding user: %v", err)
}
if ok := db.HasUser("unknown"); ok {
t.Errorf("unknown user exists")
}
if ok := db.HasUser("user"); !ok {
t.Errorf("known user does not exist")
}
if ok := db.HasUser("user"); !ok {
t.Errorf("known user does not exist")
}
}