diff options
author | Thorsten Kukuk <kukuk@thkukuk.de> | 2006-08-05 08:03:11 +0000 |
---|---|---|
committer | Thorsten Kukuk <kukuk@thkukuk.de> | 2006-08-05 08:03:11 +0000 |
commit | 72bcf614b2a5e5f281ca4372fa7dfccf1e6a3c43 (patch) | |
tree | ee1821fdda266c77a0f4ae403fe4358e7c45a47d /xtests/tst-pam_dispatch2.c | |
parent | ea9255e046169e5d5b19370c9ae6292be5aacde0 (diff) | |
download | pam-72bcf614b2a5e5f281ca4372fa7dfccf1e6a3c43.tar.gz pam-72bcf614b2a5e5f281ca4372fa7dfccf1e6a3c43.tar.bz2 pam-72bcf614b2a5e5f281ca4372fa7dfccf1e6a3c43.zip |
Relevant BUGIDs:
Purpose of commit: new feature
Commit summary:
---------------
Add xtests to allow checks for PAM functions only doable in installed
system.
2006-08-05 Thorsten Kukuk <kukuk@thkukuk.de>
* configure.in: Generate xtests/Makefile.
* Makefile.am (SUBDIRS): Add xtests.
* README: Document make check and make xtests.
* xtests/Makefile.am: New.
* xtests/tst-pam_dispatch1.pamd: New.
* xtests/tst-pam_dispatch2.pamd: New.
* xtests/tst-pam_dispatch3.pamd: New.
* xtests/tst-pam_dispatch1.c: New.
* xtests/tst-pam_dispatch2.c: New.
* xtests/tst-pam_dispatch3.c: New.
Diffstat (limited to 'xtests/tst-pam_dispatch2.c')
-rw-r--r-- | xtests/tst-pam_dispatch2.c | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/xtests/tst-pam_dispatch2.c b/xtests/tst-pam_dispatch2.c new file mode 100644 index 00000000..181484f9 --- /dev/null +++ b/xtests/tst-pam_dispatch2.c @@ -0,0 +1,61 @@ + +#include <security/pam_appl.h> +#include <security/pam_misc.h> +#include <stdio.h> + +static struct pam_conv conv = { + misc_conv, + NULL +}; + +static int debug = 0; + +/* + https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=196859 + + This stack should not return PAM_IGNORE to the application: + auth [default=die] pam_debug.so auth=ignore +*/ +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; +} |