mirror of
https://blitiri.com.ar/repos/chasquid
synced 2025-12-18 14:47:03 +00:00
courier: Let the users configure the mail delivery agent
This patch adds configuration options for the MDA binary and command line arguments, and changes the (soon to be renamed) procmail courier to make use of them.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package userdb
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"testing"
|
||||
@@ -41,7 +42,7 @@ func dbEquals(a, b *DB) bool {
|
||||
|
||||
for k, av := range a.users {
|
||||
bv, ok := b.users[k]
|
||||
if !ok || av != bv {
|
||||
if !ok || av.name != bv.name || av.password != bv.password {
|
||||
return false
|
||||
}
|
||||
}
|
||||
@@ -203,6 +204,25 @@ func TestWrite(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestNew(t *testing.T) {
|
||||
fname := fmt.Sprintf("%s/userdb_test-%d", os.TempDir(), os.Getpid())
|
||||
db1 := New(fname)
|
||||
db1.AddUser("user", "passwd")
|
||||
db1.Write()
|
||||
|
||||
db2, ws, err := Load(fname)
|
||||
if err != nil {
|
||||
t.Fatalf("error loading: %v", err)
|
||||
}
|
||||
if len(ws) != 0 {
|
||||
t.Errorf("warnings loading: %v", ws)
|
||||
}
|
||||
|
||||
if !dbEquals(db1, db2) {
|
||||
t.Errorf("databases differ. db1:%v != db2:%v", db1, db2)
|
||||
}
|
||||
}
|
||||
|
||||
func TestInvalidUsername(t *testing.T) {
|
||||
fname := mustCreateDB(t, "")
|
||||
defer removeIfSuccessful(t, fname)
|
||||
|
||||
Reference in New Issue
Block a user