LJ Archive

Listing 3. A Basic Implemenation of pam_sm_setcred

PAM_EXTERN int pam_sm_setcred(pam_handle_t * pamh, int flags
               ,int argc, const char **argv)
{
   unsigned int ctrl;
   int retval;

   ctrl =  _set_ctrl(pamh, flags, NULL, argc, argv);
   retval = PAM_SUCCESS;

   printf("recovering return code from auth call");
   pam_get_data(pamh, "unix_setcred_return", (const void **) pretval);
   if(pretval) {
      retval = *pretval;
      free(pretval);
      printf("recovered data indicates that old retval was %d", retval);
   }

   return retval;
}
LJ Archive