pam-moduler: Add first implementation of a Go PAM Module generator
A PAM module can be generated using pam-moduler and implemented fully in go without having to manually deal with the C setup. Module can be compiled using go generate, so go:generate directives can be used to make this process automatic, with a single go generate call as shown in the example.
This commit is contained in:
@@ -15,7 +15,9 @@ type ModuleTransaction interface {
|
||||
type ModuleHandlerFunc func(ModuleTransaction, Flags, []string) error
|
||||
|
||||
// ModuleTransaction is the module-side handle for a PAM transaction.
|
||||
type moduleTransaction = transactionBase
|
||||
type moduleTransaction struct {
|
||||
transactionBase
|
||||
}
|
||||
|
||||
// ModuleHandler is an interface for objects that can be used to create
|
||||
// PAM modules from go.
|
||||
@@ -27,3 +29,9 @@ type ModuleHandler interface {
|
||||
OpenSession(ModuleTransaction, Flags, []string) error
|
||||
SetCred(ModuleTransaction, Flags, []string) error
|
||||
}
|
||||
|
||||
// NewModuleTransaction allows initializing a transaction invoker from
|
||||
// the module side.
|
||||
func NewModuleTransaction(handle NativeHandle) ModuleTransaction {
|
||||
return &moduleTransaction{transactionBase{handle: handle}}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user