123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899 |
- #ifdef HAVE_CONFIG_H
- #include <config.h>
- #endif
- #include <stdio.h>
- #include <string.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
- test1 (void)
- {
- pam_handle_t *pamh=NULL;
- const char *user="nobody";
- int retval;
- retval = pam_start("tst-pam_dispatch1", user, &conv, &pamh);
- if (retval != PAM_SUCCESS)
- {
- if (debug)
- fprintf (stderr, "test1: pam_start returned %d\n", retval);
- return 1;
- }
- retval = pam_authenticate(pamh, 0);
- if (retval != PAM_PERM_DENIED)
- {
- if (debug)
- fprintf (stderr, "test1: pam_authenticate returned %d\n", retval);
- return 1;
- }
- retval = pam_end(pamh,retval);
- if (retval != PAM_SUCCESS)
- {
- if (debug)
- fprintf (stderr, "test1: 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 (test1 ())
- return 1;
- return 0;
- }
|