8022931: Enhance Kerberos exceptions

Reviewed-by: xuelei, ahgross
This commit is contained in:
Weijun Wang 2013-08-14 15:25:16 +08:00
parent 60e31c0960
commit 9b8991f944

View File

@ -26,6 +26,7 @@
package javax.security.auth.kerberos;
import java.io.File;
import java.security.AccessControlException;
import java.util.Objects;
import sun.security.krb5.EncryptionKey;
import sun.security.krb5.KerberosSecrets;
@ -214,9 +215,22 @@ public final class KeyTab {
return new KeyTab(princ, null, true);
}
//Takes a snapshot of the keytab content
// Takes a snapshot of the keytab content. This method is called by
// JavaxSecurityAuthKerberosAccessImpl so no more private
sun.security.krb5.internal.ktab.KeyTab takeSnapshot() {
return sun.security.krb5.internal.ktab.KeyTab.getInstance(file);
try {
return sun.security.krb5.internal.ktab.KeyTab.getInstance(file);
} catch (AccessControlException ace) {
if (file != null) {
// It's OK to show the name if caller specified it
throw ace;
} else {
AccessControlException ace2 = new AccessControlException(
"Access to default keytab denied (modified exception)");
ace2.setStackTrace(ace.getStackTrace());
throw ace2;
}
}
}
/**