module-transaction: Add support for initiating PAM Conversations
Modules have the ability to start PAM conversations, so while the transaction code can handle them we did not have a way to init them. Yet. So add some APIs allowing this, making it easier from the go side to handle the conversations. In this commit we only support text-based conversations, but code is designed with the idea of supporting binary cases too. Added the integration tests using the module that is now able to both start conversation and handle them using Go only.
This commit is contained in:
@@ -24,12 +24,30 @@ func (e *SerializablePamError) Error() string {
|
||||
return e.RetStatus.Error()
|
||||
}
|
||||
|
||||
// SerializableStringConvRequest is a serializable string request.
|
||||
type SerializableStringConvRequest struct {
|
||||
Style pam.Style
|
||||
Request string
|
||||
}
|
||||
|
||||
// SerializableStringConvResponse is a serializable string response.
|
||||
type SerializableStringConvResponse struct {
|
||||
Style pam.Style
|
||||
Response string
|
||||
}
|
||||
|
||||
func init() {
|
||||
gob.Register(map[string]string{})
|
||||
gob.Register(Request{})
|
||||
gob.Register(pam.Item(0))
|
||||
gob.Register(pam.Error(0))
|
||||
gob.Register(pam.Style(0))
|
||||
gob.Register([]pam.ConvResponse{})
|
||||
gob.RegisterName("main.SerializablePamError",
|
||||
SerializablePamError{})
|
||||
gob.RegisterName("main.SerializableStringConvRequest",
|
||||
SerializableStringConvRequest{})
|
||||
gob.RegisterName("main.SerializableStringConvResponse",
|
||||
SerializableStringConvResponse{})
|
||||
gob.Register(utils.SerializableError{})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user