transaction: Add ModuleTransaction type and ModuleHandler interface

This allows to easily define go-handlers for module operations.

We need to expose few more types externally so that it's possible to
create the module transaction handler and return specific transaction
errors
This commit is contained in:
Marco Trevisan (Treviño)
2023-09-25 18:52:56 +02:00
parent bbc25e137c
commit 11daf4a88d
3 changed files with 165 additions and 1 deletions

View File

@@ -124,11 +124,15 @@ func cbPAMConv(s C.int, msg *C.char, c C.uintptr_t) (*C.char, C.int) {
return C.CString(r), success
}
// NativeHandle is the type of the native PAM handle for a transaction so that
// it can be exported
type NativeHandle = *C.pam_handle_t
// transactionBase is a handler for a PAM transaction that can be used to
// group the operations that can be performed both by the application and the
// module side
type transactionBase struct {
handle *C.pam_handle_t
handle NativeHandle
lastStatus atomic.Int32
}