summaryrefslogtreecommitdiff
path: root/source3/script/tests
diff options
context:
space:
mode:
authorLars Müller <lmuelle@samba.org>2006-03-13 16:10:26 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 11:15:25 -0500
commit9b277916445e6c1bdc60e06c382067c209287aaf (patch)
tree34bf25c75d20de72b1dc0dc6d577c792dd345d37 /source3/script/tests
parentb97a69dce316ba8808b317acd99d976c4c279a28 (diff)
downloadsamba-9b277916445e6c1bdc60e06c382067c209287aaf.tar.gz
samba-9b277916445e6c1bdc60e06c382067c209287aaf.tar.bz2
samba-9b277916445e6c1bdc60e06c382067c209287aaf.zip
r14325: Add pam_modules rule which builds the configure(d) pam modules. This is
called as part of the all rule (again only if pam modules are requested by configure). Add pam_winbind rule. Ensure proto_exists before we build the pam modules. Add test_pam_modules rule to test if the built pam modules have any unresolved symbols. For test_pam_modules we use script/tests/dlopen.sh which was written by Nalin Dahyabhai <nalin@redhat.com>. Thanks Nalin! RedHat and SuSE use this script to test nss and pam modules since several years. (This used to be commit 71b2eb55adcd28f3796254ea1ce0bcee6098e712)
Diffstat (limited to 'source3/script/tests')
-rwxr-xr-xsource3/script/tests/dlopen.sh91
1 files changed, 91 insertions, 0 deletions
diff --git a/source3/script/tests/dlopen.sh b/source3/script/tests/dlopen.sh
new file mode 100755
index 0000000000..6127953692
--- /dev/null
+++ b/source3/script/tests/dlopen.sh
@@ -0,0 +1,91 @@
+#!/bin/sh
+#
+# 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.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+tempdir=`mktemp -d /tmp/dlopenXXXXXX`
+test -n "$tempdir" || exit 1
+cat >> $tempdir/dlopen.c << _EOF
+#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;
+}
+_EOF
+
+for arg in $@ ; do
+ case "$arg" in
+ "")
+ ;;
+ -I*|-D*|-f*|-m*|-g*|-O*|-W*)
+ cflags="$cflags $arg"
+ ;;
+ -l*|-L*)
+ ldflags="$ldflags $arg"
+ ;;
+ /*)
+ modules="$modules $arg"
+ ;;
+ *)
+ modules="$modules $arg"
+ ;;
+ esac
+done
+
+${CC:-gcc} $RPM_OPT_FLAGS $CFLAGS -o $tempdir/dlopen $cflags $tempdir/dlopen.c $ldflags -ldl
+
+retval=0
+for module in $modules ; do
+ case "$module" in
+ "")
+ ;;
+ /*)
+ $tempdir/dlopen "$module"
+ retval=$?
+ ;;
+ *)
+ $tempdir/dlopen ./"$module"
+ retval=$?
+ ;;
+ esac
+done
+
+rm -f $tempdir/dlopen $tempdir/dlopen.c
+rmdir $tempdir
+exit $retval