param: Remove winbindd privileged socket directory option
[sfrench/samba-autobuild/.git] / selftest / target / Samba4.pm
index a09abea59346e5da8c53f70d19b31ddfad03e713..dacdab40ac8bc5931f51511566820e088599abf3 100755 (executable)
@@ -442,7 +442,6 @@ sub provision_raw_prepare($$$$$$$$$$$)
        $ctx->{statedir} = "$prefix_abs/statedir";
        $ctx->{cachedir} = "$prefix_abs/cachedir";
        $ctx->{winbindd_socket_dir} = "$prefix_abs/winbindd_socket";
-       $ctx->{winbindd_privileged_socket_dir} = "$prefix_abs/winbindd_privileged_socket";
        $ctx->{ntp_signd_socket_dir} = "$prefix_abs/ntp_signd_socket";
        $ctx->{nsswrap_passwd} = "$ctx->{etcdir}/passwd";
        $ctx->{nsswrap_group} = "$ctx->{etcdir}/group";
@@ -560,7 +559,6 @@ sub provision_raw_step1($$)
        state directory = $ctx->{statedir}
        cache directory = $ctx->{cachedir}
        winbindd socket directory = $ctx->{winbindd_socket_dir}
-       winbindd privileged socket directory = $ctx->{winbindd_privileged_socket_dir}
        ntp signd socket directory = $ctx->{ntp_signd_socket_dir}
        winbind separator = /
        interfaces = $ctx->{interfaces}
@@ -592,6 +590,9 @@ sub provision_raw_step1($$)
         idmap_ldb:use rfc2307=yes
        winbind enum users = yes
        winbind enum groups = yes
+
+        rpc server port:netlogon = 1026
+
 ";
 
        print CONFFILE "
@@ -805,6 +806,22 @@ userPrincipalName: testdenied_upn\@$ctx->{realm}.upn
                return undef;
        }
 
+       # Create to users alice and bob!
+       my $user_account_array = ["alice", "bob"];
+
+       foreach my $user_account (@{$user_account_array}) {
+               my $samba_tool_cmd = "";
+
+               $samba_tool_cmd .= "KRB5_CONFIG=\"$ret->{KRB5_CONFIG}\" ";
+               $samba_tool_cmd .= "KRB5CCNAME=\"$ret->{KRB5_CCACHE}\" ";
+               $samba_tool_cmd .= Samba::bindir_path($self, "samba-tool")
+                   . " user create --configfile=$ctx->{smb_conf} $user_account Secret007";
+               unless (system($samba_tool_cmd) == 0) {
+                       warn("Unable to create user: $user_account\n$samba_tool_cmd\n");
+                       return undef;
+               }
+       }
+
        return $ret;
 }
 
@@ -844,7 +861,6 @@ sub provision($$$$$$$$$$)
        server max protocol = SMB2
        host msdfs = $msdfs
        lanman auth = yes
-       allow nt4 crypto = yes
 
        # fruit:copyfile is a global option
        fruit:copyfile = yes
@@ -921,7 +937,7 @@ sub provision($$$$$$$$$$)
        path = $ctx->{share}
        vfs objects = catia fruit streams_xattr acl_xattr
        ea support = yes
-       fruit:ressource = file
+       fruit:resource = file
        fruit:metadata = netatalk
        fruit:locking = netatalk
        fruit:encoding = native
@@ -1383,6 +1399,9 @@ sub provision_ad_dc_ntvfs($$)
         my $extra_conf_options = "netbios aliases = localDC1-a
         server services = +winbind -winbindd
        ldap server require strong auth = allow_sasl_over_tls
+       allow nt4 crypto = yes
+       lsa over netlogon = yes
+        rpc server port = 1027
        ";
        my $ret = $self->provision($prefix,
                                   "domain controller",
@@ -1863,7 +1882,7 @@ sub provision_chgdcpass($$)
        return $ret;
 }
 
-sub teardown_env($$)
+sub teardown_env_terminate($$)
 {
        my ($self, $envvars) = @_;
        my $pid;
@@ -1876,28 +1895,50 @@ sub teardown_env($$)
        my $childpid;
 
        # This should give it time to write out the gcov data
+       until ($count > 15) {
+           if (Samba::cleanup_child($pid, "samba") != 0) {
+               return;
+           }
+           sleep(1);
+           $count++;
+       }
+
+       # After 15 Seconds, work out why this thing is still alive
+       warn "server process $pid took more than $count seconds to exit, showing backtrace:\n";
+       system("$self->{srcdir}/selftest/gdb_backtrace $pid");
+
        until ($count > 30) {
-           if (Samba::cleanup_child($pid, "samba") == -1) {
-               last;
+           if (Samba::cleanup_child($pid, "samba") != 0) {
+               return;
            }
            sleep(1);
            $count++;
        }
 
-       if ($count > 30 || kill(0, $pid)) {
+       if (kill(0, $pid)) {
+           warn "server process $pid took more than $count seconds to exit, sending SIGTERM\n";
            kill "TERM", $pid;
+       }
 
-           until ($count > 40) {
-               if (Samba::cleanup_child($pid, "samba") == -1) {
-                   last;
-               }
-               sleep(1);
-               $count++;
+       until ($count > 40) {
+           if (Samba::cleanup_child($pid, "samba") != 0) {
+               return;
            }
-           # If it is still around, kill it
-           warn "server process $pid took more than $count seconds to exit, killing\n";
+           sleep(1);
+           $count++;
+       }
+       # If it is still around, kill it
+       if (kill(0, $pid)) {
+           warn "server process $pid took more than $count seconds to exit, killing\n with SIGKILL\n";
            kill 9, $pid;
        }
+       return;
+}
+
+sub teardown_env($$)
+{
+       my ($self, $envvars) = @_;
+       teardown_env_terminate($self, $envvars);
 
        $self->slapd_stop($envvars) if ($self->{ldap});
 
@@ -2230,6 +2271,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;