diff options
-rwxr-xr-x | selftest/selftest.pl | 10 | ||||
-rw-r--r-- | selftest/target/Samba4.pm | 77 |
2 files changed, 83 insertions, 4 deletions
diff --git a/selftest/selftest.pl b/selftest/selftest.pl index 6ec429b6ce..668afbe653 100755 --- a/selftest/selftest.pl +++ b/selftest/selftest.pl @@ -767,18 +767,24 @@ my @exported_envvars = ( "DC_NETBIOSNAME", "DC_NETBIOSALIAS", - # domain controller stuff + # domain member "MEMBER_SERVER", "MEMBER_SERVER_IP", "MEMBER_NETBIOSNAME", "MEMBER_NETBIOSALIAS", - # domain controller stuff + # rpc proxy controller stuff "RPC_PROXY_SERVER", "RPC_PROXY_SERVER_IP", "RPC_PROXY_NETBIOSNAME", "RPC_PROXY_NETBIOSALIAS", + # domain controller stuff for Vampired DC + "VAMPIRE_DC_SERVER", + "VAMPIRE_DC_SERVER_IP", + "VAMPIRE_DC_NETBIOSNAME", + "VAMPIRE_DC_NETBIOSALIAS", + # server stuff "SERVER", "SERVER_IP", diff --git a/selftest/target/Samba4.pm b/selftest/target/Samba4.pm index 343834cb45..0bc9c005e5 100644 --- a/selftest/target/Samba4.pm +++ b/selftest/target/Samba4.pm @@ -905,6 +905,58 @@ sub provision_rpc_proxy($$$) return $ret; } +sub provision_vampire_dc($$$) +{ + my ($self, $prefix, $dcvars) = @_; + print "PROVISIONING VAMPIRE DC..."; + + # We do this so that we don't run the provision. That's the job of 'net vampire'. + my $ctx = $self->provision_raw_prepare($prefix, "domain controller", + "localvampiredc", "localvampiredc5", 5, $dcvars->{PASSWORD}, + $dcvars->{SERVER_IP}); + + $ctx->{smb_conf_extra_options} = " + max xmit = 32K + server max protocol = SMB2 + +[sysvol] + path = $ctx->{lockdir}/sysvol + read only = yes + +[netlogon] + path = $ctx->{lockdir}/sysvol/$ctx->{dnsname}/scripts + read only = no + +"; + + my $ret = $self->provision_raw_step1($ctx); + + $ret or die("Unable to prepare test env"); + + my $net = $self->bindir_path("net"); + my $cmd = ""; + $cmd .= "SOCKET_WRAPPER_DEFAULT_IFACE=\"$ret->{SOCKET_WRAPPER_DEFAULT_IFACE}\" "; + $cmd .= "KRB5_CONFIG=\"$ret->{KRB5_CONFIG}\" "; + $cmd .= "$net vampire $ret->{CONFIGURATION} $dcvars->{DOMAIN} --realm=$dcvars->{REALM}"; + $cmd .= " -U$dcvars->{DC_USERNAME}\%$dcvars->{DC_PASSWORD}"; + + system($cmd) == 0 or die("Join failed\n$cmd"); + + $ret->{VAMPIRE_DC_SERVER} = $ret->{SERVER}; + $ret->{VAMPIRE_DC_SERVER_IP} = $ret->{SERVER_IP}; + $ret->{VAMPIRE_DC_NETBIOSNAME} = $ret->{NETBIOSNAME}; + $ret->{VAMPIRE_DC_NETBIOSALIAS} = $ret->{NETBIOSALIAS}; + + $ret->{DC_SERVER} = $dcvars->{DC_SERVER}; + $ret->{DC_SERVER_IP} = $dcvars->{DC_SERVER_IP}; + $ret->{DC_NETBIOSNAME} = $dcvars->{DC_NETBIOSNAME}; + $ret->{DC_NETBIOSALIAS} = $dcvars->{DC_NETBIOSALIAS}; + $ret->{DC_USERNAME} = $dcvars->{DC_USERNAME}; + $ret->{DC_PASSWORD} = $dcvars->{DC_PASSWORD}; + + return $ret; +} + sub provision_dc($$) { my ($self, $prefix) = @_; @@ -1011,6 +1063,11 @@ sub setup_env($$$) $self->setup_dc("$path/dc"); } return $self->setup_rpc_proxy("$path/rpc_proxy", $self->{vars}->{dc}); + } elsif ($envname eq "vampire_dc") { + if (not defined($self->{vars}->{dc})) { + $self->setup_dc("$path/dc"); + } + return $self->setup_vampire_dc("$path/vampire_dc", $self->{vars}->{dc}); } elsif ($envname eq "member") { if (not defined($self->{vars}->{dc})) { $self->setup_dc("$path/dc"); @@ -1037,7 +1094,7 @@ sub setup_env($$$) } } -sub setup_member($$$$) +sub setup_member($$$) { my ($self, $path, $dc_vars) = @_; @@ -1052,7 +1109,7 @@ sub setup_member($$$$) return $env; } -sub setup_rpc_proxy($$$$) +sub setup_rpc_proxy($$$) { my ($self, $path, $dc_vars) = @_; @@ -1083,6 +1140,22 @@ sub setup_dc($$) return $env; } +sub setup_vampire_dc($$$) +{ + my ($self, $path, $dc_vars) = @_; + + my $env = $self->provision_vampire_dc($path, $dc_vars); + + $self->check_or_start($env, + ($ENV{SMBD_MAXTIME} or 7500)); + + $self->wait_for_start($env); + + $self->{vars}->{vampire_dc} = $env; + + return $env; +} + sub stop($) { my ($self) = @_; |