b9265b1c6a2ddab51f15749529026feaf787a069
PAM upports binary conversations using private protocols, this can be handled by C but it's not supported here because we implicitly convert all the messages to string, and this may lead to issues when this is not the case (as in binary protocol the pointer could contain zeros that the GoString conversion would consider them the end of the message). So, add another conversation handler implementation that allows to handle the binary protocol, whose function callback accepts a pointer to the struct (we can't use bytes as the length is unknown and may be defined in the header of the pointer itself). However since the binary prompt is not supported by all the platforms we need to do a compile-time check to disable it in case is used when not supported.
Go PAM
This is a Go wrapper for the PAM application API.
Testing
To run the full suite, the tests must be run as the root user. To setup your system for testing, create a user named "test" with the password "secret". For example:
$ sudo useradd test \
-d /tmp/test \
-p '$1$Qd8H95T5$RYSZQeoFbEB.gS19zS99A0' \
-s /bin/false
Then execute the tests:
$ sudo GOPATH=$GOPATH $(which go) test -v
Description
Languages
Go
98.6%
C
1.4%