svn commit: samba r6564 - in branches/SAMBA_4_0/source: build/smb_build lib/socket_wrapper script/tests setup

jelmer at samba.org jelmer at samba.org
Sun May 1 19:08:35 GMT 2005


Author: jelmer
Date: 2005-05-01 19:08:35 +0000 (Sun, 01 May 2005)
New Revision: 6564

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

Log:
- Fix bug in socket_wrapper
- Add options --quiet and --outputdir options to the provisioning script
- Add simple 'make test' and 'make test-swrap'

Added:
   branches/SAMBA_4_0/source/script/tests/selftest.sh
Modified:
   branches/SAMBA_4_0/source/build/smb_build/makefile.pm
   branches/SAMBA_4_0/source/lib/socket_wrapper/socket_wrapper.c
   branches/SAMBA_4_0/source/setup/provision.pl


Changeset:
Modified: branches/SAMBA_4_0/source/build/smb_build/makefile.pm
===================================================================
--- branches/SAMBA_4_0/source/build/smb_build/makefile.pm	2005-05-01 18:51:16 UTC (rev 6563)
+++ branches/SAMBA_4_0/source/build/smb_build/makefile.pm	2005-05-01 19:08:35 UTC (rev 6564)
@@ -150,6 +150,16 @@
 
 basics: idl proto_exists
 
+test: all
+	./script/tests/selftest.sh
+	
+SOCKET_WRAPPER_DIR=`pwd`/sockdir
+
+test-swrap: all
+	export SOCKET_WRAPPER_DIR
+	mkdir -p $(SOCKET_WRAPPER_DIR)
+	./script/tests/selftest.sh
+
 __EOD__
 
 	return $output;

Modified: branches/SAMBA_4_0/source/lib/socket_wrapper/socket_wrapper.c
===================================================================
--- branches/SAMBA_4_0/source/lib/socket_wrapper/socket_wrapper.c	2005-05-01 18:51:16 UTC (rev 6563)
+++ branches/SAMBA_4_0/source/lib/socket_wrapper/socket_wrapper.c	2005-05-01 19:08:35 UTC (rev 6564)
@@ -249,7 +249,8 @@
 	}
 
 	/* only allow pseudo loopback connections */
-	if (((const struct sockaddr_in *)serv_addr)->sin_addr.s_addr != 
+	if (serv_addr->sa_family == AF_INET &&
+		((const struct sockaddr_in *)serv_addr)->sin_addr.s_addr != 
 	    htonl(INADDR_LOOPBACK)) {
 		errno = ENETUNREACH;
 		return -1;

Added: branches/SAMBA_4_0/source/script/tests/selftest.sh
===================================================================
--- branches/SAMBA_4_0/source/script/tests/selftest.sh	2005-05-01 18:51:16 UTC (rev 6563)
+++ branches/SAMBA_4_0/source/script/tests/selftest.sh	2005-05-01 19:08:35 UTC (rev 6564)
@@ -0,0 +1,39 @@
+#!/bin/sh
+DOMAIN=SAMBADOMAIN
+REALM=$DOMAIN
+PASSWORD=penguin
+SRCDIR=`pwd`
+PREFIX=$SRCDIR/prefix
+SOCKET_WRAPPER_DIR=$PREFIX/sockdir
+TMPDIR=$PREFIX/tmp
+
+if [ ! -z "$BUILD" ]
+then
+	./configure --prefix=$PREFIX --enable-socket-wrapper
+	mkdir -p $PREFIX $TMPDIR
+	make proto all install
+fi
+
+rm -f $PREFIX/private/*
+./setup/provision.pl --quiet --outputdir $PREFIX/private --domain $DOMAIN --realm $REALM --adminpass $PASSWORD
+
+mkdir -p $SOCKET_WRAPPER_DIR
+cat >$PREFIX/lib/smb.conf <<EOF
+[global]
+	workgroup = $DOMAIN
+
+[tmp]
+	path = $TMPDIR
+	read only = no
+EOF
+
+export SOCKET_WRAPPER_DIR
+cd $PREFIX
+./sbin/smbd
+sleep 2
+$PREFIX/bin/smbtorture ncalrpc: LOCAL-*
+$SRCDIR/script/tests/test_rpc.sh localhost administrator $PASSWORD $DOMAIN
+$SRCDIR/script/tests/test_binding_string.sh localhost administrator $PASSWORD $DOMAIN
+$SRCDIR/script/tests/test_echo.sh localhost administrator $PASSWORD $DOMAIN
+$SRCDIR/script/tests/test_posix.sh //localhost/tmp administrator $PASSWORD 
+kill `cat $PREFIX/var/locks/smbd.pid`


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

Modified: branches/SAMBA_4_0/source/setup/provision.pl
===================================================================
--- branches/SAMBA_4_0/source/setup/provision.pl	2005-05-01 18:51:16 UTC (rev 6563)
+++ branches/SAMBA_4_0/source/setup/provision.pl	2005-05-01 19:08:35 UTC (rev 6564)
@@ -14,6 +14,8 @@
 my $opt_nogroup;
 my $opt_wheel;
 my $opt_users;
+my $opt_outputdir;
+my $opt_quiet;
 my $dnsdomain;
 my $netbiosname;
 my $dnsname;
@@ -274,11 +276,13 @@
  --host-ip	IPADDRESS	set ipaddress
  --host-guid	GUID		set hostguid (otherwise random)
  --invocationid	GUID		set invocationid (otherwise random)
+ --outputdir	OUTPUTDIR	set output directory
  --adminpass	PASSWORD	choose admin password (otherwise random)
  --nobody	USERNAME	choose 'nobody' user
  --nogroup	GROUPNAME	choose 'nogroup' group
  --wheel	GROUPNAME	choose 'wheel' privileged group
  --users	GROUPNAME	choose 'users' group
+ --quiet			Be quiet
 
 You must provide at least a realm and domain
 
@@ -303,6 +307,8 @@
 	    'nogroup=s' => \$opt_nogroup,
 	    'wheel=s' => \$opt_wheel,
 	    'users=s' => \$opt_users,
+	    'outputdir=s' => \$opt_outputdir,
+	    'quiet' => \$opt_quiet
 	    );
 
 if ($opt_help || 
@@ -326,7 +332,7 @@
 	}
 }
 
-print "Provisioning host '$opt_hostname'[$opt_hostip] for domain '$opt_domain' in realm '$opt_realm'\n";
+$opt_quiet or print "Provisioning host '$opt_hostname'[$opt_hostip] for domain '$opt_domain' in realm '$opt_realm'\n"; 
 
 if (!$opt_nobody) {
 	if (defined getpwnam("nobody")) {
@@ -361,9 +367,9 @@
 $opt_users || die "Unable to determine a group for 'users'\n";
 $opt_wheel || die "Unable to determine a group for 'wheel'\n";
 
-print "Using nobody='$opt_nobody'  nogroup='$opt_nogroup'  wheel='$opt_wheel'  users='$opt_users'\n";
+$opt_quiet or print "Using nobody='$opt_nobody'  nogroup='$opt_nogroup'  wheel='$opt_wheel'  users='$opt_users'\n";
 
-print "generating ldif ...\n";
+$opt_quiet or print "generating ldif ...\n";
 
 $dnsdomain = lc($opt_realm);
 $dnsname = lc($opt_hostname).".".$dnsdomain;
@@ -388,15 +394,21 @@
 
 my $res = apply_substitutions($data);
 
-my $newdb = "newdb." . int(rand(1000));
+my $newdb = $opt_outputdir;
 
-print "Putting new database files in $newdb\n";
+unless ($newdb) {
+	$newdb = "newdb." . int(rand(1000));
+}
 
-mkdir($newdb) || die "Unable to create temporary directory $newdb\n";
+$opt_quiet or print "Putting new database files in $newdb\n";
 
+unless ($opt_outputdir) {
+	mkdir($newdb) || die "Unable to create temporary directory $newdb\n";
+}
+
 FileSave("$newdb/sam.ldif", $res);
 
-print "creating $newdb/sam.ldb ...\n";
+$opt_quiet or print "creating $newdb/sam.ldb ...\n";
 
 system("ldbadd -H $newdb/sam.ldb $newdb/sam.ldif") == 0 || die "Failed to create sam.ldb\n";
 
@@ -406,7 +418,7 @@
 
 FileSave("$newdb/rootdse.ldif", $res);
 
-print "creating $newdb/rootdse.ldb ...\n";
+$opt_quiet or print "creating $newdb/rootdse.ldb ...\n";
 
 system("ldbadd -H $newdb/rootdse.ldb $newdb/rootdse.ldif") == 0 || die "Failed to create rootdse.ldb\n";
 
@@ -416,7 +428,7 @@
 
 FileSave("$newdb/secrets.ldif", $res);
 
-print "creating $newdb/secrets.ldb ...\n";
+$opt_quiet or print "creating $newdb/secrets.ldb ...\n";
 
 system("ldbadd -H $newdb/secrets.ldb $newdb/secrets.ldif") == 0 || die "Failed to create secrets.ldb\n";
 
@@ -424,20 +436,18 @@
 
 $res = apply_substitutions($data);
 
-print "saving dns zone to $newdb/$dnsdomain.zone ...\n";
+$opt_quiet or print "saving dns zone to $newdb/$dnsdomain.zone ...\n";
 
 FileSave("$newdb/$dnsdomain.zone", $res);
 
-print "creating $newdb/hklm.ldb ... \n";
+$opt_quiet or print "creating $newdb/hklm.ldb ... \n";
 
 system("ldbadd -H $newdb/hklm.ldb setup/hklm.ldif") == 0 || die "Failed to create hklm.ldb\n";
 
-print "
+$opt_quiet or print "
 
 Installation:
 - Please move $newdb/*.ldb to the private/ directory of your
   Samba4 installation
 - Please use $newdb/$dnsdomain.zone in BIND on your dns server
 ";
-
-



More information about the samba-cvs mailing list