selftest: Avoid system krb5.conf in "none" test env
authorUri Simchoni <uri@samba.org>
Mon, 26 Oct 2015 05:38:08 +0000 (07:38 +0200)
committerAndrew Bartlett <abartlet@samba.org>
Mon, 26 Oct 2015 23:28:34 +0000 (00:28 +0100)
Some torture tests do not perform Kerberos activity and do not
run against a server (hence the "none" test env), but do create
a krb5 context, and that causes the Kerberos libs to read
krb5.conf and choke if they don't understand it.

Signed-off-by: Uri Simchoni <uri@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
selftest/selftest.pl
selftest/target/Samba4.pm

index 779847f05a8df4779257867e234b32434fb09300..db5da05091eecb2fbe3870bdef8de0178b918f01 100755 (executable)
@@ -831,9 +831,7 @@ sub setup_env($$)
 
        $option = "client" if $option eq "";
 
-       if ($envname eq "none") {
-               $testenv_vars = {};
-       } elsif (defined(get_running_env($envname))) {
+       if (defined(get_running_env($envname))) {
                $testenv_vars = get_running_env($envname);
                if (not $testenv_vars->{target}->check_env($testenv_vars)) {
                        print $testenv_vars->{target}->getlog_env($testenv_vars);
@@ -901,7 +899,6 @@ sub getlog_env($)
 sub check_env($)
 {
        my ($envname) = @_;
-       return 1 if ($envname eq "none");
        my $env = get_running_env($envname);
        return $env->{target}->check_env($env);
 }
index c32830d94b94cf4f9d149caf0b430849d4d12ce5..65308e293e065e137a175c0684a0fa34a33f5b51 100755 (executable)
@@ -1999,8 +1999,11 @@ sub getlog_env($$)
 sub check_env($$)
 {
        my ($self, $envvars) = @_;
+       my $samba_pid = $envvars->{SAMBA_PID};
 
-       my $childpid = Samba::cleanup_child($envvars->{SAMBA_PID}, "samba");
+       return 1 if $samba_pid == -1;
+
+       my $childpid = Samba::cleanup_child($samba_pid, "samba");
 
        return ($childpid == 0);
 }
@@ -2077,6 +2080,8 @@ sub setup_env($$$)
                }
                return $target3->setup_admember_rfc2307("$path/ad_member_rfc2307",
                                                        $self->{vars}->{ad_dc_ntvfs}, 34);
+       } elsif ($envname eq "none") {
+               return $self->setup_none("$path/none");
        } else {
                return "UNKNOWN";
        }
@@ -2479,4 +2484,14 @@ sub setup_ad_dc($$)
        return $env;
 }
 
+sub setup_none($$)
+{
+       my ($self, $path) = @_;
+
+       my $ret = {
+               KRB5_CONFIG => abs_path($path) . "/no_krb5.conf",
+               SAMBA_PID => -1,
+       }
+}
+
 1;