We mimic what pam_debug.so does by default, by implementing a similar module fully in go, generated using pam-moduler. This requires various utilities to generate the module and run the tests that are in a separate internal modules so that it can be shared between multiple implementations
36 lines
689 B
Go
36 lines
689 B
Go
package utils
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/msteinert/pam/v2"
|
|
)
|
|
|
|
func TestMain(t *testing.T) {
|
|
bm := BaseModule{}
|
|
|
|
if bm.AcctMgmt(nil, pam.Flags(0), nil) != nil {
|
|
t.Fatalf("Unexpected non-nil value")
|
|
}
|
|
|
|
if bm.Authenticate(nil, pam.Flags(0), nil) != nil {
|
|
t.Fatalf("Unexpected non-nil value")
|
|
}
|
|
|
|
if bm.ChangeAuthTok(nil, pam.Flags(0), nil) != nil {
|
|
t.Fatalf("Unexpected non-nil value")
|
|
}
|
|
|
|
if bm.OpenSession(nil, pam.Flags(0), nil) != nil {
|
|
t.Fatalf("Unexpected non-nil value")
|
|
}
|
|
|
|
if bm.CloseSession(nil, pam.Flags(0), nil) != nil {
|
|
t.Fatalf("Unexpected non-nil value")
|
|
}
|
|
|
|
if bm.SetCred(nil, pam.Flags(0), nil) != nil {
|
|
t.Fatalf("Unexpected non-nil value")
|
|
}
|
|
}
|