s4 smbd standard tests: limit forked processes
[amitay/samba.git] / selftest / target / Samba4.pm
index 0a6c85d1ba7ba6ac60d5b7df1d91f192a29af401..c54942b61fd0cf5e69a2919917fad7468ed0eaa0 100755 (executable)
@@ -2228,6 +2228,7 @@ sub check_env($$)
        renamedc             => ["backupfromdc"],
        offlinebackupdc      => ["backupfromdc"],
        labdc                => ["backupfromdc"],
+       proclimitdc          => [],
 
        none                 => [],
 );
@@ -2688,6 +2689,44 @@ sub setup_preforkrestartdc
        return $env;
 }
 
+#
+# ad_dc test environment used solely to test standard process model connection
+# process limits. As the limit is set artificially low it should not be used
+# for other tests.
+sub setup_proclimitdc
+{
+       my ($self, $path) = @_;
+
+       # If we didn't build with ADS, pretend this env was never available
+       if (not $self->{target3}->have_ads()) {
+              return "UNKNOWN";
+       }
+
+       my $env = $self->provision_ad_dc(
+               $path,
+               "proclimitdc",
+               "PROCLIMITDOM",
+               "proclimit.samba.example.com",
+               "max smbd processes = 20");
+       unless ($env) {
+               return undef;
+       }
+
+       $env->{NSS_WRAPPER_MODULE_SO_PATH} = undef;
+       $env->{NSS_WRAPPER_MODULE_FN_PREFIX} = undef;
+
+       if (not defined($self->check_or_start($env, "standard"))) {
+           return undef;
+       }
+
+       my $upn_array = ["$env->{REALM}.upn"];
+       my $spn_array = ["$env->{REALM}.spn"];
+
+       $self->setup_namespaces($env, $upn_array, $spn_array);
+
+       return $env;
+}
+
 # Sets up a DC that's solely used to do a domain backup from. We then use the
 # backupfrom-DC to create the restore-DC - this proves that the backup/restore
 # process will create a Samba DC that will actually start up.