This function is only needed when using go PAM for creating applications so it's not something we expect to have exported to library modules. To prevent this use an `asPamModule` tag to prevent compilation of application-only features.
25 lines
566 B
Go
25 lines
566 B
Go
//go:build !go_pam_module
|
|
|
|
package pam
|
|
|
|
/*
|
|
#include <security/pam_appl.h>
|
|
#include <stdint.h>
|
|
*/
|
|
import "C"
|
|
|
|
import "runtime/cgo"
|
|
|
|
// _go_pam_conv_handler is a C wrapper for the conversation callback function.
|
|
//
|
|
//export _go_pam_conv_handler
|
|
func _go_pam_conv_handler(msg *C.struct_pam_message, c C.uintptr_t, outMsg **C.char) C.int {
|
|
convHandler, ok := cgo.Handle(c).Value().(ConversationHandler)
|
|
if !ok || convHandler == nil {
|
|
return C.int(ErrConv)
|
|
}
|
|
replyMsg, r := pamConvHandler(Style(msg.msg_style), msg.msg, convHandler)
|
|
*outMsg = replyMsg
|
|
return r
|
|
}
|