selftest: make sure we always export KRB5CCNAME
authorStefan Metzmacher <metze@samba.org>
Fri, 16 Dec 2016 10:09:16 +0000 (11:09 +0100)
committerJeremy Allison <jra@samba.org>
Sat, 17 Dec 2016 21:58:28 +0000 (22:58 +0100)
We should not risk the usage of the users global ccache!

This results in unpredictable effects for the user and
selftest itself.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Sat Dec 17 22:58:28 CET 2016 on sn-devel-144

selftest/selftest.pl

index d707d25419eac3b8824b4d1638edc8af1231c2c6..c54ea68cac209e15cd86a3d021bd9eeed3781980 100755 (executable)
@@ -668,6 +668,9 @@ if ($opt_quick) {
 }
 $ENV{SELFTEST_MAXTIME} = $torture_maxtime;
 
+my $selftest_krbt_ccache_path = "$tmpdir_abs/selftest.krb5_ccache";
+$ENV{KRB5CCNAME} = "FILE:${selftest_krbt_ccache_path}.global";
+
 my @available = ();
 foreach my $fn (@testlists) {
        foreach (read_testlist($fn)) {
@@ -886,6 +889,8 @@ sub setup_env($$)
 
        $option = "client" if $option eq "";
 
+       $ENV{KRB5CCNAME} = "FILE:${selftest_krbt_ccache_path}.${envname}/ignore";
+
        if (defined(get_running_env($envname))) {
                $testenv_vars = get_running_env($envname);
                if (not $testenv_vars->{target}->check_env($testenv_vars)) {
@@ -927,6 +932,9 @@ sub setup_env($$)
                }
        }
 
+       my $krb5_ccache_path = "${selftest_krbt_ccache_path}.${envname}.${option}";
+       unlink($krb5_ccache_path);
+       $ENV{KRB5CCNAME} = "FILE:${krb5_ccache_path}";
        return $testenv_vars;
 }