summaryrefslogtreecommitdiff
path: root/selftest/target
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2009-01-28 17:28:51 +0100
committerStefan Metzmacher <metze@samba.org>2009-01-28 17:32:50 +0100
commit8b7c66512d2021e6e7b299adb3e93807b6b3516d (patch)
treeb6544b0944a279c41965954ac886fc7362b21ca2 /selftest/target
parenta849183f9492d09ccd7e273f955d4d8f2668fdf3 (diff)
downloadsamba-8b7c66512d2021e6e7b299adb3e93807b6b3516d.tar.gz
samba-8b7c66512d2021e6e7b299adb3e93807b6b3516d.tar.bz2
samba-8b7c66512d2021e6e7b299adb3e93807b6b3516d.zip
s3:selftest: fix 'make selftest'
metze
Diffstat (limited to 'selftest/target')
-rw-r--r--selftest/target/Samba3.pm128
1 files changed, 100 insertions, 28 deletions
diff --git a/selftest/target/Samba3.pm b/selftest/target/Samba3.pm
index 7c3c0b0ea9..c43b61e560 100644
--- a/selftest/target/Samba3.pm
+++ b/selftest/target/Samba3.pm
@@ -36,14 +36,14 @@ sub teardown_env($$)
my $smbdpid = read_pid($envvars, "smbd");
my $nmbdpid = read_pid($envvars, "nmbd");
-# my $winbinddpid = read_pid($envvars, "winbindd");
+ my $winbinddpid = read_pid($envvars, "winbindd");
$self->stop_sig_term($smbdpid);
$self->stop_sig_term($nmbdpid);
-# $self->stop_sig_term($winbinddpid);
+ $self->stop_sig_term($winbinddpid);
$self->stop_sig_kill($smbdpid);
$self->stop_sig_kill($nmbdpid);
-# $self->stop_sig_kill($winbinddpid);
+ $self->stop_sig_kill($winbinddpid);
return 0;
}
@@ -76,7 +76,7 @@ sub getlog_env($$)
$ret .= $self->getlog_env_app($envvars, "SMBD");
$ret .= $self->getlog_env_app($envvars, "NMBD");
-# $ret .= $self->getlog_env_app($envvars, "WINBINDD");
+ $ret .= $self->getlog_env_app($envvars, "WINBINDD");
return $ret;
}
@@ -160,8 +160,13 @@ sub check_or_start($$$$) {
open STDOUT, ">$env_vars->{NMBD_TEST_LOG}";
open STDERR, '>&STDOUT';
+ SocketWrapper::set_default_iface($env_vars->{SOCKET_WRAPPER_DEFAULT_IFACE});
+
$ENV{WINBINDD_SOCKET_DIR} = $env_vars->{WINBINDD_SOCKET_DIR};
+ $ENV{NSS_WRAPPER_PASSWD} = $env_vars->{NSS_WRAPPER_PASSWD};
+ $ENV{NSS_WRAPPER_GROUP} = $env_vars->{NSS_WRAPPER_GROUP};
+
my @optargs = ("-d0");
if (defined($ENV{NMBD_OPTIONS})) {
@optargs = split(/ /, $ENV{NMBD_OPTIONS});
@@ -186,16 +191,26 @@ sub check_or_start($$$$) {
open STDOUT, ">$env_vars->{WINBINDD_TEST_LOG}";
open STDERR, '>&STDOUT';
+ SocketWrapper::set_default_iface($env_vars->{SOCKET_WRAPPER_DEFAULT_IFACE});
+
$ENV{WINBINDD_SOCKET_DIR} = $env_vars->{WINBINDD_SOCKET_DIR};
+ $ENV{NSS_WRAPPER_PASSWD} = $env_vars->{NSS_WRAPPER_PASSWD};
+ $ENV{NSS_WRAPPER_GROUP} = $env_vars->{NSS_WRAPPER_GROUP};
+
my @optargs = ("-d0");
if (defined($ENV{WINBINDD_OPTIONS})) {
@optargs = split(/ /, $ENV{WINBINDD_OPTIONS});
}
- $ENV{$ENV{LIB_PATH_VAR}} = $self->{bindir};
$ENV{MAKE_TEST_BINARY} = $self->binpath("winbindd");
- exec($self->binpath("timelimit"), $winbindd_maxtime, $ENV{WINBINDD_VALGRIND}, $self->binpath("winbindd"), "-F", "-S", "--no-process-group", "-s", $env_vars->{SERVERCONFFILE}, @optargs) or die("Unable to start winbindd: $!");
+
+ my @preargs = ($self->binpath("timelimit"), $winbindd_maxtime);
+ if(defined($ENV{WINBINDD_VALGRIND})) {
+ @preargs = split(/ /, $ENV{WINBINDD_VALGRIND});
+ }
+
+ exec(@preargs, $self->binpath("winbindd"), "-F", "-S", "--no-process-group", "-s", $env_vars->{SERVERCONFFILE}, @optargs) or die("Unable to start winbindd: $!");
}
write_pid($env_vars, "winbindd", $pid);
print "DONE\n";
@@ -207,8 +222,13 @@ sub check_or_start($$$$) {
open STDOUT, ">$env_vars->{SMBD_TEST_LOG}";
open STDERR, '>&STDOUT';
+ SocketWrapper::set_default_iface($env_vars->{SOCKET_WRAPPER_DEFAULT_IFACE});
+
$ENV{WINBINDD_SOCKET_DIR} = $env_vars->{WINBINDD_SOCKET_DIR};
+ $ENV{NSS_WRAPPER_PASSWD} = $env_vars->{NSS_WRAPPER_PASSWD};
+ $ENV{NSS_WRAPPER_GROUP} = $env_vars->{NSS_WRAPPER_GROUP};
+
$ENV{MAKE_TEST_BINARY} = $self->binpath("smbd");
my @optargs = ("-d0");
if (defined($ENV{SMBD_OPTIONS})) {
@@ -273,13 +293,17 @@ sub provision($$$)
my $server_ip = "127.0.0.2";
my $domain = "SAMBA-TEST";
- my $username = `PATH=/usr/ucb:$ENV{PATH} whoami`;
- chomp $username;
+ my $unix_name = ($ENV{USER} or $ENV{LOGNAME} or `PATH=/usr/ucb:$ENV{PATH} whoami`);
+ chomp $unix_name;
+ my $unix_uid = $>;
+ my $unix_gids_str = $);
+ my @unix_gids = split(" ", $unix_gids_str);
my $password = "test";
my $srcdir="$RealBin/..";
my $scriptdir="$srcdir/selftest";
my $prefix_abs = abs_path($prefix);
+ my $bindir_abs = abs_path($self->{bindir});
my @dirs = ();
@@ -315,9 +339,18 @@ sub provision($$$)
my $conffile="$libdir/server.conf";
+ my $nss_wrapper_pl = "$ENV{PERL} $srcdir/../lib/nss_wrapper/nss_wrapper.pl";
+ my $nss_wrapper_passwd = "$privatedir/passwd";
+ my $nss_wrapper_group = "$privatedir/group";
+
open(CONF, ">$conffile") or die("Unable to open $conffile");
print CONF "
[global]
+ netbios name = $server
+ interfaces = $server_ip/8
+ bind interfaces only = yes
+ panic action = $scriptdir/gdb_backtrace %d %\$(MAKE_TEST_BINARY)
+
workgroup = $domain
private dir = $privatedir
@@ -328,42 +361,51 @@ sub provision($$$)
name resolve order = bcast
- netbios name = $server
- interfaces = $server_ip/8
- bind interfaces only = yes
- panic action = $scriptdir/gdb_backtrace %d %\$(MAKE_TEST_BINARY)
+ state directory = $lockdir
+ cache directory = $lockdir
passdb backend = tdbsam
- ; Necessary to add the build farm hacks
- add user script = /bin/false
- add machine script = /bin/false
-
- kernel oplocks = no
- kernel change notify = no
-
- syslog = no
- printing = bsd
- printcap name = /dev/null
-
";
if ($role eq "dc") {
- print CONF "\tdomain logons = yes\n";
print CONF "\tdomain master = yes\n";
+ print CONF "\tdomain logons = yes\n";
}
print CONF "
+ time server = yes
+
+ add user script = $nss_wrapper_pl --path $nss_wrapper_passwd --type passwd --action add --name %u
+ add machine script = $nss_wrapper_pl --path $nss_wrapper_passwd --type passwd --action add --name %u
+ delete user script = $nss_wrapper_pl --path $nss_wrapper_passwd --type passwd --action delete --name %u
+
+ kernel oplocks = no
+ kernel change notify = no
+
+ syslog = no
+ printing = bsd
+ printcap name = /dev/null
winbindd:socket dir = $wbsockdir
+ idmap uid = 100000-200000
+ idmap gid = 100000-200000
+
+# min receivefile size = 4000
-[tmp]
- path = $shrdir
read only = no
smbd:sharedelay = 100000
+ smbd:writetimeupdatedelay = 500000
map hidden = yes
map system = yes
create mask = 755
+ vfs objects = $bindir_abs/xattr_tdb.so $bindir_abs/streams_depot.so
+
+ #Include user defined custom parameters if set
+ $ENV{INCLUDE_CUSTOM_CONF}
+
+[tmp]
+ path = $shrdir
[hideunread]
copy = tmp
hide unreadable = yes
@@ -387,10 +429,31 @@ print CONF "
## create a test account
##
- open(PWD, "|".$self->binpath("smbpasswd")." -c $conffile -L -s -a $username >/dev/null");
+ open(PASSWD, ">$nss_wrapper_passwd") or die("Unable to open $nss_wrapper_passwd");
+ print PASSWD "
+nobody:x:65534:65533:nobody gecos:$prefix_abs:/bin/false
+$unix_name:x:$unix_uid:$unix_gids[0]:$unix_name gecos:$prefix_abs:/bin/false
+";
+ close(PASSWD);
+
+ open(GROUP, ">$nss_wrapper_group") or die("Unable to open $nss_wrapper_group");
+ print GROUP "
+nobody:x:65533:
+nogroup:x:65534:nobody
+$unix_name-group:x:$unix_gids[0]:
+";
+ close(GROUP);
+
+ $ENV{NSS_WRAPPER_PASSWD} = $nss_wrapper_passwd;
+ $ENV{NSS_WRAPPER_GROUP} = $nss_wrapper_group;
+
+ open(PWD, "|".$self->binpath("smbpasswd")." -c $conffile -L -s -a $unix_name >/dev/null");
print PWD "$password\n$password\n";
close(PWD) or die("Unable to set password for test account");
+ $ENV{NSS_WRAPPER_PASSWD} = undef;
+ $ENV{NSS_WRAPPER_GROUP} = undef;
+
print "DONE\n";
$ret{SERVER_IP} = $server_ip;
@@ -400,13 +463,17 @@ print CONF "
$ret{SERVERCONFFILE} = $conffile;
$ret{CONFIGURATION} ="-s $conffile";
$ret{SERVER} = $server;
- $ret{USERNAME} = $username;
+ $ret{USERNAME} = $unix_name;
$ret{DOMAIN} = $domain;
$ret{NETBIOSNAME} = $server;
$ret{PASSWORD} = $password;
$ret{PIDDIR} = $piddir;
$ret{WINBINDD_SOCKET_DIR} = $wbsockdir;
$ret{WINBINDD_PRIV_PIPE_DIR} = $wbsockprivdir;
+ $ret{SOCKET_WRAPPER_DEFAULT_IFACE} => 2,
+ $ret{NSS_WRAPPER_PASSWD} = $nss_wrapper_passwd;
+ $ret{NSS_WRAPPER_GROUP} = $nss_wrapper_group;
+
return \%ret;
}
@@ -428,6 +495,11 @@ sub wait_for_start($$)
system($self->binpath("smbclient") ." $envvars->{CONFIGURATION} -L $envvars->{SERVER_IP} -U% -p 139 | head -2");
system($self->binpath("smbclient") ." $envvars->{CONFIGURATION} -L $envvars->{SERVER_IP} -U% -p 139 | head -2");
+ print "creating BUILTIN\\Administrators\n";
+ $ENV{WINBINDD_SOCKET_DIR} = $envvars->{WINBINDD_SOCKET_DIR};
+ system($self->binpath("net") ." $envvars->{CONFIGURATION} sam createbuiltingroup Administrators");
+ $ENV{WINBINDD_SOCKET_DIR} = undef;
+
print $self->getlog_env($envvars);
}