+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.
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 = *~
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
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)
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
-include $(top_srcdir)/Make.xml.rules
endif
+
+TESTS = tst-pam_access
--- /dev/null
+#!/bin/sh
+../../tests/tst-dlopen .libs/pam_access.so
CLEANFILES = *~
-EXTRA_DIST = README $(MANS) $(XMLS)
+EXTRA_DIST = README $(MANS) $(XMLS) tst-pam_cracklib
man_MANS = pam_cracklib.8
if HAVE_LIBCRACK
securelib_LTLIBRARIES = pam_cracklib.la
+
+TESTS = tst-pam_cracklib
endif
pam_cracklib_la_LIBADD = @LIBCRACK@ @LIBCRYPT@
-include $(top_srcdir)/Make.xml.rules
endif
-
--- /dev/null
+#!/bin/sh
+../../tests/tst-dlopen .libs/pam_cracklib.so
CLEANFILES = *~
-EXTRA_DIST = README
+EXTRA_DIST = README tst-pam_debug
securelibdir = $(SECUREDIR)
secureconfdir = $(SCONFIGDIR)
endif
securelib_LTLIBRARIES = pam_debug.la
+
+TESTS = tst-pam_debug
--- /dev/null
+#!/bin/sh
+../../tests/tst-dlopen .libs/pam_debug.so
CLEANFILES = *~
-EXTRA_DIST = README $(MANS) $(XMLS)
+EXTRA_DIST = README $(MANS) $(XMLS) tst-pam_deny
man_MANS = pam_deny.8
-include $(top_srcdir)/Make.xml.rules
endif
+TESTS = tst-pam_deny
--- /dev/null
+#!/bin/sh
+../../tests/tst-dlopen .libs/pam_deny.so
CLEANFILES = *~
-EXTRA_DIST = README $(MANS) $(XMLS)
+EXTRA_DIST = README $(MANS) $(XMLS) tst-pam_echo
man_MANS = pam_echo.8
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
--- /dev/null
+#!/bin/sh
+../../tests/tst-dlopen .libs/pam_echo.so
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
-include $(top_srcdir)/Make.xml.rules
endif
+TESTS = tst-pam_env
--- /dev/null
+#!/bin/sh
+../../tests/tst-dlopen .libs/pam_env.so
CLEANFILES = *~
-EXTRA_DIST = README $(MANS) $(XMLS)
+EXTRA_DIST = README $(MANS) $(XMLS) tst-pam_exec
man_MANS = pam_exec.8
-include $(top_srcdir)/Make.xml.rules
endif
+TESTS = tst-pam_exec
--- /dev/null
+#!/bin/sh
+../../tests/tst-dlopen .libs/pam_exec.so
#
-# 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)
include_HEADERS=pam_filter.h
securelib_LTLIBRARIES = pam_filter.la
+TESTS = tst-pam_filter
--- /dev/null
+#!/bin/sh
+../../tests/tst-dlopen .libs/pam_filter.so
CLEANFILES = *~
-EXTRA_DIST = README
+EXTRA_DIST = README tst-pam_ftp
securelibdir = $(SECUREDIR)
secureconfdir = $(SCONFIGDIR)
endif
securelib_LTLIBRARIES = pam_ftp.la
+
+TESTS = tst-pam_ftp
--- /dev/null
+#!/bin/sh
+../../tests/tst-dlopen .libs/pam_ftp.so
#
-# 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)
securelib_LTLIBRARIES = pam_group.la
secureconf_DATA = group.conf
+
+TESTS = tst-pam_group
--- /dev/null
+#!/bin/sh
+../../tests/tst-dlopen .libs/pam_group.so
#
-# 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)
--- /dev/null
+#!/bin/sh
+../../tests/tst-dlopen .libs/pam_issue.so
#
-# Copyright (c) 2005 Thorsten Kukuk <kukuk@suse.de>
+# Copyright (c) 2005, 2006 Thorsten Kukuk <kukuk@suse.de>
#
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 \
--- /dev/null
+#!/bin/sh
+../../tests/tst-dlopen .libs/pam_lastlog.so
#
-# 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)
--- /dev/null
+#!/bin/sh
+../../tests/tst-dlopen .libs/pam_limits.so
#
-# 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)
--- /dev/null
+#!/bin/sh
+../../tests/tst-dlopen .libs/pam_listfile.so
#
-# 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
--- /dev/null
+#!/bin/sh
+../../tests/tst-dlopen .libs/pam_localuser.so
#
-# 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)
--- /dev/null
+#!/bin/sh
+../../tests/tst-dlopen .libs/pam_mail.so
#
-# 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)
--- /dev/null
+#!/bin/sh
+../../tests/tst-dlopen .libs/pam_mkhomedir.so
#
-# 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)
--- /dev/null
+#!/bin/sh
+../../tests/tst-dlopen .libs/pam_motd.so
#
-# 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
--- /dev/null
+#!/bin/sh
+../../tests/tst-dlopen .libs/pam_nologin.so
#
-# 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)
--- /dev/null
+#!/bin/sh
+../../tests/tst-dlopen .libs/pam_permit.so
#
-# 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)
--- /dev/null
+#!/bin/sh
+../../tests/tst-dlopen .libs/pam_rhosts_auth.so
#
-# 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)
--- /dev/null
+#!/bin/sh
+../../tests/tst-dlopen .libs/pam_rootok.so
#
-# 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
--- /dev/null
+#!/bin/sh
+../../tests/tst-dlopen .libs/pam_securetty.so
#
-# 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)
--- /dev/null
+#!/bin/sh
+../../tests/tst-dlopen .libs/pam_selinux.so
#
-# 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)
--- /dev/null
+#!/bin/sh
+../../tests/tst-dlopen .libs/pam_shells.so
#
-# 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)
--- /dev/null
+#!/bin/sh
+../../tests/tst-dlopen .libs/pam_stress.so
#
-# 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
README: pam_succeed_if.8.xml
-include $(top_srcdir)/Make.xml.rules
endif
-
--- /dev/null
+#!/bin/sh
+../../tests/tst-dlopen .libs/pam_succeed_if.so
#
-# 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)
--- /dev/null
+#!/bin/sh
+../../tests/tst-dlopen .libs/pam_tally.so
#
-# 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)
--- /dev/null
+#!/bin/sh
+../../tests/tst-dlopen .libs/pam_time.so
#
-# 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)
--- /dev/null
+#!/bin/sh
+../../tests/tst-dlopen .libs/pam_umask.so
#
-# 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
--- /dev/null
+#!/bin/sh
+../../tests/tst-dlopen .libs/pam_unix.so
#
-# 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)
--- /dev/null
+#!/bin/sh
+../../tests/tst-dlopen .libs/pam_userdb.so
#
-# 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)
--- /dev/null
+#!/bin/sh
+../../tests/tst-dlopen .libs/pam_warn.so
#
-# 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)
--- /dev/null
+#!/bin/sh
+../../tests/tst-dlopen .libs/pam_wheel.so
#
-# 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)
--- /dev/null
+#!/bin/sh
+../../tests/tst-dlopen .libs/pam_xauth.so
--- /dev/null
+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
--- /dev/null
+#
+# 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
+
--- /dev/null
+/*
+ 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;
+}
+
--- /dev/null
+/*
+ * 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;
+}
--- /dev/null
+/*
+ * 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;
+}
--- /dev/null
+/*
+ * 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;
+}
--- /dev/null
+/*
+ * 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;
+}
--- /dev/null
+/*
+ * 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;
+}
--- /dev/null
+/*
+ * 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;
+}
--- /dev/null
+/*
+ * 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;
+}
--- /dev/null
+/*
+ * 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;
+}
--- /dev/null
+/*
+ * 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;
+}
--- /dev/null
+/*
+ * 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;
+}
--- /dev/null
+/*
+ * 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;
+}
--- /dev/null
+/*
+ * 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;
+}