svn commit: samba r14325 - branches/SAMBA_3_0/source branches/SAMBA_3_0/source/script/tests trunk/source trunk/source/script/tests

lmuelle at samba.org lmuelle at samba.org
Mon Mar 13 16:10:28 GMT 2006


Author: lmuelle
Date: 2006-03-13 16:10:26 +0000 (Mon, 13 Mar 2006)
New Revision: 14325

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=14325

Log:
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 at redhat.com>.  Thanks Nalin!
RedHat and SuSE use this script to test nss and pam modules since
several years.

Added:
   branches/SAMBA_3_0/source/script/tests/dlopen.sh
   trunk/source/script/tests/dlopen.sh
Modified:
   branches/SAMBA_3_0/source/Makefile.in
   branches/SAMBA_3_0/source/configure.in
   trunk/source/Makefile.in
   trunk/source/configure.in


Changeset:
Modified: branches/SAMBA_3_0/source/Makefile.in
===================================================================
--- branches/SAMBA_3_0/source/Makefile.in	2006-03-13 16:02:50 UTC (rev 14324)
+++ branches/SAMBA_3_0/source/Makefile.in	2006-03-13 16:10:26 UTC (rev 14325)
@@ -154,6 +154,8 @@
 
 SHLIBS = @SHLIB_PROGS@ @LIBSMBCLIENT@ @LIBSMBSHAREMODES@ cac
 
+PAM_MODULES = @PAM_MODULES@
+
 SCRIPTS = $(srcdir)/script/smbtar $(builddir)/script/findsmb
 
 VFS_MODULES = @VFS_MODULES@
@@ -754,10 +756,14 @@
 # now the rules...
 ######################################################################
 all : SHOWFLAGS proto_exists $(SBIN_PROGS) $(BIN_PROGS) $(ROOT_SBIN_PROGS) \
-	$(SHLIBS) $(MODULES) @EXTRA_ALL_TARGETS@
+	$(SHLIBS) $(MODULES) $(PAM_MODULES) @EXTRA_ALL_TARGETS@
 
-pam_smbpass : SHOWFLAGS bin/pam_smbpass. at SHLIBEXT@
+pam_modules : $(PAM_MODULES)
 
+pam_smbpass : SHOWFLAGS proto_exists bin/pam_smbpass. at SHLIBEXT@
+
+pam_winbind : SHOWFLAGS proto_exists bin/pam_winbind. at SHLIBEXT@
+
 smbwrapper : SHOWFLAGS @SMBWRAPPER@
 
 torture : SHOWFLAGS $(TORTURE_PROGS)
@@ -840,6 +846,12 @@
 	@echo Running Samba 3 Test suite
 	@sh ./script/tests/runtests.sh t_dir
 
+test_pam_modules: pam_modules
+	@echo "Testing $(PAM_MODULES) "
+	@for module in $(PAM_MODULES); do \
+		./script/tests/dlopen.sh -lpam -ldl bin/$${module}. at SHLIBEXT@ \
+			|| exit 1; \
+	done
 
 # These dependencies are only approximately correct: we want to make
 # sure Samba's paths are updated if ./configure is re-run.  Really it

Modified: branches/SAMBA_3_0/source/configure.in
===================================================================
--- branches/SAMBA_3_0/source/configure.in	2006-03-13 16:02:50 UTC (rev 14324)
+++ branches/SAMBA_3_0/source/configure.in	2006-03-13 16:10:26 UTC (rev 14325)
@@ -256,6 +256,7 @@
 AC_SUBST(KRB5_LIBS)
 AC_SUBST(LDAP_LIBS)
 AC_SUBST(SHLIB_PROGS)
+AC_SUBST(PAM_MODULES)
 AC_SUBST(SMBWRAPPER)
 AC_SUBST(SMBWRAP_OBJS)
 AC_SUBST(SMBWRAP_INC)
@@ -3647,6 +3648,7 @@
 
 #################################################
 # check for pam_smbpass support
+PAM_MODULES=""
 AC_MSG_CHECKING(whether to use pam_smbpass)
 AC_ARG_WITH(pam_smbpass,
 [  --with-pam_smbpass      Build PAM module for authenticating against passdb backends (default=no)],
@@ -3664,7 +3666,7 @@
           AC_MSG_ERROR([No libpam found])
        else
 	  AUTH_LIBS="$AUTH_LIBS -lpam"
-          SHLIB_PROGS="$SHLIB_PROGS bin/pam_smbpass.$SHLIBEXT"
+          PAM_MODULES="pam_smbpass"
        fi
     ;;
   *)
@@ -5110,7 +5112,7 @@
 		SHLIB_PROGS="$SHLIB_PROGS $WINBIND_NSS $WINBIND_WINS_NSS"
 
 		if test x"$with_pam" = x"yes"; then
-			SHLIB_PROGS="$SHLIB_PROGS bin/pam_winbind.$SHLIBEXT"
+			PAM_MODULES="$PAM_MODULES pam_winbind"
 		fi
 	fi
 else

Added: branches/SAMBA_3_0/source/script/tests/dlopen.sh
===================================================================
--- branches/SAMBA_3_0/source/script/tests/dlopen.sh	2006-03-13 16:02:50 UTC (rev 14324)
+++ branches/SAMBA_3_0/source/script/tests/dlopen.sh	2006-03-13 16:10:26 UTC (rev 14325)
@@ -0,0 +1,91 @@
+#!/bin/sh
+#
+# Copyright (C) Nalin Dahyabhai <nalin at 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


Property changes on: branches/SAMBA_3_0/source/script/tests/dlopen.sh
___________________________________________________________________
Name: svn:executable
   + *

Modified: trunk/source/Makefile.in
===================================================================
--- trunk/source/Makefile.in	2006-03-13 16:02:50 UTC (rev 14324)
+++ trunk/source/Makefile.in	2006-03-13 16:10:26 UTC (rev 14325)
@@ -154,6 +154,8 @@
 
 SHLIBS = @SHLIB_PROGS@ @LIBSMBCLIENT@ @LIBSMBSHAREMODES@ cac
 
+PAM_MODULES = @PAM_MODULES@
+
 SCRIPTS = $(srcdir)/script/smbtar $(builddir)/script/findsmb
 
 VFS_MODULES = @VFS_MODULES@
@@ -768,10 +770,14 @@
 # now the rules...
 ######################################################################
 all : SHOWFLAGS proto_exists $(SBIN_PROGS) $(BIN_PROGS) $(ROOT_SBIN_PROGS) \
-	$(SHLIBS) $(MODULES) @EXTRA_ALL_TARGETS@
+	$(SHLIBS) $(MODULES) $(PAM_MODULES) @EXTRA_ALL_TARGETS@
 
-pam_smbpass : SHOWFLAGS bin/pam_smbpass. at SHLIBEXT@
+pam_modules : $(PAM_MODULES)
 
+pam_smbpass : SHOWFLAGS proto_exists bin/pam_smbpass. at SHLIBEXT@
+
+pam_winbind : SHOWFLAGS proto_exists bin/pam_winbind. at SHLIBEXT@
+
 smbwrapper : SHOWFLAGS @SMBWRAPPER@
 
 torture : SHOWFLAGS $(TORTURE_PROGS)
@@ -856,6 +862,12 @@
 	@echo Running Samba 3 Test suite
 	@sh ./script/tests/runtests.sh t_dir
 
+test_pam_modules: pam_modules
+	@echo "Testing $(PAM_MODULES) "
+	@for module in $(PAM_MODULES); do \
+		./script/tests/dlopen.sh -lpam -ldl bin/$${module}. at SHLIBEXT@ \
+			|| exit 1; \
+	done
 
 # These dependencies are only approximately correct: we want to make
 # sure Samba's paths are updated if ./configure is re-run.  Really it

Modified: trunk/source/configure.in
===================================================================
--- trunk/source/configure.in	2006-03-13 16:02:50 UTC (rev 14324)
+++ trunk/source/configure.in	2006-03-13 16:10:26 UTC (rev 14325)
@@ -256,6 +256,7 @@
 AC_SUBST(KRB5_LIBS)
 AC_SUBST(LDAP_LIBS)
 AC_SUBST(SHLIB_PROGS)
+AC_SUBST(PAM_MODULES)
 AC_SUBST(SMBWRAPPER)
 AC_SUBST(SMBWRAP_OBJS)
 AC_SUBST(SMBWRAP_INC)
@@ -3647,6 +3648,7 @@
 
 #################################################
 # check for pam_smbpass support
+PAM_MODULES=""
 AC_MSG_CHECKING(whether to use pam_smbpass)
 AC_ARG_WITH(pam_smbpass,
 [  --with-pam_smbpass      Build PAM module for authenticating against passdb backends (default=no)],
@@ -3664,7 +3666,7 @@
           AC_MSG_ERROR([No libpam found])
        else
 	  AUTH_LIBS="$AUTH_LIBS -lpam"
-          SHLIB_PROGS="$SHLIB_PROGS bin/pam_smbpass.$SHLIBEXT"
+          PAM_MODULES="pam_smbpass"
        fi
     ;;
   *)
@@ -5110,7 +5112,7 @@
 		SHLIB_PROGS="$SHLIB_PROGS $WINBIND_NSS $WINBIND_WINS_NSS"
 
 		if test x"$with_pam" = x"yes"; then
-			SHLIB_PROGS="$SHLIB_PROGS bin/pam_winbind.$SHLIBEXT"
+			PAM_MODULES="$PAM_MODULES pam_winbind"
 		fi
 	fi
 else

Added: trunk/source/script/tests/dlopen.sh
===================================================================
--- trunk/source/script/tests/dlopen.sh	2006-03-13 16:02:50 UTC (rev 14324)
+++ trunk/source/script/tests/dlopen.sh	2006-03-13 16:10:26 UTC (rev 14325)
@@ -0,0 +1,91 @@
+#!/bin/sh
+#
+# Copyright (C) Nalin Dahyabhai <nalin at 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


Property changes on: trunk/source/script/tests/dlopen.sh
___________________________________________________________________
Name: svn:executable
   + *



More information about the samba-cvs mailing list