]> granicus.if.org Git - linux-pam/commitdiff
Relevant BUGIDs:
authorThorsten Kukuk <kukuk@thkukuk.de>
Thu, 24 Aug 2006 08:49:19 +0000 (08:49 +0000)
committerThorsten Kukuk <kukuk@thkukuk.de>
Thu, 24 Aug 2006 08:49:19 +0000 (08:49 +0000)
Purpose of commit: new feature

Commit summary:
---------------

Add test for [...] control sequences.

2006-08-24  Thorsten Kukuk  <kukuk@thkukuk.de>

        * xtests/tst-pam_dispatch4.c: New test.
        * xtests/tst-pam_dispatch4.pamd: PAM config for new test.

ChangeLog
xtests/Makefile.am
xtests/tst-pam_dispatch4.c [new file with mode: 0644]
xtests/tst-pam_dispatch4.pamd [new file with mode: 0644]

index 9700600509e41a571b9b4dffd8e1d6791496902c..49b47e7415cbf7b6ca12958f1468f59cbddf254a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2006-08-24  Thorsten Kukuk  <kukuk@thkukuk.de>
+
+       * xtests/tst-pam_dispatch4.c: New test.
+       * xtests/tst-pam_dispatch4.pamd: PAM config for new test.
+
 2006-08-09  Thorsten Kukuk  <kukuk@thkukuk.de>
 
        * release version 0.99.6.1
index 549ef8c91230a0eef17eeaacb3395ecb12207877..44289e2e09d226c788dc4b9b1da23d502ca689f2 100644 (file)
@@ -10,9 +10,10 @@ AM_LDFLAGS = -L$(top_builddir)/libpam -lpam \
 CLEANFILES = *~
 
 EXTRA_DIST = tst-pam_dispatch1.pamd tst-pam_dispatch2.pamd \
-       tst-pam_dispatch3.pamd
+       tst-pam_dispatch3.pamd tst-pam_dispatch4.pamd
 
-XTESTS = tst-pam_dispatch1 tst-pam_dispatch2 tst-pam_dispatch3
+XTESTS = tst-pam_dispatch1 tst-pam_dispatch2 tst-pam_dispatch3 \
+       tst-pam_dispatch4
 
 noinst_PROGRAMS = $(XTESTS)
 
diff --git a/xtests/tst-pam_dispatch4.c b/xtests/tst-pam_dispatch4.c
new file mode 100644 (file)
index 0000000..fc05c8b
--- /dev/null
@@ -0,0 +1,59 @@
+
+#include <stdio.h>
+#include <string.h>
+#include <security/pam_appl.h>
+#include <security/pam_misc.h>
+
+static struct pam_conv conv = {
+    misc_conv,
+    NULL
+};
+
+
+/* Check that errors of optional modules are ignored and that
+   required modules after a sufficient one are not executed.  */
+
+int
+main(int argc, char *argv[])
+{
+  pam_handle_t *pamh=NULL;
+  const char *user="nobody";
+  int retval;
+  int debug = 0;
+
+  if (argc > 1 && strcmp (argv[1], "-d") == 0)
+    debug = 1;
+
+  retval = pam_start("tst-pam_dispatch4", user, &conv, &pamh);
+  if (retval != PAM_SUCCESS)
+    {
+      if (debug)
+       fprintf (stderr, "test4: pam_start returned %d\n", retval);
+      return 1;
+    }
+
+  retval = pam_authenticate (pamh, 0);
+  if (retval != PAM_SUCCESS)
+    {
+      if (debug)
+       fprintf (stderr, "test4: pam_authenticate returned %d\n", retval);
+      return 1;
+    }
+
+  retval = pam_acct_mgmt (pamh, 0);
+  if (retval == PAM_SUCCESS)
+    {
+      if (debug)
+       fprintf (stderr, "test4: pam_authenticate returned %d\n", retval);
+      return 1;
+    }
+
+  retval = pam_end (pamh,retval);
+  if (retval != PAM_SUCCESS)
+    {
+      if (debug)
+       fprintf (stderr, "test4: pam_end returned %d\n", retval);
+      return 1;
+    }
+  return 0;
+}
diff --git a/xtests/tst-pam_dispatch4.pamd b/xtests/tst-pam_dispatch4.pamd
new file mode 100644 (file)
index 0000000..7c08372
--- /dev/null
@@ -0,0 +1,8 @@
+#%PAM-1.0
+# We jump to pam_permit.so, should pass
+auth   [success=1 default=ignore]      pam_debug.so auth=success
+auth   required                        pam_deny.so
+auth   required                        pam_permit.so
+# We jump to a non-existing slot, fail, but don't seg.fault
+account        [success=1 default=ignore]      pam_debug.so account=success
+account        required                        pam_deny.so