1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 |
- #ifdef HAVE_CONFIG_H
- #include <config.h>
- #endif
- #include <stdio.h>
- #include <strings.h>
- #include <security/pam_appl.h>
- #include <security/pam_misc.h>
- static struct pam_conv conv = {
- misc_conv,
- NULL
- };
- static int debug = 0;
- static int
- test2 (void)
- {
- pam_handle_t *pamh=NULL;
- const char *user="nobody";
- int retval;
- retval = pam_start("tst-pam_dispatch2", user, &conv, &pamh);
- if (retval != PAM_SUCCESS)
- {
- if (debug)
- fprintf (stderr, "test2: pam_start returned %d\n", retval);
- return 1;
- }
- retval = pam_authenticate(pamh, 0);
- if (retval != PAM_PERM_DENIED)
- {
- if (debug)
- fprintf (stderr, "test2: pam_authenticate returned %d\n", retval);
- return 1;
- }
- retval = pam_end(pamh,retval);
- if (retval != PAM_SUCCESS)
- {
- if (debug)
- fprintf (stderr, "test2: pam_end returned %d\n", retval);
- return 1;
- }
- return 0;
- }
- int main(int argc, char *argv[])
- {
- if (argc > 1 && strcmp (argv[1], "-d") == 0)
- debug = 1;
- if (test2 ())
- return 1;
- return 0;
- }
|