transaction: Add a test finalizer checking if transaction has ended

Check if a transaction is ended in in tests.
This commit is contained in:
Marco Trevisan (Treviño)
2023-10-11 23:09:04 +02:00
parent c635cfc38a
commit c7ecbf20dc
2 changed files with 52 additions and 1 deletions

View File

@@ -173,7 +173,7 @@ func Start(service, user string, handler ConversationHandler) (*Transaction, err
// StartFunc registers the handler func as a conversation handler and starts
// the transaction (see Start() documentation).
func StartFunc(service, user string, handler func(Style, string) (string, error)) (*Transaction, error) {
return Start(service, user, ConversationFunc(handler))
return start(service, user, ConversationFunc(handler), "")
}
// StartConfDir initiates a new PAM transaction. Service is treated identically to
@@ -212,6 +212,7 @@ func start(service, user string, handler ConversationHandler, confDir string) (*
conv: &C.struct_pam_conv{},
c: cgo.NewHandle(handler),
}
C.init_pam_conv(t.conv, C.uintptr_t(t.c))
s := C.CString(service)
defer C.free(unsafe.Pointer(s))