Listing 4. A Sample Implementation of converse()

static int converse(pam_handle_t * pamh, int ctrl, int nargs
          ,struct pam_message **message
          ,struct pam_response **response)
{
   int retval;
   struct pam_conv *conv;

   retval = pam_get_item(pamh, PAM_CONV, (const void **) &conv);
   if (retval == PAM_SUCCESS) {

      retval = conv->conv(nargs, (const struct pam_message **) message
                ,response, conv->appdata_ptr);

      printf("returned from application's conversation function");

      if (retval != PAM_SUCCESS && on(UNIX_DEBUG, ctrl)) {
         printf("conversation failure\n",);

      }
   printf("ready to return from module conversation");

   return retval;    /* propagate error status */
}