From 993d5e30fa9085a05cc8231c49750e8bcc03170e Mon Sep 17 00:00:00 2001 From: Thorsten Kukuk Date: Sun, 12 Mar 2006 08:36:42 +0000 Subject: Relevant BUGIDs: Purpose of commit: new feature Commit summary: --------------- Add lot of tests for make check --- ChangeLog | 90 +++++++++++++++++++ Makefile.am | 4 +- NEWS | 1 + configure.in | 2 +- modules/pam_access/Makefile.am | 4 +- modules/pam_access/tst-pam_access | 2 + modules/pam_cracklib/Makefile.am | 5 +- modules/pam_cracklib/tst-pam_cracklib | 2 + modules/pam_debug/Makefile.am | 4 +- modules/pam_debug/tst-pam_debug | 2 + modules/pam_deny/Makefile.am | 3 +- modules/pam_deny/tst-pam_deny | 2 + modules/pam_echo/Makefile.am | 5 +- modules/pam_echo/tst-pam_echo | 2 + modules/pam_env/Makefile.am | 3 +- modules/pam_env/tst-pam_env | 2 + modules/pam_exec/Makefile.am | 3 +- modules/pam_exec/tst-pam_exec | 2 + modules/pam_filter/Makefile.am | 5 +- modules/pam_filter/tst-pam_filter | 2 + modules/pam_ftp/Makefile.am | 4 +- modules/pam_ftp/tst-pam_ftp | 2 + modules/pam_group/Makefile.am | 6 +- modules/pam_group/tst-pam_group | 2 + modules/pam_issue/Makefile.am | 6 +- modules/pam_issue/tst-pam_issue | 2 + modules/pam_lastlog/Makefile.am | 6 +- modules/pam_lastlog/tst-pam_lastlog | 2 + modules/pam_limits/Makefile.am | 6 +- modules/pam_limits/tst-pam_limits | 2 + modules/pam_listfile/Makefile.am | 6 +- modules/pam_listfile/tst-pam_listfile | 2 + modules/pam_localuser/Makefile.am | 6 +- modules/pam_localuser/tst-pam_localuser | 2 + modules/pam_mail/Makefile.am | 6 +- modules/pam_mail/tst-pam_mail | 2 + modules/pam_mkhomedir/Makefile.am | 6 +- modules/pam_mkhomedir/tst-pam_mkhomedir | 2 + modules/pam_motd/Makefile.am | 6 +- modules/pam_motd/tst-pam_motd | 2 + modules/pam_nologin/Makefile.am | 6 +- modules/pam_nologin/tst-pam_nologin | 2 + modules/pam_permit/Makefile.am | 6 +- modules/pam_permit/tst-pam_permit | 2 + modules/pam_rhosts/Makefile.am | 6 +- modules/pam_rhosts/tst-pam_rhosts | 2 + modules/pam_rootok/Makefile.am | 6 +- modules/pam_rootok/tst-pam_rootok | 2 + modules/pam_securetty/Makefile.am | 6 +- modules/pam_securetty/tst-pam_securetty | 2 + modules/pam_selinux/Makefile.am | 9 +- modules/pam_selinux/tst-pam_selinux | 2 + modules/pam_shells/Makefile.am | 6 +- modules/pam_shells/tst-pam_shells | 2 + modules/pam_stress/Makefile.am | 6 +- modules/pam_stress/tst-pam_stress | 2 + modules/pam_succeed_if/Makefile.am | 7 +- modules/pam_succeed_if/tst-pam_succeed_if | 2 + modules/pam_tally/Makefile.am | 6 +- modules/pam_tally/tst-pam_tally | 2 + modules/pam_time/Makefile.am | 6 +- modules/pam_time/tst-pam_time | 2 + modules/pam_umask/Makefile.am | 6 +- modules/pam_umask/tst-pam_umask | 2 + modules/pam_unix/Makefile.am | 7 +- modules/pam_unix/tst-pam_unix | 2 + modules/pam_userdb/Makefile.am | 6 +- modules/pam_userdb/tst-pam_userdb | 2 + modules/pam_warn/Makefile.am | 6 +- modules/pam_warn/tst-pam_warn | 2 + modules/pam_wheel/Makefile.am | 6 +- modules/pam_wheel/tst-pam_wheel | 2 + modules/pam_xauth/Makefile.am | 6 +- modules/pam_xauth/tst-pam_xauth | 2 + tests/.cvsignore | 18 ++++ tests/Makefile.am | 18 ++++ tests/tst-dlopen.c | 40 +++++++++ tests/tst-pam_acct_mgmt.c | 54 +++++++++++ tests/tst-pam_authenticate.c | 54 +++++++++++ tests/tst-pam_chauthtok.c | 54 +++++++++++ tests/tst-pam_close_session.c | 54 +++++++++++ tests/tst-pam_end.c | 75 ++++++++++++++++ tests/tst-pam_fail_delay.c | 75 ++++++++++++++++ tests/tst-pam_get_item.c | 129 ++++++++++++++++++++++++++ tests/tst-pam_getenvlist.c | 130 +++++++++++++++++++++++++++ tests/tst-pam_open_session.c | 54 +++++++++++ tests/tst-pam_set_item.c | 144 ++++++++++++++++++++++++++++++ tests/tst-pam_setcred.c | 54 +++++++++++ tests/tst-pam_start.c | 103 +++++++++++++++++++++ 89 files changed, 1353 insertions(+), 67 deletions(-) create mode 100755 modules/pam_access/tst-pam_access create mode 100755 modules/pam_cracklib/tst-pam_cracklib create mode 100755 modules/pam_debug/tst-pam_debug create mode 100755 modules/pam_deny/tst-pam_deny create mode 100755 modules/pam_echo/tst-pam_echo create mode 100755 modules/pam_env/tst-pam_env create mode 100755 modules/pam_exec/tst-pam_exec create mode 100755 modules/pam_filter/tst-pam_filter create mode 100755 modules/pam_ftp/tst-pam_ftp create mode 100755 modules/pam_group/tst-pam_group create mode 100755 modules/pam_issue/tst-pam_issue create mode 100755 modules/pam_lastlog/tst-pam_lastlog create mode 100755 modules/pam_limits/tst-pam_limits create mode 100755 modules/pam_listfile/tst-pam_listfile create mode 100755 modules/pam_localuser/tst-pam_localuser create mode 100755 modules/pam_mail/tst-pam_mail create mode 100755 modules/pam_mkhomedir/tst-pam_mkhomedir create mode 100755 modules/pam_motd/tst-pam_motd create mode 100755 modules/pam_nologin/tst-pam_nologin create mode 100755 modules/pam_permit/tst-pam_permit create mode 100755 modules/pam_rhosts/tst-pam_rhosts create mode 100755 modules/pam_rootok/tst-pam_rootok create mode 100755 modules/pam_securetty/tst-pam_securetty create mode 100755 modules/pam_selinux/tst-pam_selinux create mode 100755 modules/pam_shells/tst-pam_shells create mode 100755 modules/pam_stress/tst-pam_stress create mode 100755 modules/pam_succeed_if/tst-pam_succeed_if create mode 100755 modules/pam_tally/tst-pam_tally create mode 100755 modules/pam_time/tst-pam_time create mode 100755 modules/pam_umask/tst-pam_umask create mode 100755 modules/pam_unix/tst-pam_unix create mode 100755 modules/pam_userdb/tst-pam_userdb create mode 100755 modules/pam_warn/tst-pam_warn create mode 100755 modules/pam_wheel/tst-pam_wheel create mode 100755 modules/pam_xauth/tst-pam_xauth create mode 100644 tests/.cvsignore create mode 100644 tests/Makefile.am create mode 100644 tests/tst-dlopen.c create mode 100644 tests/tst-pam_acct_mgmt.c create mode 100644 tests/tst-pam_authenticate.c create mode 100644 tests/tst-pam_chauthtok.c create mode 100644 tests/tst-pam_close_session.c create mode 100644 tests/tst-pam_end.c create mode 100644 tests/tst-pam_fail_delay.c create mode 100644 tests/tst-pam_get_item.c create mode 100644 tests/tst-pam_getenvlist.c create mode 100644 tests/tst-pam_open_session.c create mode 100644 tests/tst-pam_set_item.c create mode 100644 tests/tst-pam_setcred.c create mode 100644 tests/tst-pam_start.c diff --git a/ChangeLog b/ChangeLog index 2f3145cb..fcb091c2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,93 @@ +2006-03-12 Thorsten Kukuk + + * 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 * doc/man/pam_fail_delay.3.xml: New. diff --git a/Makefile.am b/Makefile.am index e0e4fca2..03b1f2d5 100644 --- a/Makefile.am +++ b/Makefile.am @@ -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 b98de3b4..a9fac77f 100644 --- 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 diff --git a/configure.in b/configure.in index 6959c852..6f20891d 100644 --- a/configure.in +++ b/configure.in @@ -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) diff --git a/modules/pam_access/Makefile.am b/modules/pam_access/Makefile.am index bb7fdd1b..8641b97c 100644 --- a/modules/pam_access/Makefile.am +++ b/modules/pam_access/Makefile.am @@ -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 index 00000000..271e69fe --- /dev/null +++ b/modules/pam_access/tst-pam_access @@ -0,0 +1,2 @@ +#!/bin/sh +../../tests/tst-dlopen .libs/pam_access.so diff --git a/modules/pam_cracklib/Makefile.am b/modules/pam_cracklib/Makefile.am index fcbbfbe5..cc8d6ff9 100644 --- a/modules/pam_cracklib/Makefile.am +++ b/modules/pam_cracklib/Makefile.am @@ -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 index 00000000..46a7060d --- /dev/null +++ b/modules/pam_cracklib/tst-pam_cracklib @@ -0,0 +1,2 @@ +#!/bin/sh +../../tests/tst-dlopen .libs/pam_cracklib.so diff --git a/modules/pam_debug/Makefile.am b/modules/pam_debug/Makefile.am index 98be61f1..66b9fbe0 100644 --- a/modules/pam_debug/Makefile.am +++ b/modules/pam_debug/Makefile.am @@ -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 index 00000000..f07ff640 --- /dev/null +++ b/modules/pam_debug/tst-pam_debug @@ -0,0 +1,2 @@ +#!/bin/sh +../../tests/tst-dlopen .libs/pam_debug.so diff --git a/modules/pam_deny/Makefile.am b/modules/pam_deny/Makefile.am index 17ed901c..9837f880 100644 --- a/modules/pam_deny/Makefile.am +++ b/modules/pam_deny/Makefile.am @@ -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 index 00000000..7d9d6bad --- /dev/null +++ b/modules/pam_deny/tst-pam_deny @@ -0,0 +1,2 @@ +#!/bin/sh +../../tests/tst-dlopen .libs/pam_deny.so diff --git a/modules/pam_echo/Makefile.am b/modules/pam_echo/Makefile.am index 0bd3f2b4..40415c7b 100644 --- a/modules/pam_echo/Makefile.am +++ b/modules/pam_echo/Makefile.am @@ -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 index 00000000..483a2c23 --- /dev/null +++ b/modules/pam_echo/tst-pam_echo @@ -0,0 +1,2 @@ +#!/bin/sh +../../tests/tst-dlopen .libs/pam_echo.so diff --git a/modules/pam_env/Makefile.am b/modules/pam_env/Makefile.am index fe9ba068..287e2534 100644 --- a/modules/pam_env/Makefile.am +++ b/modules/pam_env/Makefile.am @@ -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 index 00000000..c40e70a8 --- /dev/null +++ b/modules/pam_env/tst-pam_env @@ -0,0 +1,2 @@ +#!/bin/sh +../../tests/tst-dlopen .libs/pam_env.so diff --git a/modules/pam_exec/Makefile.am b/modules/pam_exec/Makefile.am index aabf9728..4fc28b28 100644 --- a/modules/pam_exec/Makefile.am +++ b/modules/pam_exec/Makefile.am @@ -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 index 00000000..a0b00393 --- /dev/null +++ b/modules/pam_exec/tst-pam_exec @@ -0,0 +1,2 @@ +#!/bin/sh +../../tests/tst-dlopen .libs/pam_exec.so diff --git a/modules/pam_filter/Makefile.am b/modules/pam_filter/Makefile.am index 9303431f..ca8d5491 100644 --- a/modules/pam_filter/Makefile.am +++ b/modules/pam_filter/Makefile.am @@ -1,12 +1,12 @@ # -# Copyright (c) 2005 Thorsten Kukuk +# Copyright (c) 2005, 2006 Thorsten Kukuk # 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 index 00000000..56a5d083 --- /dev/null +++ b/modules/pam_filter/tst-pam_filter @@ -0,0 +1,2 @@ +#!/bin/sh +../../tests/tst-dlopen .libs/pam_filter.so diff --git a/modules/pam_ftp/Makefile.am b/modules/pam_ftp/Makefile.am index 1cd5cf69..3f7fb6f9 100644 --- a/modules/pam_ftp/Makefile.am +++ b/modules/pam_ftp/Makefile.am @@ -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 index 00000000..1a4f67c7 --- /dev/null +++ b/modules/pam_ftp/tst-pam_ftp @@ -0,0 +1,2 @@ +#!/bin/sh +../../tests/tst-dlopen .libs/pam_ftp.so diff --git a/modules/pam_group/Makefile.am b/modules/pam_group/Makefile.am index abcac34a..e6a5e4ae 100644 --- a/modules/pam_group/Makefile.am +++ b/modules/pam_group/Makefile.am @@ -1,10 +1,10 @@ # -# Copyright (c) 2005 Thorsten Kukuk +# Copyright (c) 2005, 2006 Thorsten Kukuk # 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 index 00000000..29f7ba06 --- /dev/null +++ b/modules/pam_group/tst-pam_group @@ -0,0 +1,2 @@ +#!/bin/sh +../../tests/tst-dlopen .libs/pam_group.so diff --git a/modules/pam_issue/Makefile.am b/modules/pam_issue/Makefile.am index 02e167c5..8ad994a4 100644 --- a/modules/pam_issue/Makefile.am +++ b/modules/pam_issue/Makefile.am @@ -1,9 +1,13 @@ # -# Copyright (c) 2005 Thorsten Kukuk +# Copyright (c) 2005, 2006 Thorsten Kukuk # 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 index 00000000..0fe4f763 --- /dev/null +++ b/modules/pam_issue/tst-pam_issue @@ -0,0 +1,2 @@ +#!/bin/sh +../../tests/tst-dlopen .libs/pam_issue.so diff --git a/modules/pam_lastlog/Makefile.am b/modules/pam_lastlog/Makefile.am index cb6cf03c..0d678223 100644 --- a/modules/pam_lastlog/Makefile.am +++ b/modules/pam_lastlog/Makefile.am @@ -1,5 +1,5 @@ # -# Copyright (c) 2005 Thorsten Kukuk +# Copyright (c) 2005, 2006 Thorsten Kukuk # 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 index 00000000..ea9a5eb0 --- /dev/null +++ b/modules/pam_lastlog/tst-pam_lastlog @@ -0,0 +1,2 @@ +#!/bin/sh +../../tests/tst-dlopen .libs/pam_lastlog.so diff --git a/modules/pam_limits/Makefile.am b/modules/pam_limits/Makefile.am index c671a8f1..8f7efaa4 100644 --- a/modules/pam_limits/Makefile.am +++ b/modules/pam_limits/Makefile.am @@ -1,10 +1,12 @@ # -# Copyright (c) 2005 Thorsten Kukuk +# Copyright (c) 2005, 2006 Thorsten Kukuk # 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 index 00000000..f563beb7 --- /dev/null +++ b/modules/pam_limits/tst-pam_limits @@ -0,0 +1,2 @@ +#!/bin/sh +../../tests/tst-dlopen .libs/pam_limits.so diff --git a/modules/pam_listfile/Makefile.am b/modules/pam_listfile/Makefile.am index 3e4092c3..114e2f3c 100644 --- a/modules/pam_listfile/Makefile.am +++ b/modules/pam_listfile/Makefile.am @@ -1,10 +1,12 @@ # -# Copyright (c) 2005 Thorsten Kukuk +# Copyright (c) 2005, 2006 Thorsten Kukuk # 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 index 00000000..f555a9f5 --- /dev/null +++ b/modules/pam_listfile/tst-pam_listfile @@ -0,0 +1,2 @@ +#!/bin/sh +../../tests/tst-dlopen .libs/pam_listfile.so diff --git a/modules/pam_localuser/Makefile.am b/modules/pam_localuser/Makefile.am index 1fdee5b0..bd5b29ce 100644 --- a/modules/pam_localuser/Makefile.am +++ b/modules/pam_localuser/Makefile.am @@ -1,10 +1,12 @@ # -# Copyright (c) 2005 Thorsten Kukuk +# Copyright (c) 2005, 2006 Thorsten Kukuk # 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 index 00000000..2bcdf6b9 --- /dev/null +++ b/modules/pam_localuser/tst-pam_localuser @@ -0,0 +1,2 @@ +#!/bin/sh +../../tests/tst-dlopen .libs/pam_localuser.so diff --git a/modules/pam_mail/Makefile.am b/modules/pam_mail/Makefile.am index a70bc7b7..7ba95472 100644 --- a/modules/pam_mail/Makefile.am +++ b/modules/pam_mail/Makefile.am @@ -1,10 +1,12 @@ # -# Copyright (c) 2005 Thorsten Kukuk +# Copyright (c) 2005, 2006 Thorsten Kukuk # 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 index 00000000..99fb7ed0 --- /dev/null +++ b/modules/pam_mail/tst-pam_mail @@ -0,0 +1,2 @@ +#!/bin/sh +../../tests/tst-dlopen .libs/pam_mail.so diff --git a/modules/pam_mkhomedir/Makefile.am b/modules/pam_mkhomedir/Makefile.am index f795dcd9..a7bf49bd 100644 --- a/modules/pam_mkhomedir/Makefile.am +++ b/modules/pam_mkhomedir/Makefile.am @@ -1,10 +1,12 @@ # -# Copyright (c) 2005 Thorsten Kukuk +# Copyright (c) 2005, 2006 Thorsten Kukuk # 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 index 00000000..5447883f --- /dev/null +++ b/modules/pam_mkhomedir/tst-pam_mkhomedir @@ -0,0 +1,2 @@ +#!/bin/sh +../../tests/tst-dlopen .libs/pam_mkhomedir.so diff --git a/modules/pam_motd/Makefile.am b/modules/pam_motd/Makefile.am index 59766b89..21dfc245 100644 --- a/modules/pam_motd/Makefile.am +++ b/modules/pam_motd/Makefile.am @@ -1,9 +1,13 @@ # -# Copyright (c) 2005 Thorsten Kukuk +# Copyright (c) 2005, 2006 Thorsten Kukuk # 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 index 00000000..155e2304 --- /dev/null +++ b/modules/pam_motd/tst-pam_motd @@ -0,0 +1,2 @@ +#!/bin/sh +../../tests/tst-dlopen .libs/pam_motd.so diff --git a/modules/pam_nologin/Makefile.am b/modules/pam_nologin/Makefile.am index d6c061d6..f65fb5e1 100644 --- a/modules/pam_nologin/Makefile.am +++ b/modules/pam_nologin/Makefile.am @@ -1,10 +1,12 @@ # -# Copyright (c) 2005 Thorsten Kukuk +# Copyright (c) 2005, 2006 Thorsten Kukuk # 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 index 00000000..caa91b67 --- /dev/null +++ b/modules/pam_nologin/tst-pam_nologin @@ -0,0 +1,2 @@ +#!/bin/sh +../../tests/tst-dlopen .libs/pam_nologin.so diff --git a/modules/pam_permit/Makefile.am b/modules/pam_permit/Makefile.am index 82854194..90a5373d 100644 --- a/modules/pam_permit/Makefile.am +++ b/modules/pam_permit/Makefile.am @@ -1,10 +1,12 @@ # -# Copyright (c) 2005 Thorsten Kukuk +# Copyright (c) 2005, 2006 Thorsten Kukuk # 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 index 00000000..8adb427f --- /dev/null +++ b/modules/pam_permit/tst-pam_permit @@ -0,0 +1,2 @@ +#!/bin/sh +../../tests/tst-dlopen .libs/pam_permit.so diff --git a/modules/pam_rhosts/Makefile.am b/modules/pam_rhosts/Makefile.am index ef5f3d0a..5c8cc188 100644 --- a/modules/pam_rhosts/Makefile.am +++ b/modules/pam_rhosts/Makefile.am @@ -1,10 +1,12 @@ # -# Copyright (c) 2005 Thorsten Kukuk +# Copyright (c) 2005, 2006 Thorsten Kukuk # 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 index 00000000..6b14ec51 --- /dev/null +++ b/modules/pam_rhosts/tst-pam_rhosts @@ -0,0 +1,2 @@ +#!/bin/sh +../../tests/tst-dlopen .libs/pam_rhosts_auth.so diff --git a/modules/pam_rootok/Makefile.am b/modules/pam_rootok/Makefile.am index 507dc992..f8e2d9c7 100644 --- a/modules/pam_rootok/Makefile.am +++ b/modules/pam_rootok/Makefile.am @@ -1,10 +1,12 @@ # -# Copyright (c) 2005 Thorsten Kukuk +# Copyright (c) 2005, 2006 Thorsten Kukuk # 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 index 00000000..385ef760 --- /dev/null +++ b/modules/pam_rootok/tst-pam_rootok @@ -0,0 +1,2 @@ +#!/bin/sh +../../tests/tst-dlopen .libs/pam_rootok.so diff --git a/modules/pam_securetty/Makefile.am b/modules/pam_securetty/Makefile.am index 00c46e9f..1562a937 100644 --- a/modules/pam_securetty/Makefile.am +++ b/modules/pam_securetty/Makefile.am @@ -1,10 +1,12 @@ # -# Copyright (c) 2005 Thorsten Kukuk +# Copyright (c) 2005, 2006 Thorsten Kukuk # 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 index 00000000..1252f798 --- /dev/null +++ b/modules/pam_securetty/tst-pam_securetty @@ -0,0 +1,2 @@ +#!/bin/sh +../../tests/tst-dlopen .libs/pam_securetty.so diff --git a/modules/pam_selinux/Makefile.am b/modules/pam_selinux/Makefile.am index 0cab19ff..d830bf7e 100644 --- a/modules/pam_selinux/Makefile.am +++ b/modules/pam_selinux/Makefile.am @@ -1,12 +1,15 @@ # -# Copyright (c) 2005 Thorsten Kukuk +# Copyright (c) 2005, 2006 Thorsten Kukuk # 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 index 00000000..14c3d82f --- /dev/null +++ b/modules/pam_selinux/tst-pam_selinux @@ -0,0 +1,2 @@ +#!/bin/sh +../../tests/tst-dlopen .libs/pam_selinux.so diff --git a/modules/pam_shells/Makefile.am b/modules/pam_shells/Makefile.am index c0d6a6c4..06e1421b 100644 --- a/modules/pam_shells/Makefile.am +++ b/modules/pam_shells/Makefile.am @@ -1,10 +1,12 @@ # -# Copyright (c) 2005 Thorsten Kukuk +# Copyright (c) 2005, 2006 Thorsten Kukuk # 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 index 00000000..dccc33d0 --- /dev/null +++ b/modules/pam_shells/tst-pam_shells @@ -0,0 +1,2 @@ +#!/bin/sh +../../tests/tst-dlopen .libs/pam_shells.so diff --git a/modules/pam_stress/Makefile.am b/modules/pam_stress/Makefile.am index 1fcbde7d..64fe516f 100644 --- a/modules/pam_stress/Makefile.am +++ b/modules/pam_stress/Makefile.am @@ -1,10 +1,12 @@ # -# Copyright (c) 2005 Thorsten Kukuk +# Copyright (c) 2005, 2006 Thorsten Kukuk # 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 index 00000000..24be7560 --- /dev/null +++ b/modules/pam_stress/tst-pam_stress @@ -0,0 +1,2 @@ +#!/bin/sh +../../tests/tst-dlopen .libs/pam_stress.so diff --git a/modules/pam_succeed_if/Makefile.am b/modules/pam_succeed_if/Makefile.am index 57e5abb2..d97f4c1d 100644 --- a/modules/pam_succeed_if/Makefile.am +++ b/modules/pam_succeed_if/Makefile.am @@ -1,10 +1,12 @@ # -# Copyright (c) 2005 Thorsten Kukuk +# Copyright (c) 2005, 2006 Thorsten Kukuk # 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 index 00000000..f2b6dd3f --- /dev/null +++ b/modules/pam_succeed_if/tst-pam_succeed_if @@ -0,0 +1,2 @@ +#!/bin/sh +../../tests/tst-dlopen .libs/pam_succeed_if.so diff --git a/modules/pam_tally/Makefile.am b/modules/pam_tally/Makefile.am index c7aacc0d..dae38198 100644 --- a/modules/pam_tally/Makefile.am +++ b/modules/pam_tally/Makefile.am @@ -1,10 +1,12 @@ # -# Copyright (c) 2005 Thorsten Kukuk +# Copyright (c) 2005, 2006 Thorsten Kukuk # 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 index 00000000..15291af6 --- /dev/null +++ b/modules/pam_tally/tst-pam_tally @@ -0,0 +1,2 @@ +#!/bin/sh +../../tests/tst-dlopen .libs/pam_tally.so diff --git a/modules/pam_time/Makefile.am b/modules/pam_time/Makefile.am index 91632af0..2c77b54a 100644 --- a/modules/pam_time/Makefile.am +++ b/modules/pam_time/Makefile.am @@ -1,10 +1,12 @@ # -# Copyright (c) 2005 Thorsten Kukuk +# Copyright (c) 2005, 2006 Thorsten Kukuk # 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 index 00000000..030717bb --- /dev/null +++ b/modules/pam_time/tst-pam_time @@ -0,0 +1,2 @@ +#!/bin/sh +../../tests/tst-dlopen .libs/pam_time.so diff --git a/modules/pam_umask/Makefile.am b/modules/pam_umask/Makefile.am index 709cbd28..dc2a3a3b 100644 --- a/modules/pam_umask/Makefile.am +++ b/modules/pam_umask/Makefile.am @@ -1,10 +1,12 @@ # -# Copyright (c) 2005 Thorsten Kukuk +# Copyright (c) 2005, 2006 Thorsten Kukuk # 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 index 00000000..3608a9de --- /dev/null +++ b/modules/pam_umask/tst-pam_umask @@ -0,0 +1,2 @@ +#!/bin/sh +../../tests/tst-dlopen .libs/pam_umask.so diff --git a/modules/pam_unix/Makefile.am b/modules/pam_unix/Makefile.am index fa7f4139..af658a8d 100644 --- a/modules/pam_unix/Makefile.am +++ b/modules/pam_unix/Makefile.am @@ -1,10 +1,13 @@ # -# Copyright (c) 2005 Thorsten Kukuk +# Copyright (c) 2005, 2006 Thorsten Kukuk # 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 index 00000000..22922800 --- /dev/null +++ b/modules/pam_unix/tst-pam_unix @@ -0,0 +1,2 @@ +#!/bin/sh +../../tests/tst-dlopen .libs/pam_unix.so diff --git a/modules/pam_userdb/Makefile.am b/modules/pam_userdb/Makefile.am index 320f90bf..6e6a94af 100644 --- a/modules/pam_userdb/Makefile.am +++ b/modules/pam_userdb/Makefile.am @@ -1,10 +1,12 @@ # -# Copyright (c) 2005 Thorsten Kukuk +# Copyright (c) 2005, 2006 Thorsten Kukuk # 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 index 00000000..5d5eb195 --- /dev/null +++ b/modules/pam_userdb/tst-pam_userdb @@ -0,0 +1,2 @@ +#!/bin/sh +../../tests/tst-dlopen .libs/pam_userdb.so diff --git a/modules/pam_warn/Makefile.am b/modules/pam_warn/Makefile.am index 7fab3f41..49916d0f 100644 --- a/modules/pam_warn/Makefile.am +++ b/modules/pam_warn/Makefile.am @@ -1,10 +1,12 @@ # -# Copyright (c) 2005 Thorsten Kukuk +# Copyright (c) 2005, 2006 Thorsten Kukuk # 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 index 00000000..0b48365a --- /dev/null +++ b/modules/pam_warn/tst-pam_warn @@ -0,0 +1,2 @@ +#!/bin/sh +../../tests/tst-dlopen .libs/pam_warn.so diff --git a/modules/pam_wheel/Makefile.am b/modules/pam_wheel/Makefile.am index 52af7a44..3405adb3 100644 --- a/modules/pam_wheel/Makefile.am +++ b/modules/pam_wheel/Makefile.am @@ -1,10 +1,12 @@ # -# Copyright (c) 2005 Thorsten Kukuk +# Copyright (c) 2005, 2006 Thorsten Kukuk # 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 index 00000000..4bf5d6a6 --- /dev/null +++ b/modules/pam_wheel/tst-pam_wheel @@ -0,0 +1,2 @@ +#!/bin/sh +../../tests/tst-dlopen .libs/pam_wheel.so diff --git a/modules/pam_xauth/Makefile.am b/modules/pam_xauth/Makefile.am index b93099eb..78ff1d78 100644 --- a/modules/pam_xauth/Makefile.am +++ b/modules/pam_xauth/Makefile.am @@ -1,12 +1,14 @@ # -# Copyright (c) 2005 Thorsten Kukuk +# Copyright (c) 2005, 2006 Thorsten Kukuk # 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 index 00000000..32948963 --- /dev/null +++ b/modules/pam_xauth/tst-pam_xauth @@ -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 index 00000000..0ab179e8 --- /dev/null +++ b/tests/.cvsignore @@ -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 index 00000000..035a9cec --- /dev/null +++ b/tests/Makefile.am @@ -0,0 +1,18 @@ +# +# Copyright (c) 2006 Thorsten Kukuk +# + +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 index 00000000..9090367b --- /dev/null +++ b/tests/tst-dlopen.c @@ -0,0 +1,40 @@ +/* + Copyright (C) Nalin Dahyabhai 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 +#include +#include +#include + +/* 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 index 00000000..8ae4c4d7 --- /dev/null +++ b/tests/tst-pam_acct_mgmt.c @@ -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 +#include + +#include + + +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 index 00000000..20e631aa --- /dev/null +++ b/tests/tst-pam_authenticate.c @@ -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 +#include + +#include + + +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 index 00000000..abe83ed0 --- /dev/null +++ b/tests/tst-pam_chauthtok.c @@ -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 +#include + +#include + + +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 index 00000000..3e222088 --- /dev/null +++ b/tests/tst-pam_close_session.c @@ -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 +#include + +#include + + +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 index 00000000..edcd75a3 --- /dev/null +++ b/tests/tst-pam_end.c @@ -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 +#include + +#include + + +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 index 00000000..f70e4c56 --- /dev/null +++ b/tests/tst-pam_fail_delay.c @@ -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 +#include + +#include + + +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 index 00000000..726aa2d0 --- /dev/null +++ b/tests/tst-pam_get_item.c @@ -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 +#include + +#include + +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 index 00000000..52f2f185 --- /dev/null +++ b/tests/tst-pam_getenvlist.c @@ -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 +#include +#include +#include +#include + +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 index 00000000..abbd3f39 --- /dev/null +++ b/tests/tst-pam_open_session.c @@ -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 +#include + +#include + + +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 index 00000000..ecc68e6c --- /dev/null +++ b/tests/tst-pam_set_item.c @@ -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 +#include + +#include + +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 index 00000000..c9e87c2a --- /dev/null +++ b/tests/tst-pam_setcred.c @@ -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 +#include + +#include + + +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 index 00000000..f50d5e04 --- /dev/null +++ b/tests/tst-pam_start.c @@ -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 +#include + +#include + + +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; +} -- cgit v1.2.3