]> eyrie.org Git - kerberos/kstart.git/commitdiff
Fix k5start/perms test on Heimdal
authorRuss Allbery <eagle@eyrie.org>
Tue, 30 Mar 2021 06:57:07 +0000 (23:57 -0700)
committerRuss Allbery <eagle@eyrie.org>
Tue, 30 Mar 2021 17:30:28 +0000 (10:30 -0700)
The Heimdal klist, even when it thinks it's running as root,
refuses to open a ticket cache owned by another user or with a
publicly-readable mode.  Work around this by checking the mode
and ownership first, then resetting them to what was expected
and checking the contents of the cache.

tests/k5start/perms-t

index df72c84e7012d4e39334a99b174f2e4d08f7d8da..dd94497355d7cc96c9b4ab20b7cabc87bcb7f0e4 100755 (executable)
@@ -67,13 +67,15 @@ is ($status, 0, 'k5start -o 42 -g 42 -m 440 succeeds');
 is ($err, '', ' with no errors');
 like ($out, qr/^Kerberos initialization for \Q$principal\E(\@\S+)?\n\z/,
       ' and the right output');
-my ($default, $service) = klist ();
-like ($default, qr/^\Q$principal\E(\@\S+)?\z/, ' for the right principal');
-like ($service, qr%^krbtgt/%, ' and the right service');
 ($mode, $uid, $gid) = (stat 'krb5cc_test')[2, 4, 5];
 is (($mode & 0777), 0440, ' mode is correct');
 is ($uid, 42, ' owner is correct');
 is ($gid, 42, ' group is correct');
+chown (0, 0, 'krb5cc_test');
+chmod (0600, 'krb5cc_test');
+my ($default, $service) = klist ();
+like ($default, qr/^\Q$principal\E(\@\S+)?\z/, ' for the right principal');
+like ($service, qr%^krbtgt/%, ' and the right service');
 
 # Just -o.
 unlink 'krb5cc_test';