Does or WILL pam support an asyncronous authentication process? Any suggestions or workarounds for now? It would help me use PAM on a single process/single threaded server that handles multiple clients (using select).
Right now it seems on pam_authenticate(), the server must always block in the conversation function waiting for user input because the modules expect responses from the conversation.
One idea would be to have the conversation function write the prompt to a socket and return PAM_CONV_CONTINUE. This allows the conversation and the module to save the state and allows the pam engine to remember where it was in the module chain.
When a response comes back on the socket for the prompt, the server application calls pam_conv_continue(pamh, my_conv), which forwards the call to the module that received the PAM_CONV_CONTINUE. That module then calls the conversation function again with the received response data (from the socket). The conversation functions put the responses into the response array and returns PAM_SUCCESS.
Here is a sample call path:
<<request auth from server>>
<<create packet from msgs>>
<<send packet to client>>
pamh->continue_with_which_module = this_module;
<< receive request from server for pam responses >>
<< get responses from user, from libpamc interface, whatever...>>
<< send packet with responses to server >>
<<received response from client>>
<< use module pointed to by pamh->continue_with_which_module >>
<< put response into msgs with PAM_CONV_CONTINUE msg type >>
<< put msgs into resps >>
<<authenticate with resps>>
auth_cb(); // cb passed in initial pam_authenticate()
Thanks for looking at this. Any guidance would be very much appreciated.