selftest: Ensure vampiredc has a full copy of localdc before we start
authorAndrew Bartlett <abartlet@samba.org>
Wed, 30 Nov 2016 04:09:44 +0000 (17:09 +1300)
committerAndrew Bartlett <abartlet@samba.org>
Thu, 1 Dec 2016 04:54:21 +0000 (05:54 +0100)
Otherwise we may fail tests because we are still pulling in the full replica
from localdc during the tests.  This may block RID allocation in particular.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
selftest/target/Samba4.pm

index caf46b26c86c1e6512678ce63fbbe4953909ac78..ec91f001b944a1c7093cf95e0dc38f6b56983191 100755 (executable)
@@ -2268,6 +2268,33 @@ sub setup_vampire_dc($$$)
                        warn("Failed to replicate\n$cmd_repl");
                        return undef;
                }
+
+               # Pull in a full set of changes from the main DC
+               my $base_dn = "DC=".join(",DC=", split(/\./, $dc_vars->{REALM}));
+               $cmd = "";
+               $cmd .= "SOCKET_WRAPPER_DEFAULT_IFACE=\"$env->{SOCKET_WRAPPER_DEFAULT_IFACE}\" ";
+               if (defined($env->{RESOLV_WRAPPER_CONF})) {
+                       $cmd .= "RESOLV_WRAPPER_CONF=\"$env->{RESOLV_WRAPPER_CONF}\" ";
+               } else {
+                       $cmd .= "RESOLV_WRAPPER_HOSTS=\"$env->{RESOLV_WRAPPER_HOSTS}\" ";
+               }
+               $cmd .= " KRB5_CONFIG=\"$env->{KRB5_CONFIG}\"";
+               $cmd .= "KRB5CCNAME=\"$env->{KRB5_CCACHE}\" ";
+               $cmd .= " $samba_tool drs replicate $env->{SERVER} $env->{DC_SERVER}";
+               $cmd .= " $dc_vars->{CONFIGURATION}";
+               $cmd .= " -U$dc_vars->{DC_USERNAME}\%$dc_vars->{DC_PASSWORD}";
+               # replicate Configuration NC
+               my $cmd_repl = "$cmd \"CN=Configuration,$base_dn\"";
+               unless(system($cmd_repl) == 0) {
+                       warn("Failed to replicate\n$cmd_repl");
+                       return undef;
+               }
+               # replicate Default NC
+               $cmd_repl = "$cmd \"$base_dn\"";
+               unless(system($cmd_repl) == 0) {
+                       warn("Failed to replicate\n$cmd_repl");
+                       return undef;
+               }
        }
 
        return $env;