tests: Add a module implementation with dynamic control from the app

In order to properly test the interaction of a module transaction from
the application point of view, we need to perform operation in the
module and ensure that the expected values are returned and handled

In order to do this, without using the PAM apis that we want to test,
use a simple trick:
 - Create an application that works as server using an unix socket
 - Create a module that connects to it
 - Pass the socket to the module via the module service file arguments
 - Add some basic protocol that allows the application to send a request
   and to the module to reply to that.
 - Use reflection and serialization to automatically call module methods
   and return the values to the application where we do the check
This commit is contained in:
Marco Trevisan (Treviño)
2023-09-29 02:12:06 +02:00
parent 8c30b5946a
commit c1b7ee1623
8 changed files with 1397 additions and 1 deletions

View File

@@ -11,7 +11,7 @@
//
// For example:
//
// //go:generate go run github.com/msteinert/pam/pam-moduler
// //go:generate go run github.com/msteinert/pam/v2/pam-moduler
// //go:generate go generate --skip="pam_module"
// package main
//