$self->stop_sig_term($smbdpid);
$self->stop_sig_term($nmbdpid);
$self->stop_sig_term($winbinddpid);
+
+ sleep(2);
+
$self->stop_sig_kill($smbdpid);
$self->stop_sig_kill($nmbdpid);
$self->stop_sig_kill($winbinddpid);
if ($envname eq "dc") {
return $self->setup_dc("$path/dc");
+ } elsif ($envname eq "member") {
+ if (not defined($self->{vars}->{dc})) {
+ $self->setup_dc("$path/dc");
+ }
+ return $self->setup_member("$path/member", $self->{vars}->{dc});
} else {
return undef;
}
my $dc_options = "
domain master = yes
domain logons = yes
+ lanman auth = yes
";
my $vars = $self->provision($path,
$dc_options);
$self->check_or_start($vars,
- ($ENV{NMBD_MAXTIME} or 2700),
- ($ENV{WINBINDD_MAXTIME} or 2700),
- ($ENV{SMBD_MAXTIME} or 2700));
+ ($ENV{SMBD_MAXTIME} or 2700),
+ "yes", "yes", "yes");
$self->wait_for_start($vars);
+ $self->{vars}->{dc} = $vars;
+
return $vars;
}
+sub setup_member($$$)
+{
+ my ($self, $prefix, $dcvars) = @_;
+
+ print "PROVISIONING MEMBER...";
+
+ my $member_options = "
+ security = domain
+ server signing = on
+";
+ my $ret = $self->provision($prefix,
+ "LOCALMEMBER3",
+ 3,
+ "localmember3pass",
+ $member_options);
+
+ $ret or die("Unable to provision");
+
+ my $net = $self->binpath("net");
+ my $cmd = "";
+ $cmd .= "SOCKET_WRAPPER_DEFAULT_IFACE=\"$ret->{SOCKET_WRAPPER_DEFAULT_IFACE}\" ";
+ $cmd .= "$net join $ret->{CONFIGURATION} $dcvars->{DOMAIN} member";
+ $cmd .= " -U$dcvars->{USERNAME}\%$dcvars->{PASSWORD}";
+
+ system($cmd) == 0 or die("Join failed\n$cmd");
+
+ $self->check_or_start($ret,
+ ($ENV{SMBD_MAXTIME} or 2700),
+ "yes", "yes", "yes");
+
+ $self->wait_for_start($ret);
+
+ $ret->{DC_SERVER} = $dcvars->{SERVER};
+ $ret->{DC_SERVER_IP} = $dcvars->{SERVER_IP};
+ $ret->{DC_NETBIOSNAME} = $dcvars->{NETBIOSNAME};
+ $ret->{DC_USERNAME} = $dcvars->{USERNAME};
+ $ret->{DC_PASSWORD} = $dcvars->{PASSWORD};
+
+ return $ret;
+}
+
sub stop($)
{
my ($self) = @_;
return $pid;
}
-sub check_or_start($$$$) {
- my ($self, $env_vars, $nmbd_maxtime, $winbindd_maxtime, $smbd_maxtime) = @_;
+sub check_or_start($$$$$) {
+ my ($self, $env_vars, $maxtime, $nmbd, $winbindd, $smbd) = @_;
unlink($env_vars->{NMBD_TEST_LOG});
print "STARTING NMBD...";
$ENV{NSS_WRAPPER_PASSWD} = $env_vars->{NSS_WRAPPER_PASSWD};
$ENV{NSS_WRAPPER_GROUP} = $env_vars->{NSS_WRAPPER_GROUP};
+ if ($nmbd ne "yes") {
+ $SIG{USR1} = $SIG{ALRM} = $SIG{INT} = $SIG{QUIT} = $SIG{TERM} = sub {
+ my $signame = shift;
+ print("Skip nmbd received signal $signame");
+ exit 0;
+ };
+ sleep($maxtime);
+ exit 0;
+ }
+
my @optargs = ("-d0");
if (defined($ENV{NMBD_OPTIONS})) {
@optargs = split(/ /, $ENV{NMBD_OPTIONS});
$ENV{MAKE_TEST_BINARY} = $self->binpath("nmbd");
- my @preargs = ($self->binpath("timelimit"), $nmbd_maxtime);
+ my @preargs = ($self->binpath("timelimit"), $maxtime);
if(defined($ENV{NMBD_VALGRIND})) {
@preargs = split(/ /, $ENV{NMBD_VALGRIND});
}
$ENV{NSS_WRAPPER_PASSWD} = $env_vars->{NSS_WRAPPER_PASSWD};
$ENV{NSS_WRAPPER_GROUP} = $env_vars->{NSS_WRAPPER_GROUP};
+ if ($winbindd ne "yes") {
+ $SIG{USR1} = $SIG{ALRM} = $SIG{INT} = $SIG{QUIT} = $SIG{TERM} = sub {
+ my $signame = shift;
+ print("Skip winbindd received signal $signame");
+ exit 0;
+ };
+ sleep($maxtime);
+ exit 0;
+ }
+
my @optargs = ("-d0");
if (defined($ENV{WINBINDD_OPTIONS})) {
@optargs = split(/ /, $ENV{WINBINDD_OPTIONS});
$ENV{MAKE_TEST_BINARY} = $self->binpath("winbindd");
- my @preargs = ($self->binpath("timelimit"), $winbindd_maxtime);
+ my @preargs = ($self->binpath("timelimit"), $maxtime);
if(defined($ENV{WINBINDD_VALGRIND})) {
@preargs = split(/ /, $ENV{WINBINDD_VALGRIND});
}
$ENV{NSS_WRAPPER_PASSWD} = $env_vars->{NSS_WRAPPER_PASSWD};
$ENV{NSS_WRAPPER_GROUP} = $env_vars->{NSS_WRAPPER_GROUP};
+ if ($smbd ne "yes") {
+ $SIG{USR1} = $SIG{ALRM} = $SIG{INT} = $SIG{QUIT} = $SIG{TERM} = sub {
+ my $signame = shift;
+ print("Skip smbd received signal $signame");
+ exit 0;
+ };
+ sleep($maxtime);
+ exit 0;
+ }
+
$ENV{MAKE_TEST_BINARY} = $self->binpath("smbd");
my @optargs = ("-d0");
if (defined($ENV{SMBD_OPTIONS})) {
@optargs = split(/ /, $ENV{SMBD_OPTIONS});
}
- my @preargs = ($self->binpath("timelimit"), $smbd_maxtime);
+ my @preargs = ($self->binpath("timelimit"), $maxtime);
if(defined($ENV{SMBD_VALGRIND})) {
@preargs = split(/ /,$ENV{SMBD_VALGRIND});
}
my $logdir = "$prefix/logs";
my $piddir = "$prefix/pid";
my $privatedir = "$prefix/private";
- my $scriptdir = "$RealBin/..";
my $conffile = "$prefix/smb.conf";
my $torture_interfaces='127.0.0.6/8,127.0.0.7/8,127.0.0.8/8,127.0.0.9/8,127.0.0.10/8,127.0.0.11/8';
netbios name = TORTURE_6
interfaces = $torture_interfaces
- panic action = $scriptdir/gdb_backtrace \%d %\$(MAKE_TEST_BINARY)
+ panic action = $RealBin/gdb_backtrace \%d %\$(MAKE_TEST_BINARY)
passdb backend = tdbsam
";
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});
##
## create the test directory layout
##
+ die ("prefix_abs = ''") if $prefix_abs eq "";
+ die ("prefix_abs = '/'") if $prefix_abs eq "/";
+
mkdir($prefix_abs, 0777);
print "CREATE TEST ENVIRONMENT IN '$prefix'...";
system("rm -rf $prefix_abs/*");
my $conffile="$libdir/server.conf";
- my $nss_wrapper_pl = "$ENV{PERL} $srcdir/../lib/nss_wrapper/nss_wrapper.pl";
+ my $nss_wrapper_pl = "$ENV{PERL} $RealBin/../lib/nss_wrapper/nss_wrapper.pl";
my $nss_wrapper_passwd = "$privatedir/passwd";
my $nss_wrapper_group = "$privatedir/group";
netbios name = $server
interfaces = $server_ip/8
bind interfaces only = yes
- panic action = $scriptdir/gdb_backtrace %d %\$(MAKE_TEST_BINARY)
+ panic action = $RealBin/gdb_backtrace %d %\$(MAKE_TEST_BINARY)
workgroup = $domain
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
+ add user script = $nss_wrapper_pl --passwd_path $nss_wrapper_passwd --type passwd --action add --name %u
+ add group script = $nss_wrapper_pl --group_path $nss_wrapper_group --type group --action add --name %g
+ add machine script = $nss_wrapper_pl --passwd_path $nss_wrapper_passwd --type passwd --action add --name %u
+ add user to group script = $nss_wrapper_pl --passwd_path $nss_wrapper_passwd --type member --action add --member %u --name %g --group_path $nss_wrapper_group
+ delete user script = $nss_wrapper_pl --passwd_path $nss_wrapper_passwd --type passwd --action delete --name %u
+ delete group script = $nss_wrapper_pl --group_path $nss_wrapper_group --type group --action delete --name %g
+ delete user from group script = $nss_wrapper_pl --passwd_path $nss_wrapper_passwd --type member --action delete --member %u --name %g --group_path $nss_wrapper_group
kernel oplocks = no
kernel change notify = no
# End extra options
#Include user defined custom parameters if set
- $ENV{INCLUDE_CUSTOM_CONF}
+";
+
+ if (defined($ENV{INCLUDE_CUSTOM_CONF})) {
+ print CONF "\t$ENV{INCLUDE_CUSTOM_CONF}\n";
+ }
+ print CONF "
[tmp]
path = $shrdir
[hideunread]
[print1]
copy = tmp
printable = yes
- printing = test
+ printing = vlp
+ print command = $bindir_abs/vlp tdbfile=$lockdir/vlp.tdb print %p %s
+ lpq command = $bindir_abs/vlp tdbfile=$lockdir/vlp.tdb lpq %p
+ lp rm command = $bindir_abs/vlp tdbfile=$lockdir/vlp.tdb lprm %p %j
+ lp pause command = $bindir_abs/vlp tdbfile=$lockdir/vlp.tdb lppause %p %j
+ lp resume command = $bindir_abs/vlp tdbfile=$lockdir/vlp.tdb lpresume %p %j
+ queue pause command = $bindir_abs/vlp tdbfile=$lockdir/vlp.tdb queuepause %p
+ queue resume command = $bindir_abs/vlp tdbfile=$lockdir/vlp.tdb queueresume %p
+
[print2]
copy = print1
[print3]
##
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
+ print PASSWD "nobody:x:65534:65533:nobody gecos:$prefix_abs:/bin/false
+root:x:65533:65532:root 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:
+ print GROUP "nobody:x:65533:
nogroup:x:65534:nobody
+root:x:65532:
$unix_name-group:x:$unix_gids[0]:
";
close(GROUP);
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;
+ delete $ENV{NSS_WRAPPER_PASSWD};
+ delete $ENV{NSS_WRAPPER_GROUP};
print "DONE\n";
$ret{SERVER_IP} = $server_ip;
$ret{NMBD_TEST_LOG} = "$prefix/nmbd_test.log";
+ $ret{NMBD_TEST_LOG_POS} = 0;
$ret{WINBINDD_TEST_LOG} = "$prefix/winbindd_test.log";
+ $ret{WINBINDD_TEST_LOG_POS} = 0;
$ret{SMBD_TEST_LOG} = "$prefix/smbd_test.log";
+ $ret{SMBD_TEST_LOG_POS} = 0;
$ret{SERVERCONFFILE} = $conffile;
$ret{CONFIGURATION} ="-s $conffile";
$ret{SERVER} = $server;
$ret{PIDDIR} = $piddir;
$ret{WINBINDD_SOCKET_DIR} = $wbsockdir;
$ret{WINBINDD_PRIV_PIPE_DIR} = $wbsockprivdir;
- $ret{SOCKET_WRAPPER_DEFAULT_IFACE} => $swiface,
+ $ret{SOCKET_WRAPPER_DEFAULT_IFACE} = $swiface;
$ret{NSS_WRAPPER_PASSWD} = $nss_wrapper_passwd;
$ret{NSS_WRAPPER_GROUP} = $nss_wrapper_group;
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);
}