use POSIX;
use target::Samba;
+sub have_ads($) {
+ my ($self) = @_;
+ my $found_ads = 0;
+ my $smbd_build_options = Samba::bindir_path($self, "smbd") . " -b|";
+ open(IN, $smbd_build_options) or die("Unable to run $smbd_build_options: $!");
+
+ while (<IN>) {
+ if (/WITH_ADS/) {
+ $found_ads = 1;
+ }
+ }
+ close IN;
+
+ # If we were not built with ADS support, pretend we were never even available
+ return $found_ads;
+}
+
sub new($$) {
- my ($classname, $bindir, $binary_mapping, $srcdir, $exeext, $server_maxtime) = @_;
- $exeext = "" unless defined($exeext);
+ my ($classname, $bindir, $binary_mapping, $srcdir, $server_maxtime) = @_;
my $self = { vars => {},
bindir => $bindir,
binary_mapping => $binary_mapping,
srcdir => $srcdir,
- exeext => $exeext,
server_maxtime => $server_maxtime
};
bless $self;
{
my ($self, $envname, $path) = @_;
+ if (defined($self->{vars}->{$envname})) {
+ return $self->{vars}->{$envname};
+ }
+
if ($envname eq "s3dc") {
return $self->setup_s3dc("$path/s3dc");
} elsif ($envname eq "secshare") {
}
return $self->setup_member("$path/member", $self->{vars}->{s3dc});
} else {
- return undef;
+ return "UNKNOWN";
}
}
{
my ($self, $prefix, $dcvars, $iface) = @_;
+ # If we didn't build with ADS, pretend this env was never available
+ if (not $self->have_ads()) {
+ return "UNKNOWN";
+ }
+
print "PROVISIONING S3 AD MEMBER$iface...";
my $member_options = "
return $ret;
}
-sub setup_plugin_s4_dc($$$$)
-{
- my ($self, $prefix, $dcvars, $iface) = @_;
-
- print "PROVISIONING S4 PLUGIN AD DC$iface...";
-
- my $plugin_s4_dc_options = "
- workgroup = $dcvars->{DOMAIN}
- realm = $dcvars->{REALM}
-
- security = ads
- domain logons = yes
- passdb backend = samba4
- auth methods = guest samba4
- server signing = on
-
- rpc_server:epmapper = disabled
- rpc_server:rpcecho = disabled
- rpc_server:dssetup = disabled
- rpc_server:svctl = disabled
- rpc_server:ntsvcs = disabled
- rpc_server:eventlog = disabled
- rpc_server:initshutdown = disabled
-
- rpc_server:winreg = embedded
- rpc_server:srvsvc = embedded
- rpc_server:netdfs = embedded
- rpc_server:wkssvc = embedded
- rpc_server:spoolss = embedded
-
- rpc_server:lsarpc = external
- rpc_server:netlogon = external
- rpc_server:samr = external
-
- rpc_daemon:epmd = disabled
- rpc_daemon:lsasd = disabled
- rpc_daemon:spoolssd = disabled
-
- rpc_server:tcpip = no
-
-[IPC\$]
- vfs objects = dfs_samba4
-";
-
- my $ret = $self->provision($prefix,
- "plugindc",
- $iface,
- "pluGin${iface}Pass",
- $plugin_s4_dc_options, 1);
-
- $ret or return undef;
-
- close(USERMAP);
- $ret->{DOMAIN} = $dcvars->{DOMAIN};
- $ret->{REALM} = $dcvars->{REALM};
- $ret->{KRB5_CONFIG} = $dcvars->{KRB5_CONFIG};
-
- # We need world access to this share, as otherwise the domain
- # administrator from the AD domain provided by Samba4 can't
- # access the share for tests.
- chmod 0777, "$prefix/share";
-
- $self->check_or_start($ret,
- "no", "no", "yes");
-
- $self->wait_for_start($ret);
-
- # Special case, this is called from Samba4.pm but needs to use the Samba3 check_env and get_log_env
- $ret->{target} = $self;
-
- return $ret;
-}
-
sub setup_secshare($$)
{
my ($self, $path) = @_;
{
my ($self, $prefix) = @_;
+ # If we didn't build with ADS, pretend this env was never available
+ if (not $self->have_ads()) {
+ return "UNKNOWN";
+ }
+
print "PROVISIONING server with security=ads...";
my $ktest_options = "
realm = ktest.samba.example.com
security = ads
username map = $prefix/lib/username.map
+ server signing = required
";
my $ret = $self->provision($prefix,
system("cp $self->{srcdir}/source3/selftest/ktest-krb5_ccache-3 $prefix/krb5_ccache-3");
chmod 0600, "$prefix/krb5_ccache-3";
+ # We need world access to this share, as otherwise the domain
+ # administrator from the AD domain provided by ktest can't
+ # access the share for tests.
+ chmod 0777, "$prefix/share";
+
$self->check_or_start($ret, "yes", "no", "yes");
if (not $self->wait_for_start($ret)) {
sub check_or_start($$$$$) {
my ($self, $env_vars, $nmbd, $winbindd, $smbd) = @_;
+ # use a pipe for stdin in the child processes. This allows
+ # those processes to monitor the pipe for EOF to ensure they
+ # exit when the test script exits
+ pipe(STDIN_READER, $env_vars->{STDIN_PIPE});
+
unlink($env_vars->{NMBD_TEST_LOG});
print "STARTING NMBD...";
my $pid = fork();
@preargs = split(/ /, $ENV{NMBD_VALGRIND});
}
+ close($env_vars->{STDIN_PIPE});
+ open STDIN, ">&", \*STDIN_READER or die "can't dup STDIN_READER to STDIN: $!";
+
exec(@preargs, Samba::bindir_path($self, "nmbd"), "-F", "--no-process-group", "--log-stdout", "-s", $env_vars->{SERVERCONFFILE}, @optargs) or die("Unable to start nmbd: $!");
}
write_pid($env_vars, "nmbd", $pid);
print "Starting winbindd with config $env_vars->{SERVERCONFFILE}\n";
+ close($env_vars->{STDIN_PIPE});
+ open STDIN, ">&", \*STDIN_READER or die "can't dup STDIN_READER to STDIN: $!";
+
exec(@preargs, Samba::bindir_path($self, "winbindd"), "-F", "--no-process-group", "--stdout", "-s", $env_vars->{SERVERCONFFILE}, @optargs) or die("Unable to start winbindd: $!");
}
write_pid($env_vars, "winbindd", $pid);
if(defined($ENV{SMBD_VALGRIND})) {
@preargs = split(/ /,$ENV{SMBD_VALGRIND});
}
+
+ close($env_vars->{STDIN_PIPE});
+ open STDIN, ">&", \*STDIN_READER or die "can't dup STDIN_READER to STDIN: $!";
+
exec(@preargs, Samba::bindir_path($self, "smbd"), "-F", "--no-process-group", "--log-stdout", "-s", $env_vars->{SERVERCONFFILE}, @optargs) or die("Unable to start smbd: $!");
}
write_pid($env_vars, "smbd", $pid);
print "DONE\n";
+ close(STDIN_READER);
+
return 0;
}
pid directory = $piddir
lock directory = $lockdir
log file = $logdir/log.\%m
- log level = 0
+ log level = 1
debug pid = yes
max log size = 0