]> granicus.if.org Git - linux-pam/commitdiff
Relevant BUGIDs:
authorThorsten Kukuk <kukuk@thkukuk.de>
Sun, 12 Mar 2006 08:36:42 +0000 (08:36 +0000)
committerThorsten Kukuk <kukuk@thkukuk.de>
Sun, 12 Mar 2006 08:36:42 +0000 (08:36 +0000)
Purpose of commit: new feature

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

Add lot of tests for make check

89 files changed:
ChangeLog
Makefile.am
NEWS
configure.in
modules/pam_access/Makefile.am
modules/pam_access/tst-pam_access [new file with mode: 0755]
modules/pam_cracklib/Makefile.am
modules/pam_cracklib/tst-pam_cracklib [new file with mode: 0755]
modules/pam_debug/Makefile.am
modules/pam_debug/tst-pam_debug [new file with mode: 0755]
modules/pam_deny/Makefile.am
modules/pam_deny/tst-pam_deny [new file with mode: 0755]
modules/pam_echo/Makefile.am
modules/pam_echo/tst-pam_echo [new file with mode: 0755]
modules/pam_env/Makefile.am
modules/pam_env/tst-pam_env [new file with mode: 0755]
modules/pam_exec/Makefile.am
modules/pam_exec/tst-pam_exec [new file with mode: 0755]
modules/pam_filter/Makefile.am
modules/pam_filter/tst-pam_filter [new file with mode: 0755]
modules/pam_ftp/Makefile.am
modules/pam_ftp/tst-pam_ftp [new file with mode: 0755]
modules/pam_group/Makefile.am
modules/pam_group/tst-pam_group [new file with mode: 0755]
modules/pam_issue/Makefile.am
modules/pam_issue/tst-pam_issue [new file with mode: 0755]
modules/pam_lastlog/Makefile.am
modules/pam_lastlog/tst-pam_lastlog [new file with mode: 0755]
modules/pam_limits/Makefile.am
modules/pam_limits/tst-pam_limits [new file with mode: 0755]
modules/pam_listfile/Makefile.am
modules/pam_listfile/tst-pam_listfile [new file with mode: 0755]
modules/pam_localuser/Makefile.am
modules/pam_localuser/tst-pam_localuser [new file with mode: 0755]
modules/pam_mail/Makefile.am
modules/pam_mail/tst-pam_mail [new file with mode: 0755]
modules/pam_mkhomedir/Makefile.am
modules/pam_mkhomedir/tst-pam_mkhomedir [new file with mode: 0755]
modules/pam_motd/Makefile.am
modules/pam_motd/tst-pam_motd [new file with mode: 0755]
modules/pam_nologin/Makefile.am
modules/pam_nologin/tst-pam_nologin [new file with mode: 0755]
modules/pam_permit/Makefile.am
modules/pam_permit/tst-pam_permit [new file with mode: 0755]
modules/pam_rhosts/Makefile.am
modules/pam_rhosts/tst-pam_rhosts [new file with mode: 0755]
modules/pam_rootok/Makefile.am
modules/pam_rootok/tst-pam_rootok [new file with mode: 0755]
modules/pam_securetty/Makefile.am
modules/pam_securetty/tst-pam_securetty [new file with mode: 0755]
modules/pam_selinux/Makefile.am
modules/pam_selinux/tst-pam_selinux [new file with mode: 0755]
modules/pam_shells/Makefile.am
modules/pam_shells/tst-pam_shells [new file with mode: 0755]
modules/pam_stress/Makefile.am
modules/pam_stress/tst-pam_stress [new file with mode: 0755]
modules/pam_succeed_if/Makefile.am
modules/pam_succeed_if/tst-pam_succeed_if [new file with mode: 0755]
modules/pam_tally/Makefile.am
modules/pam_tally/tst-pam_tally [new file with mode: 0755]
modules/pam_time/Makefile.am
modules/pam_time/tst-pam_time [new file with mode: 0755]
modules/pam_umask/Makefile.am
modules/pam_umask/tst-pam_umask [new file with mode: 0755]
modules/pam_unix/Makefile.am
modules/pam_unix/tst-pam_unix [new file with mode: 0755]
modules/pam_userdb/Makefile.am
modules/pam_userdb/tst-pam_userdb [new file with mode: 0755]
modules/pam_warn/Makefile.am
modules/pam_warn/tst-pam_warn [new file with mode: 0755]
modules/pam_wheel/Makefile.am
modules/pam_wheel/tst-pam_wheel [new file with mode: 0755]
modules/pam_xauth/Makefile.am
modules/pam_xauth/tst-pam_xauth [new file with mode: 0755]
tests/.cvsignore [new file with mode: 0644]
tests/Makefile.am [new file with mode: 0644]
tests/tst-dlopen.c [new file with mode: 0644]
tests/tst-pam_acct_mgmt.c [new file with mode: 0644]
tests/tst-pam_authenticate.c [new file with mode: 0644]
tests/tst-pam_chauthtok.c [new file with mode: 0644]
tests/tst-pam_close_session.c [new file with mode: 0644]
tests/tst-pam_end.c [new file with mode: 0644]
tests/tst-pam_fail_delay.c [new file with mode: 0644]
tests/tst-pam_get_item.c [new file with mode: 0644]
tests/tst-pam_getenvlist.c [new file with mode: 0644]
tests/tst-pam_open_session.c [new file with mode: 0644]
tests/tst-pam_set_item.c [new file with mode: 0644]
tests/tst-pam_setcred.c [new file with mode: 0644]
tests/tst-pam_start.c [new file with mode: 0644]

index 2f3145cbeadb360f137c39417aa5397b0261e8cb..fcb091c25390439fd7bcee464bdca4de4b56efa8 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,93 @@
+2006-03-12  Thorsten Kukuk  <kukuk@thkukuk.de>
+
+       * configure.in: create tests/Makefile
+       * Makefile.am (SUBDIRS): Add tests
+       * tests/Makefile.am: New
+       * tests/tst-dlopen.c
+       * tests/tst-pam_acct_mgmt.c
+       * tests/tst-pam_authenticate.c
+       * tests/tst-pam_chauthtok.c
+       * tests/tst-pam_close_session.c
+       * tests/tst-pam_end.c
+       * tests/tst-pam_fail_delay.c
+       * tests/tst-pam_getenvlist.c
+       * tests/tst-pam_get_item.c
+       * tests/tst-pam_open_session.c
+       * tests/tst-pam_setcred.c
+       * tests/tst-pam_set_item.c
+       * tests/tst-pam_start.c
+
+       * modules/pam_access/Makefile.am: Add rules for make check
+       * modules/pam_access/tst-pam_access: New
+       * modules/pam_cracklib/Makefile.am: Add rules for make check
+       * modules/pam_cracklib/tst-pam_cracklib: New
+       * modules/pam_debug/Makefile.am: Add rules for make check
+       * modules/pam_debug/tst-pam_debug: New
+       * modules/pam_deny/Makefile.am: Add rules for make check
+       * modules/pam_deny/tst-pam_deny: New
+       * modules/pam_echo/Makefile.am: Add rules for make check
+       * modules/pam_echo/tst-pam_echo: New
+       * modules/pam_env/Makefile.am: Add rules for make check
+       * modules/pam_env/tst-pam_env: New
+       * modules/pam_exec/Makefile.am: Add rules for make check
+       * modules/pam_exec/tst-pam_exec: New
+       * modules/pam_filter/Makefile.am: Add rules for make check
+       * modules/pam_filter/tst-pam_filter: New
+       * modules/pam_ftp/Makefile.am: Add rules for make check
+       * modules/pam_ftp/tst-pam_ftp: New
+       * modules/pam_group/Makefile.am: Add rules for make check
+       * modules/pam_group/tst-pam_group: New
+       * modules/pam_issue/Makefile.am: Add rules for make check
+       * modules/pam_issue/tst-pam_issue: New
+       * modules/pam_lastlog/Makefile.am: Add rules for make check
+       * modules/pam_lastlog/tst-pam_lastlog: New
+       * modules/pam_limits/Makefile.am: Add rules for make check
+       * modules/pam_limits/tst-pam_limits: New
+       * modules/pam_listfile/Makefile.am: Add rules for make check
+       * modules/pam_listfile/tst-pam_listfile: New
+       * modules/pam_localuser/Makefile.am: Add rules for make check
+       * modules/pam_localuser/tst-pam_localuser: New
+       * modules/pam_mail/Makefile.am: Add rules for make check
+       * modules/pam_mail/tst-pam_mail: New
+       * modules/pam_mkhomedir/Makefile.am: Add rules for make check
+       * modules/pam_mkhomedir/tst-pam_mkhomedir: New
+       * modules/pam_motd/Makefile.am: Add rules for make check
+       * modules/pam_motd/tst-pam_motd: New
+       * modules/pam_nologin/Makefile.am: Add rules for make check
+       * modules/pam_nologin/tst-pam_nologin: New
+       * modules/pam_permit/Makefile.am: Add rules for make check
+       * modules/pam_permit/tst-pam_permit: New
+       * modules/pam_rhosts/Makefile.am: Add rules for make check
+       * modules/pam_rhosts/tst-pam_rhosts: New
+       * modules/pam_rootok/Makefile.am: Add rules for make check
+       * modules/pam_rootok/tst-pam_rootok: New
+       * modules/pam_securetty/Makefile.am: Add rules for make check
+       * modules/pam_securetty/tst-pam_securetty: New
+       * modules/pam_selinux/Makefile.am: Add rules for make check
+       * modules/pam_selinux/tst-pam_selinux: New
+       * modules/pam_shells/Makefile.am: Add rules for make check
+       * modules/pam_shells/tst-pam_shells: New
+       * modules/pam_stress/Makefile.am: Add rules for make check
+       * modules/pam_stress/tst-pam_stress: New
+       * modules/pam_succeed_if/Makefile.am: Add rules for make check
+       * modules/pam_succeed_if/tst-pam_succeed_if: New
+       * modules/pam_tally/Makefile.am: Add rules for make check
+       * modules/pam_tally/tst-pam_tally: New
+       * modules/pam_time/Makefile.am: Add rules for make check
+       * modules/pam_time/tst-pam_time: New
+       * modules/pam_umask/Makefile.am: Add rules for make check
+       * modules/pam_umask/tst-pam_umask: New
+       * modules/pam_unix/Makefile.am: Add rules for make check
+       * modules/pam_unix/tst-pam_unix: New
+       * modules/pam_userdb/Makefile.am: Add rules for make check
+       * modules/pam_userdb/tst-pam_userdb: New
+       * modules/pam_warn/Makefile.am: Add rules for make check
+       * modules/pam_warn/tst-pam_warn: New
+       * modules/pam_wheel/Makefile.am: Add rules for make check
+       * modules/pam_wheel/tst-pam_wheel: New
+       * modules/pam_xauth/Makefile.am: Add rules for make check
+       * modules/pam_xauth/tst-pam_xauth: New
+
 2006-03-11  Thorsten Kukuk  <kukuk@thkukuk.de>
 
        * doc/man/pam_fail_delay.3.xml: New.
index e0e4fca2ab4a07bf18846e2c2f105a84993aa5c2..03b1f2d59870bf1f97d2f2f20a5783da65966889 100644 (file)
@@ -5,9 +5,9 @@
 AUTOMAKE_OPTIONS = 1.9 gnu dist-bzip2 check-news
 
 if STATIC_MODULES
-SUBDIRS = modules libpam libpamc libpam_misc po conf doc examples
+SUBDIRS = modules libpam libpamc libpam_misc tests po conf doc examples
 else
-SUBDIRS = libpam libpamc libpam_misc modules po conf doc examples
+SUBDIRS = libpam tests libpamc libpam_misc modules po conf doc examples
 endif
 
 CLEANFILES = *~
diff --git a/NEWS b/NEWS
index b98de3b4a83faa551a50d8cc935e0b23a16410d9..a9fac77fd2a686832da2349e9b14b06f465cc047 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,6 @@
 Linux-PAM NEWS -- history of user-visible changes.
 
+* Add test suite
 * Fix building of static variants of libpam, libpamc and libpam_misc
 * pam_listfile: Add support for password and session management
 * pam_exec: New PAM module to execute arbitary commands
index 6959c852112b3bdc6434de4979514ead70709151..6f20891d8a7b283596139a31ab589795e31a15ef 100644 (file)
@@ -470,4 +470,4 @@ AC_OUTPUT(Makefile libpam/Makefile libpamc/Makefile libpamc/test/Makefile \
        modules/pam_unix/Makefile modules/pam_userdb/Makefile \
        modules/pam_warn/Makefile modules/pam_wheel/Makefile \
        modules/pam_xauth/Makefile doc/Makefile doc/specs/Makefile \
-       doc/man/Makefile examples/Makefile)
+       doc/man/Makefile examples/Makefile tests/Makefile)
index bb7fdd1bcc2a726b14bc38ba6b400a0450384669..8641b97cab34fbd028ae6a5317f74a5c46f4fbfa 100644 (file)
@@ -4,7 +4,7 @@
 
 CLEANFILES = *~
 
-EXTRA_DIST = README access.conf $(MANS) $(XMLS)
+EXTRA_DIST = README access.conf $(MANS) $(XMLS) tst-pam_access
 
 man_MANS = access.conf.5 pam_access.8
 
@@ -33,3 +33,5 @@ README: pam_access.8.xml access.conf.5.xml
 
 -include $(top_srcdir)/Make.xml.rules
 endif
+
+TESTS = tst-pam_access
diff --git a/modules/pam_access/tst-pam_access b/modules/pam_access/tst-pam_access
new file mode 100755 (executable)
index 0000000..271e69f
--- /dev/null
@@ -0,0 +1,2 @@
+#!/bin/sh
+../../tests/tst-dlopen .libs/pam_access.so
index fcbbfbe5d3e9a04e3f2b8c11a5399b2437fafb9e..cc8d6ff96d773d8e378e82943043f4310d3d4a79 100644 (file)
@@ -4,7 +4,7 @@
 
 CLEANFILES = *~
 
-EXTRA_DIST = README $(MANS) $(XMLS)
+EXTRA_DIST = README $(MANS) $(XMLS) tst-pam_cracklib
 
 man_MANS = pam_cracklib.8
 
@@ -22,6 +22,8 @@ endif
 
 if HAVE_LIBCRACK
 securelib_LTLIBRARIES = pam_cracklib.la
+
+TESTS = tst-pam_cracklib
 endif
 
 pam_cracklib_la_LIBADD = @LIBCRACK@ @LIBCRYPT@
@@ -34,4 +36,3 @@ README: pam_cracklib.8.xml
 
 -include $(top_srcdir)/Make.xml.rules
 endif
-
diff --git a/modules/pam_cracklib/tst-pam_cracklib b/modules/pam_cracklib/tst-pam_cracklib
new file mode 100755 (executable)
index 0000000..46a7060
--- /dev/null
@@ -0,0 +1,2 @@
+#!/bin/sh
+../../tests/tst-dlopen .libs/pam_cracklib.so
index 98be61f1070995559b70c2aa2310bfe5c346e54c..66b9fbe08214ced398c4dffa32d026e75f20a358 100644 (file)
@@ -4,7 +4,7 @@
 
 CLEANFILES = *~
 
-EXTRA_DIST = README
+EXTRA_DIST = README tst-pam_debug
 
 securelibdir = $(SECUREDIR)
 secureconfdir = $(SCONFIGDIR)
@@ -17,3 +17,5 @@ if HAVE_VERSIONING
 endif
 
 securelib_LTLIBRARIES = pam_debug.la
+
+TESTS = tst-pam_debug
diff --git a/modules/pam_debug/tst-pam_debug b/modules/pam_debug/tst-pam_debug
new file mode 100755 (executable)
index 0000000..f07ff64
--- /dev/null
@@ -0,0 +1,2 @@
+#!/bin/sh
+../../tests/tst-dlopen .libs/pam_debug.so
index 17ed901c7874c7f40395377c2780043834c9f930..9837f880121ea3a6cb091bf03c3f43405945f063 100644 (file)
@@ -4,7 +4,7 @@
 
 CLEANFILES = *~
 
-EXTRA_DIST = README $(MANS) $(XMLS)
+EXTRA_DIST = README $(MANS) $(XMLS) tst-pam_deny
 
 man_MANS = pam_deny.8
 
@@ -31,3 +31,4 @@ README: pam_deny.8.xml
 -include $(top_srcdir)/Make.xml.rules
 endif
 
+TESTS = tst-pam_deny
diff --git a/modules/pam_deny/tst-pam_deny b/modules/pam_deny/tst-pam_deny
new file mode 100755 (executable)
index 0000000..7d9d6ba
--- /dev/null
@@ -0,0 +1,2 @@
+#!/bin/sh
+../../tests/tst-dlopen .libs/pam_deny.so
index 0bd3f2b424a0b1db4cc10a526432103a4179f7ce..40415c7b67f0d01d4abdfaec515c794627c6d51d 100644 (file)
@@ -4,7 +4,7 @@
 
 CLEANFILES = *~
 
-EXTRA_DIST = README $(MANS) $(XMLS)
+EXTRA_DIST = README $(MANS) $(XMLS) tst-pam_echo
 
 man_MANS = pam_echo.8
 
@@ -22,9 +22,10 @@ endif
 
 securelib_LTLIBRARIES = pam_echo.la
 
-
 if ENABLE_REGENERATE_MAN
 noinst_DATA = README
 README: pam_echo.8.xml
 -include $(top_srcdir)/Make.xml.rules
 endif
+
+TESTS = tst-pam_echo
diff --git a/modules/pam_echo/tst-pam_echo b/modules/pam_echo/tst-pam_echo
new file mode 100755 (executable)
index 0000000..483a2c2
--- /dev/null
@@ -0,0 +1,2 @@
+#!/bin/sh
+../../tests/tst-dlopen .libs/pam_echo.so
index fe9ba068d20d69b84485d397259f06fce62a8011..287e2534cd1b0b909b4b07bc70b88af71c0623ca 100644 (file)
@@ -4,7 +4,7 @@
 
 CLEANFILES = *~
 
-EXTRA_DIST = README pam_env.conf $(MANS) $(XMLS)
+EXTRA_DIST = README pam_env.conf $(MANS) $(XMLS) tst-pam_env
 
 man_MANS = pam_env.conf.5 pam_env.8
 
@@ -31,3 +31,4 @@ README: pam_env.8.xml pam_env.conf.5.xml
 -include $(top_srcdir)/Make.xml.rules
 endif
 
+TESTS = tst-pam_env
diff --git a/modules/pam_env/tst-pam_env b/modules/pam_env/tst-pam_env
new file mode 100755 (executable)
index 0000000..c40e70a
--- /dev/null
@@ -0,0 +1,2 @@
+#!/bin/sh
+../../tests/tst-dlopen .libs/pam_env.so
index aabf9728115ed0924870e0afbe94d49269b55911..4fc28b283aecdcefd6aefe42c9cc48c68dbf6bb7 100644 (file)
@@ -4,7 +4,7 @@
 
 CLEANFILES = *~
 
-EXTRA_DIST = README $(MANS) $(XMLS)
+EXTRA_DIST = README $(MANS) $(XMLS) tst-pam_exec
 
 man_MANS = pam_exec.8
 
@@ -31,3 +31,4 @@ README: pam_exec.8.xml
 -include $(top_srcdir)/Make.xml.rules
 endif
 
+TESTS = tst-pam_exec
diff --git a/modules/pam_exec/tst-pam_exec b/modules/pam_exec/tst-pam_exec
new file mode 100755 (executable)
index 0000000..a0b0039
--- /dev/null
@@ -0,0 +1,2 @@
+#!/bin/sh
+../../tests/tst-dlopen .libs/pam_exec.so
index 9303431f8d55d7f2cadb433ba39f499aad1ceaaf..ca8d5491ac3123d9b282c12dc2aa777f884a93f0 100644 (file)
@@ -1,12 +1,12 @@
 #
-# Copyright (c) 2005 Thorsten Kukuk <kukuk@suse.de>
+# Copyright (c) 2005, 2006 Thorsten Kukuk <kukuk@suse.de>
 #
 
 SUBDIRS = upperLOWER
 
 CLEANFILES = *~
 
-EXTRA_DIST = README
+EXTRA_DIST = README tst-pam_filter
 
 securelibdir = $(SECUREDIR)
 secureconfdir = $(SCONFIGDIR)
@@ -21,3 +21,4 @@ endif
 include_HEADERS=pam_filter.h
 
 securelib_LTLIBRARIES = pam_filter.la
+TESTS = tst-pam_filter
diff --git a/modules/pam_filter/tst-pam_filter b/modules/pam_filter/tst-pam_filter
new file mode 100755 (executable)
index 0000000..56a5d08
--- /dev/null
@@ -0,0 +1,2 @@
+#!/bin/sh
+../../tests/tst-dlopen .libs/pam_filter.so
index 1cd5cf693ea060fcf9e5e9bea6a31531c60d726b..3f7fb6f90306e40e0a7f9158f9bfae0bfe44bae4 100644 (file)
@@ -4,7 +4,7 @@
 
 CLEANFILES = *~
 
-EXTRA_DIST = README
+EXTRA_DIST = README tst-pam_ftp
 
 securelibdir = $(SECUREDIR)
 secureconfdir = $(SCONFIGDIR)
@@ -17,3 +17,5 @@ if HAVE_VERSIONING
 endif
 
 securelib_LTLIBRARIES = pam_ftp.la
+
+TESTS = tst-pam_ftp
diff --git a/modules/pam_ftp/tst-pam_ftp b/modules/pam_ftp/tst-pam_ftp
new file mode 100755 (executable)
index 0000000..1a4f67c
--- /dev/null
@@ -0,0 +1,2 @@
+#!/bin/sh
+../../tests/tst-dlopen .libs/pam_ftp.so
index abcac34a64d2dc63d531a88cd0f3f31f57094c86..e6a5e4ae65f2fa97053e807789a28a95964c33e8 100644 (file)
@@ -1,10 +1,10 @@
 #
-# Copyright (c) 2005 Thorsten Kukuk <kukuk@suse.de>
+# Copyright (c) 2005, 2006 Thorsten Kukuk <kukuk@suse.de>
 #
 
 CLEANFILES = *~
 
-EXTRA_DIST = README group.conf
+EXTRA_DIST = README group.conf tst-pam_group
 
 securelibdir = $(SECUREDIR)
 secureconfdir = $(SCONFIGDIR)
@@ -20,3 +20,5 @@ endif
 securelib_LTLIBRARIES = pam_group.la
 
 secureconf_DATA = group.conf
+
+TESTS = tst-pam_group
diff --git a/modules/pam_group/tst-pam_group b/modules/pam_group/tst-pam_group
new file mode 100755 (executable)
index 0000000..29f7ba0
--- /dev/null
@@ -0,0 +1,2 @@
+#!/bin/sh
+../../tests/tst-dlopen .libs/pam_group.so
index 02e167c55bc76f257d0e3e11fa9299100ac501ed..8ad994a42485bc2e4d30ea1aeddc7187f694bd61 100644 (file)
@@ -1,9 +1,13 @@
 #
-# Copyright (c) 2005 Thorsten Kukuk <kukuk@suse.de>
+# Copyright (c) 2005, 2006 Thorsten Kukuk <kukuk@suse.de>
 #
 
 CLEANFILES = *~
 
+EXTRA_DIST = tst-pam_issue
+
+TESTS = tst-pam_issue
+
 securelibdir = $(SECUREDIR)
 secureconfdir = $(SCONFIGDIR)
 
diff --git a/modules/pam_issue/tst-pam_issue b/modules/pam_issue/tst-pam_issue
new file mode 100755 (executable)
index 0000000..0fe4f76
--- /dev/null
@@ -0,0 +1,2 @@
+#!/bin/sh
+../../tests/tst-dlopen .libs/pam_issue.so
index cb6cf03cf04b5b861e02642ea1a40ed0f43b68c6..0d678223682ed4c1b49487f93ae94e44ee173cca 100644 (file)
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2005 Thorsten Kukuk <kukuk@suse.de>
+# Copyright (c) 2005, 2006 Thorsten Kukuk <kukuk@suse.de>
 #
 
 CLEANFILES = *~
@@ -7,7 +7,9 @@ CLEANFILES = *~
 securelibdir = $(SECUREDIR)
 secureconfdir = $(SCONFIGDIR)
 
-EXTRADIST = README
+EXTRADIST = README tst-pam_lastlog
+
+TESTS = tst-pam_lastlog
 
 AM_CFLAGS = -I$(top_srcdir)/libpam/include -I$(top_srcdir)/libpamc/include
 AM_LDFLAGS = -no-undefined -avoid-version -module \
diff --git a/modules/pam_lastlog/tst-pam_lastlog b/modules/pam_lastlog/tst-pam_lastlog
new file mode 100755 (executable)
index 0000000..ea9a5eb
--- /dev/null
@@ -0,0 +1,2 @@
+#!/bin/sh
+../../tests/tst-dlopen .libs/pam_lastlog.so
index c671a8f1fd4ffebf782b6eafcafa8c8e7e670640..8f7efaa4c5b88142419997c75e847045a17525fa 100644 (file)
@@ -1,10 +1,12 @@
 #
-# Copyright (c) 2005 Thorsten Kukuk <kukuk@suse.de>
+# Copyright (c) 2005, 2006 Thorsten Kukuk <kukuk@suse.de>
 #
 
 CLEANFILES = *~
 
-EXTRA_DIST = README limits.conf
+EXTRA_DIST = README limits.conf tst-pam_limits
+
+TESTS = tst-pam_limits
 
 securelibdir = $(SECUREDIR)
 secureconfdir = $(SCONFIGDIR)
diff --git a/modules/pam_limits/tst-pam_limits b/modules/pam_limits/tst-pam_limits
new file mode 100755 (executable)
index 0000000..f563beb
--- /dev/null
@@ -0,0 +1,2 @@
+#!/bin/sh
+../../tests/tst-dlopen .libs/pam_limits.so
index 3e4092c3e92480a5fc60b49fab33a73a82d9d18b..114e2f3cc3a06f78c0772b96d5f05170f4c952ce 100644 (file)
@@ -1,10 +1,12 @@
 #
-# Copyright (c) 2005 Thorsten Kukuk <kukuk@suse.de>
+# Copyright (c) 2005, 2006 Thorsten Kukuk <kukuk@suse.de>
 #
 
 CLEANFILES = *~
 
-EXTRA_DIST = README
+EXTRA_DIST = README tst-pam_listfile
+
+TESTS = tst-pam_listfile
 
 securelibdir = $(SECUREDIR)
 secureconfdir = $(SCONFIGDIR)
diff --git a/modules/pam_listfile/tst-pam_listfile b/modules/pam_listfile/tst-pam_listfile
new file mode 100755 (executable)
index 0000000..f555a9f
--- /dev/null
@@ -0,0 +1,2 @@
+#!/bin/sh
+../../tests/tst-dlopen .libs/pam_listfile.so
index 1fdee5b0e8e95e4d7e61b1c13be4a1ac14bc2192..bd5b29ceaaed1fab74cea2e4409a60fd6fac0c16 100644 (file)
@@ -1,10 +1,12 @@
 #
-# Copyright (c) 2005 Thorsten Kukuk <kukuk@suse.de>
+# Copyright (c) 2005, 2006 Thorsten Kukuk <kukuk@suse.de>
 #
 
 CLEANFILES = *~
 
-EXTRA_DIST = README ${MANS}
+EXTRA_DIST = README ${MANS} tst-pam_localuser
+
+TESTS = tst-pam_localuser
 
 man_MANS = pam_localuser.8
 
diff --git a/modules/pam_localuser/tst-pam_localuser b/modules/pam_localuser/tst-pam_localuser
new file mode 100755 (executable)
index 0000000..2bcdf6b
--- /dev/null
@@ -0,0 +1,2 @@
+#!/bin/sh
+../../tests/tst-dlopen .libs/pam_localuser.so
index a70bc7b75319333d34bca5fae2b67825639d3c36..7ba9547255ceba591a24adea1979e9c9db77a9d0 100644 (file)
@@ -1,10 +1,12 @@
 #
-# Copyright (c) 2005 Thorsten Kukuk <kukuk@suse.de>
+# Copyright (c) 2005, 2006 Thorsten Kukuk <kukuk@suse.de>
 #
 
 CLEANFILES = *~
 
-EXTRA_DIST = README
+EXTRA_DIST = README tst-pam_mail
+
+TESTS = tst-pam_mail
 
 securelibdir = $(SECUREDIR)
 secureconfdir = $(SCONFIGDIR)
diff --git a/modules/pam_mail/tst-pam_mail b/modules/pam_mail/tst-pam_mail
new file mode 100755 (executable)
index 0000000..99fb7ed
--- /dev/null
@@ -0,0 +1,2 @@
+#!/bin/sh
+../../tests/tst-dlopen .libs/pam_mail.so
index f795dcd94e3d687c4712aa42c90ed27df0c10f5a..a7bf49bd2bc185a273584160cf402c569e3eb95f 100644 (file)
@@ -1,10 +1,12 @@
 #
-# Copyright (c) 2005 Thorsten Kukuk <kukuk@suse.de>
+# Copyright (c) 2005, 2006 Thorsten Kukuk <kukuk@suse.de>
 #
 
 CLEANFILES = *~
 
-EXTRA_DIST = README
+EXTRA_DIST = README tst-pam_mkhomedir
+
+TESTS = tst-pam_mkhomedir
 
 securelibdir = $(SECUREDIR)
 secureconfdir = $(SCONFIGDIR)
diff --git a/modules/pam_mkhomedir/tst-pam_mkhomedir b/modules/pam_mkhomedir/tst-pam_mkhomedir
new file mode 100755 (executable)
index 0000000..5447883
--- /dev/null
@@ -0,0 +1,2 @@
+#!/bin/sh
+../../tests/tst-dlopen .libs/pam_mkhomedir.so
index 59766b89e8d53d414ebcc2cf92bf8dbd209a7167..21dfc24502fd24280f76422d7a24dd10bc1dc6a7 100644 (file)
@@ -1,9 +1,13 @@
 #
-# Copyright (c) 2005 Thorsten Kukuk <kukuk@suse.de>
+# Copyright (c) 2005, 2006 Thorsten Kukuk <kukuk@suse.de>
 #
 
 CLEANFILES = *~
 
+EXTRA_DIST = tst-pam_motd
+
+TESTS = tst-pam_motd
+
 securelibdir = $(SECUREDIR)
 secureconfdir = $(SCONFIGDIR)
 
diff --git a/modules/pam_motd/tst-pam_motd b/modules/pam_motd/tst-pam_motd
new file mode 100755 (executable)
index 0000000..155e230
--- /dev/null
@@ -0,0 +1,2 @@
+#!/bin/sh
+../../tests/tst-dlopen .libs/pam_motd.so
index d6c061d634b44832a2e052d5ab78279a9a4fee58..f65fb5e18f125c5284e0368c01075111be6339cf 100644 (file)
@@ -1,10 +1,12 @@
 #
-# Copyright (c) 2005 Thorsten Kukuk <kukuk@suse.de>
+# Copyright (c) 2005, 2006 Thorsten Kukuk <kukuk@suse.de>
 #
 
 CLEANFILES = *~
 
-EXTRA_DIST = README $(MANS)
+EXTRA_DIST = README $(MANS) tst-pam_nologin
+
+TESTS = tst-pam_nologin
 
 man_MANS = pam_nologin.8
 
diff --git a/modules/pam_nologin/tst-pam_nologin b/modules/pam_nologin/tst-pam_nologin
new file mode 100755 (executable)
index 0000000..caa91b6
--- /dev/null
@@ -0,0 +1,2 @@
+#!/bin/sh
+../../tests/tst-dlopen .libs/pam_nologin.so
index 82854194f341d9c6a465473954413716d7cc98a5..90a5373d5e6955fe8b52b1d68b16c2d63c5bd5a6 100644 (file)
@@ -1,10 +1,12 @@
 #
-# Copyright (c) 2005 Thorsten Kukuk <kukuk@suse.de>
+# Copyright (c) 2005, 2006 Thorsten Kukuk <kukuk@suse.de>
 #
 
 CLEANFILES = *~
 
-EXTRA_DIST = README
+EXTRA_DIST = README tst-pam_permit
+
+TESTS = tst-pam_permit
 
 securelibdir = $(SECUREDIR)
 secureconfdir = $(SCONFIGDIR)
diff --git a/modules/pam_permit/tst-pam_permit b/modules/pam_permit/tst-pam_permit
new file mode 100755 (executable)
index 0000000..8adb427
--- /dev/null
@@ -0,0 +1,2 @@
+#!/bin/sh
+../../tests/tst-dlopen .libs/pam_permit.so
index ef5f3d0a09337bbbbeb266d498a124cf4de9d07f..5c8cc1883b9f0fdb4e343b1235772f1d41396dcf 100644 (file)
@@ -1,10 +1,12 @@
 #
-# Copyright (c) 2005 Thorsten Kukuk <kukuk@suse.de>
+# Copyright (c) 2005, 2006 Thorsten Kukuk <kukuk@suse.de>
 #
 
 CLEANFILES = *~
 
-EXTRA_DIST = README
+EXTRA_DIST = README tst-pam_rhosts
+
+TESTS = tst-pam_rhosts
 
 securelibdir = $(SECUREDIR)
 secureconfdir = $(SCONFIGDIR)
diff --git a/modules/pam_rhosts/tst-pam_rhosts b/modules/pam_rhosts/tst-pam_rhosts
new file mode 100755 (executable)
index 0000000..6b14ec5
--- /dev/null
@@ -0,0 +1,2 @@
+#!/bin/sh
+../../tests/tst-dlopen .libs/pam_rhosts_auth.so
index 507dc9921b645c9b140e743dd7822c18e53ce2df..f8e2d9c70f6e3d029ca3fbea466e7978e50b8641 100644 (file)
@@ -1,10 +1,12 @@
 #
-# Copyright (c) 2005 Thorsten Kukuk <kukuk@suse.de>
+# Copyright (c) 2005, 2006 Thorsten Kukuk <kukuk@suse.de>
 #
 
 CLEANFILES = *~
 
-EXTRA_DIST = README
+EXTRA_DIST = README tst-pam_rootok
+
+TESTS = tst-pam_rootok
 
 securelibdir = $(SECUREDIR)
 secureconfdir = $(SCONFIGDIR)
diff --git a/modules/pam_rootok/tst-pam_rootok b/modules/pam_rootok/tst-pam_rootok
new file mode 100755 (executable)
index 0000000..385ef76
--- /dev/null
@@ -0,0 +1,2 @@
+#!/bin/sh
+../../tests/tst-dlopen .libs/pam_rootok.so
index 00c46e9fec1983c6ce09d1e08231f921a5393911..1562a9379983692cafb6afe9b927797d40071d86 100644 (file)
@@ -1,10 +1,12 @@
 #
-# Copyright (c) 2005 Thorsten Kukuk <kukuk@suse.de>
+# Copyright (c) 2005, 2006 Thorsten Kukuk <kukuk@suse.de>
 #
 
 CLEANFILES = *~
 
-EXTRA_DIST = README $(MANS)
+EXTRA_DIST = README $(MANS) tst-pam_securetty
+
+TESTS = tst-pam_securetty
 
 man_MANS = pam_securetty.8
 
diff --git a/modules/pam_securetty/tst-pam_securetty b/modules/pam_securetty/tst-pam_securetty
new file mode 100755 (executable)
index 0000000..1252f79
--- /dev/null
@@ -0,0 +1,2 @@
+#!/bin/sh
+../../tests/tst-dlopen .libs/pam_securetty.so
index 0cab19fffa8672b2505f726253c88309c3d6e5f1..d830bf7ea1d04a521db92558f1eac0caddf43b5d 100644 (file)
@@ -1,12 +1,15 @@
 #
-# Copyright (c) 2005 Thorsten Kukuk <kukuk@suse.de>
+# Copyright (c) 2005, 2006 Thorsten Kukuk <kukuk@suse.de>
 #
 
 CLEANFILES = *~
 
-EXTRA_DIST = README ${MANS} pam_selinux_check.8
+EXTRA_DIST = README ${MANS} pam_selinux_check.8 tst-pam_selinux
 
-man_MANS = pam_selinux.8 
+if HAVE_LIBSELINUX
+  TESTS = tst-pam_selinux
+  man_MANS = pam_selinux.8 
+endif
 
 securelibdir = $(SECUREDIR)
 secureconfdir = $(SCONFIGDIR)
diff --git a/modules/pam_selinux/tst-pam_selinux b/modules/pam_selinux/tst-pam_selinux
new file mode 100755 (executable)
index 0000000..14c3d82
--- /dev/null
@@ -0,0 +1,2 @@
+#!/bin/sh
+../../tests/tst-dlopen .libs/pam_selinux.so
index c0d6a6c48e1a13bd8d25e2e7b3655ee63cb9f7e9..06e1421b7c7aeff1a3802b6ca204d951c76fe5e2 100644 (file)
@@ -1,10 +1,12 @@
 #
-# Copyright (c) 2005 Thorsten Kukuk <kukuk@suse.de>
+# Copyright (c) 2005, 2006 Thorsten Kukuk <kukuk@suse.de>
 #
 
 CLEANFILES = *~
 
-EXTRA_DIST = README
+EXTRA_DIST = README tst-pam_shells
+
+TESTS = tst-pam_shells
 
 securelibdir = $(SECUREDIR)
 secureconfdir = $(SCONFIGDIR)
diff --git a/modules/pam_shells/tst-pam_shells b/modules/pam_shells/tst-pam_shells
new file mode 100755 (executable)
index 0000000..dccc33d
--- /dev/null
@@ -0,0 +1,2 @@
+#!/bin/sh
+../../tests/tst-dlopen .libs/pam_shells.so
index 1fcbde7d6527f79681eacaa88f9c877069d995ed..64fe516f275746118999e2988327ea84b507878f 100644 (file)
@@ -1,10 +1,12 @@
 #
-# Copyright (c) 2005 Thorsten Kukuk <kukuk@suse.de>
+# Copyright (c) 2005, 2006 Thorsten Kukuk <kukuk@suse.de>
 #
 
 CLEANFILES = *~
 
-EXTRA_DIST = README
+EXTRA_DIST = README tst-pam_stress
+
+TESTS = tst-pam_stress
 
 securelibdir = $(SECUREDIR)
 secureconfdir = $(SCONFIGDIR)
diff --git a/modules/pam_stress/tst-pam_stress b/modules/pam_stress/tst-pam_stress
new file mode 100755 (executable)
index 0000000..24be756
--- /dev/null
@@ -0,0 +1,2 @@
+#!/bin/sh
+../../tests/tst-dlopen .libs/pam_stress.so
index 57e5abb268e5eef8da9b186c74a2d5bfe913a823..d97f4c1d1a6b86f35e4889ff438d87ca775f3a63 100644 (file)
@@ -1,10 +1,12 @@
 #
-# Copyright (c) 2005 Thorsten Kukuk <kukuk@suse.de>
+# Copyright (c) 2005, 2006 Thorsten Kukuk <kukuk@suse.de>
 #
 
 CLEANFILES = *~
 
-EXTRA_DIST = README ${MANS} ${XMLS}
+EXTRA_DIST = README ${MANS} ${XMLS} tst-pam_succeed_if
+
+TESTS = tst-pam_succeed_if
 
 man_MANS = pam_succeed_if.8
 
@@ -27,4 +29,3 @@ noinst_DATA = README
 README: pam_succeed_if.8.xml
 -include $(top_srcdir)/Make.xml.rules
 endif
-
diff --git a/modules/pam_succeed_if/tst-pam_succeed_if b/modules/pam_succeed_if/tst-pam_succeed_if
new file mode 100755 (executable)
index 0000000..f2b6dd3
--- /dev/null
@@ -0,0 +1,2 @@
+#!/bin/sh
+../../tests/tst-dlopen .libs/pam_succeed_if.so
index c7aacc0d65305db4a3e1cfea16901503f82b48d8..dae3819832539d489e80f065e8234c8983c433fd 100644 (file)
@@ -1,10 +1,12 @@
 #
-# Copyright (c) 2005 Thorsten Kukuk <kukuk@suse.de>
+# Copyright (c) 2005, 2006 Thorsten Kukuk <kukuk@suse.de>
 #
 
 CLEANFILES = *~
 
-EXTRA_DIST = README
+EXTRA_DIST = README tst-pam_tally
+
+TESTS = tst-pam_tally
 
 securelibdir = $(SECUREDIR)
 secureconfdir = $(SCONFIGDIR)
diff --git a/modules/pam_tally/tst-pam_tally b/modules/pam_tally/tst-pam_tally
new file mode 100755 (executable)
index 0000000..15291af
--- /dev/null
@@ -0,0 +1,2 @@
+#!/bin/sh
+../../tests/tst-dlopen .libs/pam_tally.so
index 91632af0682a800a8391c2e064e6bde5ebef9aea..2c77b54a1e912fc8ea0c7fd5cdb00fcc82656dd4 100644 (file)
@@ -1,10 +1,12 @@
 #
-# Copyright (c) 2005 Thorsten Kukuk <kukuk@suse.de>
+# Copyright (c) 2005, 2006 Thorsten Kukuk <kukuk@suse.de>
 #
 
 CLEANFILES = *~
 
-EXTRA_DIST = README time.conf
+EXTRA_DIST = README time.conf tst-pam_time
+
+TESTS = tst-pam_time
 
 securelibdir = $(SECUREDIR)
 secureconfdir = $(SCONFIGDIR)
diff --git a/modules/pam_time/tst-pam_time b/modules/pam_time/tst-pam_time
new file mode 100755 (executable)
index 0000000..030717b
--- /dev/null
@@ -0,0 +1,2 @@
+#!/bin/sh
+../../tests/tst-dlopen .libs/pam_time.so
index 709cbd2855d0d75576106b426418a106c1d2fa39..dc2a3a3b7493d08739a5a6f91f9473d8efe65800 100644 (file)
@@ -1,10 +1,12 @@
 #
-# Copyright (c) 2005 Thorsten Kukuk <kukuk@suse.de>
+# Copyright (c) 2005, 2006 Thorsten Kukuk <kukuk@suse.de>
 #
 
 CLEANFILES = *~
 
-EXTRA_DIST = README
+EXTRA_DIST = README tst-pam_umask
+
+TESTS = tst-pam_umask
 
 securelibdir = $(SECUREDIR)
 secureconfdir = $(SCONFIGDIR)
diff --git a/modules/pam_umask/tst-pam_umask b/modules/pam_umask/tst-pam_umask
new file mode 100755 (executable)
index 0000000..3608a9d
--- /dev/null
@@ -0,0 +1,2 @@
+#!/bin/sh
+../../tests/tst-dlopen .libs/pam_umask.so
index fa7f4139c07751f09ef90ca323d4d8ba9a217101..af658a8dfd2fdfb76ca2f0065d5d8ef02ba0ad14 100644 (file)
@@ -1,10 +1,13 @@
 #
-# Copyright (c) 2005 Thorsten Kukuk <kukuk@suse.de>
+# Copyright (c) 2005, 2006 Thorsten Kukuk <kukuk@suse.de>
 #
 
 CLEANFILES = *~
 
-EXTRA_DIST = README md5.c md5_crypt.c lckpwdf.-c $(MANS) CHANGELOG
+EXTRA_DIST = README md5.c md5_crypt.c lckpwdf.-c $(MANS) CHANGELOG \
+               tst-pam_unix
+
+TESTS = tst-pam_unix
 
 man_MANS = unix_chkpwd.8
 
diff --git a/modules/pam_unix/tst-pam_unix b/modules/pam_unix/tst-pam_unix
new file mode 100755 (executable)
index 0000000..2292280
--- /dev/null
@@ -0,0 +1,2 @@
+#!/bin/sh
+../../tests/tst-dlopen .libs/pam_unix.so
index 320f90bf55f9db95d88a1845365893df64d0536e..6e6a94afbb987331ad08cce480efabb667303307 100644 (file)
@@ -1,10 +1,12 @@
 #
-# Copyright (c) 2005 Thorsten Kukuk <kukuk@suse.de>
+# Copyright (c) 2005, 2006 Thorsten Kukuk <kukuk@suse.de>
 #
 
 CLEANFILES = *~
 
-EXTRA_DIST = README create.pl
+EXTRA_DIST = README create.pl tst-pam_userdb
+
+TESTS = tst-pam_userdb
 
 securelibdir = $(SECUREDIR)
 secureconfdir = $(SCONFIGDIR)
diff --git a/modules/pam_userdb/tst-pam_userdb b/modules/pam_userdb/tst-pam_userdb
new file mode 100755 (executable)
index 0000000..5d5eb19
--- /dev/null
@@ -0,0 +1,2 @@
+#!/bin/sh
+../../tests/tst-dlopen .libs/pam_userdb.so
index 7fab3f41930e0feafc20c8145286663fa1fd4815..49916d0f56a3ee680dcdab8851559c587332718f 100644 (file)
@@ -1,10 +1,12 @@
 #
-# Copyright (c) 2005 Thorsten Kukuk <kukuk@suse.de>
+# Copyright (c) 2005, 2006 Thorsten Kukuk <kukuk@suse.de>
 #
 
 CLEANFILES = *~
 
-EXTRA_DIST = README
+EXTRA_DIST = README tst-pam_warn
+
+TESTS = tst-pam_warn
 
 securelibdir = $(SECUREDIR)
 secureconfdir = $(SCONFIGDIR)
diff --git a/modules/pam_warn/tst-pam_warn b/modules/pam_warn/tst-pam_warn
new file mode 100755 (executable)
index 0000000..0b48365
--- /dev/null
@@ -0,0 +1,2 @@
+#!/bin/sh
+../../tests/tst-dlopen .libs/pam_warn.so
index 52af7a445d17c970004b0c21aaee0fcc9f5f6bef..3405adb3e128be91e7142b7a25345c644e7f6a95 100644 (file)
@@ -1,10 +1,12 @@
 #
-# Copyright (c) 2005 Thorsten Kukuk <kukuk@suse.de>
+# Copyright (c) 2005, 2006 Thorsten Kukuk <kukuk@suse.de>
 #
 
 CLEANFILES = *~
 
-EXTRA_DIST = README
+EXTRA_DIST = README tst-pam_wheel
+
+TESTS = tst-pam_wheel
 
 securelibdir = $(SECUREDIR)
 secureconfdir = $(SCONFIGDIR)
diff --git a/modules/pam_wheel/tst-pam_wheel b/modules/pam_wheel/tst-pam_wheel
new file mode 100755 (executable)
index 0000000..4bf5d6a
--- /dev/null
@@ -0,0 +1,2 @@
+#!/bin/sh
+../../tests/tst-dlopen .libs/pam_wheel.so
index b93099eba6d51d62c5290591519cf0ed655b6b4d..78ff1d789e11097ff023970fbb290fa74d2cd03d 100644 (file)
@@ -1,12 +1,14 @@
 #
-# Copyright (c) 2005 Thorsten Kukuk <kukuk@suse.de>
+# Copyright (c) 2005, 2006 Thorsten Kukuk <kukuk@suse.de>
 #
 
 CLEANFILES = *~
 
 man_MANS = pam_xauth.8
 
-EXTRA_DIST = README ${MANS}
+EXTRA_DIST = README ${MANS} tst-pam_xauth
+
+TESTS = tst-pam_xauth
 
 securelibdir = $(SECUREDIR)
 secureconfdir = $(SCONFIGDIR)
diff --git a/modules/pam_xauth/tst-pam_xauth b/modules/pam_xauth/tst-pam_xauth
new file mode 100755 (executable)
index 0000000..3294896
--- /dev/null
@@ -0,0 +1,2 @@
+#!/bin/sh
+../../tests/tst-dlopen .libs/pam_xauth.so
diff --git a/tests/.cvsignore b/tests/.cvsignore
new file mode 100644 (file)
index 0000000..0ab179e
--- /dev/null
@@ -0,0 +1,18 @@
+Makefile
+Makefile.in
+.deps
+.libs
+*.o
+tst-dlopen
+tst-pam_acct_mgmt
+tst-pam_authenticate
+tst-pam_chauthtok
+tst-pam_close_session
+tst-pam_end
+tst-pam_fail_delay
+tst-pam_get_item
+tst-pam_getenvlist
+tst-pam_open_session
+tst-pam_set_item
+tst-pam_setcred
+tst-pam_start
diff --git a/tests/Makefile.am b/tests/Makefile.am
new file mode 100644 (file)
index 0000000..035a9ce
--- /dev/null
@@ -0,0 +1,18 @@
+#
+# Copyright (c) 2006 Thorsten Kukuk <kukuk@suse.de>
+#
+
+AM_CFLAGS = -DLIBPAM_COMPILE -I$(top_srcdir)/libpam/include 
+AM_LDFLAGS = -L$(top_builddir)/libpam -lpam
+
+CLEANFILES = *~
+
+TESTS = tst-pam_start tst-pam_end tst-pam_fail_delay tst-pam_open_session \
+       tst-pam_close_session tst-pam_acct_mgmt tst-pam_authenticate \
+       tst-pam_chauthtok tst-pam_setcred tst-pam_get_item tst-pam_set_item \
+       tst-pam_getenvlist
+
+check_PROGRAMS = ${TESTS} tst-dlopen
+
+tst_dlopen_LDADD = -L$(top_builddir)/libpam -lpam -ldl
+
diff --git a/tests/tst-dlopen.c b/tests/tst-dlopen.c
new file mode 100644 (file)
index 0000000..9090367
--- /dev/null
@@ -0,0 +1,40 @@
+/*
+   Copyright (C) Nalin Dahyabhai <nalin@redhat.com> 2003
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+*/
+
+#include <dlfcn.h>
+#include <stdio.h>
+#include <limits.h>
+#include <sys/stat.h>
+
+/* Simple program to see if dlopen() would succeed. */
+int main(int argc, char **argv)
+{
+  int i;
+  struct stat st;
+  char buf[PATH_MAX];
+
+  for (i = 1; i < argc; i++) {
+    if (dlopen(argv[i], RTLD_NOW)) {
+      fprintf(stdout, "dlopen() of \"%s\" succeeded.\n",
+              argv[i]);
+    } else {
+      snprintf(buf, sizeof(buf), "./%s", argv[i]);
+      if ((stat(buf, &st) == 0) && dlopen(buf, RTLD_NOW)) {
+        fprintf(stdout, "dlopen() of \"./%s\" "
+                "succeeded.\n", argv[i]);
+      } else {
+        fprintf(stdout, "dlopen() of \"%s\" failed: "
+                "%s\n", argv[i], dlerror());
+        return 1;
+      }
+    }
+  }
+  return 0;
+}
+
diff --git a/tests/tst-pam_acct_mgmt.c b/tests/tst-pam_acct_mgmt.c
new file mode 100644 (file)
index 0000000..8ae4c4d
--- /dev/null
@@ -0,0 +1,54 @@
+/*
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, and the entire permission notice in its entirety,
+ *    including the disclaimer of warranties.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote
+ *    products derived from this software without specific prior
+ *    written permission.
+ *
+ * ALTERNATIVELY, this product may be distributed under the terms of
+ * the GNU Public License, in which case the provisions of the GPL are
+ * required INSTEAD OF the above restrictions.  (This clause is
+ * necessary due to a potential bad interaction between the GPL and
+ * the restrictions contained in a BSD-style copyright.)
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <stdio.h>
+#include <unistd.h>
+
+#include <security/pam_appl.h>
+
+
+int
+main (void)
+{
+  int retval;
+
+  /* 1: Call with NULL as pam handle */
+  retval = pam_acct_mgmt (NULL, 0);
+  if (retval == PAM_SUCCESS)
+    {
+      fprintf (stderr, "pam_acct_mgmt (NULL, 0) returned PAM_SUCCESS\n");
+      return 1;
+    }
+
+  return 0;
+}
diff --git a/tests/tst-pam_authenticate.c b/tests/tst-pam_authenticate.c
new file mode 100644 (file)
index 0000000..20e631a
--- /dev/null
@@ -0,0 +1,54 @@
+/*
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, and the entire permission notice in its entirety,
+ *    including the disclaimer of warranties.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote
+ *    products derived from this software without specific prior
+ *    written permission.
+ *
+ * ALTERNATIVELY, this product may be distributed under the terms of
+ * the GNU Public License, in which case the provisions of the GPL are
+ * required INSTEAD OF the above restrictions.  (This clause is
+ * necessary due to a potential bad interaction between the GPL and
+ * the restrictions contained in a BSD-style copyright.)
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <stdio.h>
+#include <unistd.h>
+
+#include <security/pam_appl.h>
+
+
+int
+main (void)
+{
+  int retval;
+
+  /* 1: Call with NULL as pam handle */
+  retval = pam_authenticate (NULL, 0);
+  if (retval == PAM_SUCCESS)
+    {
+      fprintf (stderr, "tst-pam_authenticate (NULL, 0) returned PAM_SUCCESS\n");
+      return 1;
+    }
+
+  return 0;
+}
diff --git a/tests/tst-pam_chauthtok.c b/tests/tst-pam_chauthtok.c
new file mode 100644 (file)
index 0000000..abe83ed
--- /dev/null
@@ -0,0 +1,54 @@
+/*
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, and the entire permission notice in its entirety,
+ *    including the disclaimer of warranties.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote
+ *    products derived from this software without specific prior
+ *    written permission.
+ *
+ * ALTERNATIVELY, this product may be distributed under the terms of
+ * the GNU Public License, in which case the provisions of the GPL are
+ * required INSTEAD OF the above restrictions.  (This clause is
+ * necessary due to a potential bad interaction between the GPL and
+ * the restrictions contained in a BSD-style copyright.)
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <stdio.h>
+#include <unistd.h>
+
+#include <security/pam_appl.h>
+
+
+int
+main (void)
+{
+  int retval;
+
+  /* 1: Call with NULL as pam handle */
+  retval = pam_chauthtok (NULL, 0);
+  if (retval == PAM_SUCCESS)
+    {
+      fprintf (stderr, "tst-pam_chauthtok (NULL, 0) returned PAM_SUCCESS\n");
+      return 1;
+    }
+
+  return 0;
+}
diff --git a/tests/tst-pam_close_session.c b/tests/tst-pam_close_session.c
new file mode 100644 (file)
index 0000000..3e22208
--- /dev/null
@@ -0,0 +1,54 @@
+/*
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, and the entire permission notice in its entirety,
+ *    including the disclaimer of warranties.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote
+ *    products derived from this software without specific prior
+ *    written permission.
+ *
+ * ALTERNATIVELY, this product may be distributed under the terms of
+ * the GNU Public License, in which case the provisions of the GPL are
+ * required INSTEAD OF the above restrictions.  (This clause is
+ * necessary due to a potential bad interaction between the GPL and
+ * the restrictions contained in a BSD-style copyright.)
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <stdio.h>
+#include <unistd.h>
+
+#include <security/pam_appl.h>
+
+
+int
+main (void)
+{
+  int retval;
+
+  /* 1: Call with NULL as pam handle */
+  retval = pam_close_session (NULL, 0);
+  if (retval == PAM_SUCCESS)
+    {
+      fprintf (stderr, "pam_close_session (NULL, 0) returned PAM_SUCCESS\n");
+      return 1;
+    }
+
+  return 0;
+}
diff --git a/tests/tst-pam_end.c b/tests/tst-pam_end.c
new file mode 100644 (file)
index 0000000..edcd75a
--- /dev/null
@@ -0,0 +1,75 @@
+/*
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, and the entire permission notice in its entirety,
+ *    including the disclaimer of warranties.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote
+ *    products derived from this software without specific prior
+ *    written permission.
+ *
+ * ALTERNATIVELY, this product may be distributed under the terms of
+ * the GNU Public License, in which case the provisions of the GPL are
+ * required INSTEAD OF the above restrictions.  (This clause is
+ * necessary due to a potential bad interaction between the GPL and
+ * the restrictions contained in a BSD-style copyright.)
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <stdio.h>
+#include <unistd.h>
+
+#include <security/pam_appl.h>
+
+
+int
+main (void)
+{
+  const char *service = "dummy";
+  const char *user = "root";
+  struct pam_conv conv;
+  pam_handle_t *pamh;
+  int retval;
+
+  /* 1: close valid pam handle */
+  /* create valid pam handle */
+  retval = pam_start (service, user, &conv, &pamh);
+  if (retval != PAM_SUCCESS)
+    {
+      fprintf (stderr, "pam_start (%s, %s, &conv, &pamh) returned %d\n",
+              service, user, retval);
+      return 1;
+    }
+
+  retval = pam_end (pamh, 0);
+  if (retval != PAM_SUCCESS)
+    {
+      fprintf (stderr, "pam_end (pamh, 0) returned %d\n", retval);
+      return 1;
+    }
+
+  /* 2: close NULL pam handle */
+  retval = pam_end (NULL, 0);
+  if (retval == PAM_SUCCESS)
+    {
+      fprintf (stderr, "pam_end (NULL, 0) returned %d\n", retval);
+      return 1;
+    }
+
+  return 0;
+}
diff --git a/tests/tst-pam_fail_delay.c b/tests/tst-pam_fail_delay.c
new file mode 100644 (file)
index 0000000..f70e4c5
--- /dev/null
@@ -0,0 +1,75 @@
+/*
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, and the entire permission notice in its entirety,
+ *    including the disclaimer of warranties.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote
+ *    products derived from this software without specific prior
+ *    written permission.
+ *
+ * ALTERNATIVELY, this product may be distributed under the terms of
+ * the GNU Public License, in which case the provisions of the GPL are
+ * required INSTEAD OF the above restrictions.  (This clause is
+ * necessary due to a potential bad interaction between the GPL and
+ * the restrictions contained in a BSD-style copyright.)
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <stdio.h>
+#include <unistd.h>
+
+#include <security/pam_appl.h>
+
+
+int
+main (void)
+{
+  const char *service = "dummy";
+  const char *user = "root";
+  struct pam_conv conv;
+  pam_handle_t *pamh;
+  int retval;
+
+  /* 1: set valid delay */
+  /* create valid pam handle */
+  retval = pam_start (service, user, &conv, &pamh);
+  if (retval != PAM_SUCCESS)
+    {
+      fprintf (stderr, "pam_start (%s, %s, &conv, &pamh) returned %d\n",
+              service, user, retval);
+      return 1;
+    }
+
+  retval = pam_fail_delay (pamh, 60);
+  if (retval != PAM_SUCCESS)
+    {
+      fprintf (stderr, "pam_fail_delay (pamh, 60) returned %d\n", retval);
+      return 1;
+    }
+
+  /* 2: use NULL pam handle */
+  retval = pam_fail_delay (NULL, 60);
+  if (retval == PAM_SUCCESS)
+    {
+      fprintf (stderr, "pam_fail_delay (NULL, 60) returned %d\n", retval);
+      return 1;
+    }
+
+  return 0;
+}
diff --git a/tests/tst-pam_get_item.c b/tests/tst-pam_get_item.c
new file mode 100644 (file)
index 0000000..726aa2d
--- /dev/null
@@ -0,0 +1,129 @@
+/*
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, and the entire permission notice in its entirety,
+ *    including the disclaimer of warranties.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote
+ *    products derived from this software without specific prior
+ *    written permission.
+ *
+ * ALTERNATIVELY, this product may be distributed under the terms of
+ * the GNU Public License, in which case the provisions of the GPL are
+ * required INSTEAD OF the above restrictions.  (This clause is
+ * necessary due to a potential bad interaction between the GPL and
+ * the restrictions contained in a BSD-style copyright.)
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <stdio.h>
+#include <unistd.h>
+
+#include <security/pam_appl.h>
+
+struct mapping {
+  int type;
+  const char *string;
+  int expected;
+};
+
+struct mapping items[] = {
+  {PAM_SERVICE, "PAM_SERVICE", PAM_SUCCESS},
+  {PAM_USER, "PAM_USER", 0},
+  {PAM_TTY, "PAM_TTY", 0},
+  {PAM_RHOST, "PAM_RHOST", 0},
+  {PAM_CONV, "PAM_CONV", 0},
+  {PAM_AUTHTOK, "PAM_AUTHTOK", PAM_BAD_ITEM},
+  {PAM_OLDAUTHTOK, "PAM_OLDAUTHTOK", PAM_BAD_ITEM},
+  {PAM_RUSER, "PAM_RUSER", 0},
+  {PAM_USER_PROMPT, "PAM_USER_PROMPT", 0},
+  {PAM_FAIL_DELAY, "PAM_FAIL_DELAY", 0}
+};
+
+int
+main (void)
+{
+  const char *service = "dummy";
+  const char *user = "root";
+  struct pam_conv conv;
+  pam_handle_t *pamh;
+  int retval, num, i;
+  const void *value;
+
+  /* 1: Call with NULL as pam handle */
+  retval = pam_get_item (NULL, PAM_SERVICE, &value);
+  if (retval == PAM_SUCCESS)
+    {
+      fprintf (stderr, "pam_get_item (NULL, 0) returned PAM_SUCCESS\n");
+      return 1;
+    }
+
+  /* setup pam handle */
+  retval = pam_start (service, user, &conv, &pamh);
+  if (retval != PAM_SUCCESS)
+    {
+      fprintf (stderr, "pam_start (%s, %s, &conv, &pamh) returned %d\n",
+               service, user, retval);
+      return 1;
+    }
+
+  /* 2: check for valid item types. Expected return value is
+     PAM_SUCCESS, except it has to fail. */
+  num = sizeof(items) / sizeof(struct mapping);
+
+  for (i = 0; i < num; i++)
+    {
+      retval = pam_get_item (pamh, items[i].type, &value);
+
+      if (retval != items[i].expected)
+       {
+         fprintf (stderr,
+                  "pam_get_item failed to get value for %s. Returned %d\n",
+                  items[i].string, retval);
+         return 1;
+        }
+    }
+
+  /* 3: check for bad item  */
+  retval = pam_get_item (pamh, -1, &value);
+  if (retval != PAM_BAD_ITEM)
+    {
+      fprintf (stderr,
+              "pam_get_item returned %d when expecting PAM_BAD_ITEM\n",
+              retval);
+      return 1;
+    }
+
+  /* 4: check for valid item types, but NULL as value address. */
+  for (i = 0; i < num; i++)
+    {
+      retval = pam_get_item (pamh, items[i].type, NULL);
+
+      if (retval != PAM_PERM_DENIED)
+       {
+         fprintf (stderr,
+                  "pam_get_item returned %d to get value for %s\n",
+                  retval, items[i].string);
+         return 1;
+        }
+    }
+
+  pam_end (pamh, 0);
+
+  return 0;
+}
diff --git a/tests/tst-pam_getenvlist.c b/tests/tst-pam_getenvlist.c
new file mode 100644 (file)
index 0000000..52f2f18
--- /dev/null
@@ -0,0 +1,130 @@
+/*
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, and the entire permission notice in its entirety,
+ *    including the disclaimer of warranties.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote
+ *    products derived from this software without specific prior
+ *    written permission.
+ *
+ * ALTERNATIVELY, this product may be distributed under the terms of
+ * the GNU Public License, in which case the provisions of the GPL are
+ * required INSTEAD OF the above restrictions.  (This clause is
+ * necessary due to a potential bad interaction between the GPL and
+ * the restrictions contained in a BSD-style copyright.)
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <stdio.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <string.h>
+#include <security/pam_appl.h>
+
+const char *envvals[] = {"VAL1=1", "VAL2=2", "VAL3=3"};
+
+int
+main (void)
+{
+  const char *service = "dummy";
+  const char *user = "root";
+  struct pam_conv conv;
+  pam_handle_t *pamh;
+  int retval;
+  char **ptr;
+  char *temp;
+  int var, i;
+
+  /* 1: Call with NULL as pam handle */
+  ptr = pam_getenvlist (NULL);
+  if (ptr != NULL)
+    {
+      fprintf (stderr, "pam_getenvlist (NULL) does not return NULL\n");
+      return 1;
+    }
+
+  /* setup pam handle */
+  retval = pam_start (service, user, &conv, &pamh);
+  if (retval != PAM_SUCCESS)
+    {
+      fprintf (stderr, "pam_start (%s, %s, &conv, &pamh) returned %d\n",
+               service, user, retval);
+      return 1;
+    }
+
+  /* 2: Call with pam handle, but no environment set */
+  ptr = pam_getenvlist (pamh);
+  if (ptr == NULL || *ptr != NULL)
+    {
+      fprintf (stderr,
+              "pam_getenvlist (pamh) does not return pointer to NULL\n");
+      temp = *ptr;
+      var = 0;
+      while (temp)
+       {
+         printf ("%s\n", temp);
+         var++;
+         temp = *(ptr + var);
+       }
+      return 1;
+    }
+  free (ptr);
+
+  /* set environment variable */
+  for (i = 0; i < 3; i++)
+    {
+      retval = pam_putenv (pamh, envvals[i]);
+      if (retval != PAM_SUCCESS)
+       {
+         fprintf (stderr, "pam_putenv (pamh, \"%s\") returned %d\n",
+                  envvals[i], retval);
+         return 1;
+       }
+    }
+
+  /* 3: Call with pam handle and environment set */
+  ptr = pam_getenvlist (pamh);
+  if (ptr == NULL)
+    {
+      fprintf (stderr, "pam_getenvlist (pamh) returned NULL\n");
+      return 1;
+    }
+  else
+    {
+      temp = *ptr;
+      var = 0;
+      while (temp)
+       {
+         if (strcmp (temp, envvals[var]) != 0)
+           {
+             fprintf (stderr,
+                      "pam_getenvlist returns wrong value:\n"
+                      "expected: %s\n"
+                      "got: %s\n", envvals[var], temp);
+             return 1;
+           }
+         free (temp);
+         var++;
+         temp = *(ptr + var);
+       }
+      free (ptr);
+    }
+
+  return 0;
+}
diff --git a/tests/tst-pam_open_session.c b/tests/tst-pam_open_session.c
new file mode 100644 (file)
index 0000000..abbd3f3
--- /dev/null
@@ -0,0 +1,54 @@
+/*
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, and the entire permission notice in its entirety,
+ *    including the disclaimer of warranties.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote
+ *    products derived from this software without specific prior
+ *    written permission.
+ *
+ * ALTERNATIVELY, this product may be distributed under the terms of
+ * the GNU Public License, in which case the provisions of the GPL are
+ * required INSTEAD OF the above restrictions.  (This clause is
+ * necessary due to a potential bad interaction between the GPL and
+ * the restrictions contained in a BSD-style copyright.)
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <stdio.h>
+#include <unistd.h>
+
+#include <security/pam_appl.h>
+
+
+int
+main (void)
+{
+  int retval;
+
+  /* 1: Call with NULL as pam handle */
+  retval = pam_open_session (NULL, 0);
+  if (retval == PAM_SUCCESS)
+    {
+      fprintf (stderr, "pam_open_session (NULL, 0) returned PAM_SUCCESS\n");
+      return 1;
+    }
+
+  return 0;
+}
diff --git a/tests/tst-pam_set_item.c b/tests/tst-pam_set_item.c
new file mode 100644 (file)
index 0000000..ecc68e6
--- /dev/null
@@ -0,0 +1,144 @@
+/*
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, and the entire permission notice in its entirety,
+ *    including the disclaimer of warranties.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote
+ *    products derived from this software without specific prior
+ *    written permission.
+ *
+ * ALTERNATIVELY, this product may be distributed under the terms of
+ * the GNU Public License, in which case the provisions of the GPL are
+ * required INSTEAD OF the above restrictions.  (This clause is
+ * necessary due to a potential bad interaction between the GPL and
+ * the restrictions contained in a BSD-style copyright.)
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <stdio.h>
+#include <unistd.h>
+
+#include <security/pam_appl.h>
+
+struct mapping {
+  int type;
+  const char *string;
+  int expected;
+  const char *new_value;
+};
+
+struct mapping items[] = {
+  {PAM_SERVICE, "PAM_SERVICE", PAM_SUCCESS, "logout"},
+  {PAM_USER, "PAM_USER", PAM_SUCCESS, "noroot"},
+  {PAM_TTY, "PAM_TTY", PAM_SUCCESS, "TTyX"},
+  {PAM_RHOST, "PAM_RHOST", PAM_SUCCESS, "remote"},
+  {PAM_AUTHTOK, "PAM_AUTHTOK", PAM_BAD_ITEM, "none"},
+  {PAM_OLDAUTHTOK, "PAM_OLDAUTHTOK", PAM_BAD_ITEM, "none"},
+  {PAM_RUSER, "PAM_RUSER", PAM_SUCCESS, "noroot"},
+  {PAM_USER_PROMPT, "PAM_USER_PROMPT", PAM_SUCCESS, "your name: "},
+  {PAM_FAIL_DELAY, "PAM_FAIL_DELAY", PAM_SUCCESS, "4000"}
+};
+
+int
+main (void)
+{
+  const char *service = "dummy";
+  const char *user = "root";
+  struct pam_conv conv;
+  pam_handle_t *pamh;
+  int retval, num, i;
+
+  /* 1: Call with NULL as pam handle */
+  retval = pam_set_item (NULL, PAM_SERVICE, "dummy");
+  if (retval == PAM_SUCCESS)
+    {
+      fprintf (stderr, "pam_set_item (NULL, ...) returned PAM_SUCCESS\n");
+      return 1;
+    }
+
+  /* setup pam handle */
+  retval = pam_start (service, user, &conv, &pamh);
+  if (retval != PAM_SUCCESS)
+    {
+      fprintf (stderr, "pam_start (%s, %s, &conv, &pamh) returned %d\n",
+               service, user, retval);
+      return 1;
+    }
+
+  /* 2: check for bad item  */
+  retval = pam_set_item (pamh, -1, "dummy");
+  if (retval != PAM_BAD_ITEM)
+    {
+      fprintf (stderr,
+              "pam_set_item returned %d when expecting PAM_BAD_ITEM\n",
+              retval);
+      return 1;
+    }
+
+  /* 3: try to set PAM_CONV to NULL  */
+  retval = pam_set_item (pamh, PAM_CONV, NULL);
+  if (retval != PAM_PERM_DENIED)
+    {
+      fprintf (stderr,
+              "pam_set_item (pamh, PAM_CONV, NULL) returned %d\n",
+              retval);
+      return 1;
+    }
+
+  /* 4: try to replace all items */
+  num = sizeof(items) / sizeof(struct mapping);
+
+  for (i = 0; i < num; i++)
+    {
+      retval = pam_set_item (pamh, items[i].type, items[i].new_value);
+
+      if (retval != items[i].expected)
+       {
+         fprintf (stderr,
+                  "pam_set_item failed to set value for %s. Returned %d\n",
+                  items[i].string, retval);
+         return 1;
+        }
+      else if (items[i].expected == PAM_SUCCESS)
+       {
+         const void *value;
+
+         retval = pam_get_item (pamh, items[i].type, &value);
+         if (retval != PAM_SUCCESS)
+           {
+             fprintf (stderr,
+                      "pam_get_item was not able to fetch changed value: %d\n",
+                      retval);
+             return 1;
+           }
+         if (strcmp (items[i].new_value, value) != 0)
+           {
+             fprintf (stderr,
+                      "pam_get_item got wrong value:\n"
+                      "expected: %s\n"
+                      "got: %s\n", items[i].new_value, value);
+             return 1;
+           }
+       }
+    }
+
+  pam_end (pamh, 0);
+
+  return 0;
+}
diff --git a/tests/tst-pam_setcred.c b/tests/tst-pam_setcred.c
new file mode 100644 (file)
index 0000000..c9e87c2
--- /dev/null
@@ -0,0 +1,54 @@
+/*
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, and the entire permission notice in its entirety,
+ *    including the disclaimer of warranties.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote
+ *    products derived from this software without specific prior
+ *    written permission.
+ *
+ * ALTERNATIVELY, this product may be distributed under the terms of
+ * the GNU Public License, in which case the provisions of the GPL are
+ * required INSTEAD OF the above restrictions.  (This clause is
+ * necessary due to a potential bad interaction between the GPL and
+ * the restrictions contained in a BSD-style copyright.)
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <stdio.h>
+#include <unistd.h>
+
+#include <security/pam_appl.h>
+
+
+int
+main (void)
+{
+  int retval;
+
+  /* 1: Call with NULL as pam handle */
+  retval = pam_setcred (NULL, 0);
+  if (retval == PAM_SUCCESS)
+    {
+      fprintf (stderr, "pam_setcred (NULL, 0) returned PAM_SUCCESS\n");
+      return 1;
+    }
+
+  return 0;
+}
diff --git a/tests/tst-pam_start.c b/tests/tst-pam_start.c
new file mode 100644 (file)
index 0000000..f50d5e0
--- /dev/null
@@ -0,0 +1,103 @@
+/*
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, and the entire permission notice in its entirety,
+ *    including the disclaimer of warranties.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote
+ *    products derived from this software without specific prior
+ *    written permission.
+ *
+ * ALTERNATIVELY, this product may be distributed under the terms of
+ * the GNU Public License, in which case the provisions of the GPL are
+ * required INSTEAD OF the above restrictions.  (This clause is
+ * necessary due to a potential bad interaction between the GPL and
+ * the restrictions contained in a BSD-style copyright.)
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <stdio.h>
+#include <unistd.h>
+
+#include <security/pam_appl.h>
+
+
+int
+main (void)
+{
+  const char *service = "dummy";
+  const char *user = "root";
+  struct pam_conv conv;
+  pam_handle_t *pamh;
+  int retval;
+
+  /* 1: check with valid arguments */
+  retval = pam_start (service, user, &conv, &pamh);
+  if (retval != PAM_SUCCESS)
+    {
+      fprintf (stderr, "pam_start (%s, %s, &conv, &pamh) returned %d\n",
+              service, user, retval);
+      return 1;
+    }
+  else if (pamh == NULL)
+    {
+      fprintf (stderr,
+              "pam_start (%s, %s, &conv, &pamh) returned NULL for pamh\n",
+              service, user);
+      return 1;
+    }
+
+  /* 2: check with NULL for service */
+  retval = pam_start (NULL, user, &conv, &pamh);
+  if (retval == PAM_SUCCESS)
+    {
+      fprintf (stderr, "pam_start (NULL, %s, &conv, &pamh) returned %d\n",
+              user, retval);
+      return 1;
+    }
+
+  /* 3: check with NULL for user */
+  retval = pam_start (service, NULL, &conv, &pamh);
+  if (retval != PAM_SUCCESS)
+    {
+      fprintf (stderr, "pam_start (%s, NULL, &conv, &pamh) returned %d\n",
+              service, retval);
+      return 1;
+    }
+
+
+  /* 4: check with NULL for conv */
+  retval = pam_start (service, user, NULL, &pamh);
+  if (retval == PAM_SUCCESS)
+    {
+      fprintf (stderr, "pam_start (%s, %s, NULL, &pamh) returned %d\n",
+              service, user, retval);
+      return 1;
+    }
+
+  /* 5: check with NULL for pamh */
+  retval = pam_start (service, user, &conv, NULL);
+  if (retval == PAM_SUCCESS)
+    {
+      fprintf (stderr, "pam_start (%s, %s, &conv, NULL) returned %d\n",
+              service, user, retval);
+      return 1;
+    }
+
+  return 0;
+}