diff -r 365eb4449319 -r 4c792c19266e jdk/src/share/classes/sun/security/krb5/internal/CredentialsUtil.java --- a/jdk/src/share/classes/sun/security/krb5/internal/CredentialsUtil.java Wed Nov 25 08:24:58 2009 -0800 +++ b/jdk/src/share/classes/sun/security/krb5/internal/CredentialsUtil.java Fri Nov 27 08:51:28 2009 +0800 @@ -1,5 +1,5 @@ /* - * Portions Copyright 2001-2004 Sun Microsystems, Inc. All Rights Reserved. + * Portions Copyright 2001-2009 Sun Microsystems, Inc. All Rights Reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -117,6 +117,7 @@ // Get a list of realms to traverse String[] realms = Realm.getRealmsList(localRealm, serviceRealm); + boolean okAsDelegate = true; if (realms == null || realms.length == 0) { @@ -194,6 +195,15 @@ */ newTgtRealm = newTgt.getServer().getInstanceComponent(); + if (okAsDelegate && !newTgt.checkDelegate()) { + if (DEBUG) + { + System.out.println(">>> Credentials acquireServiceCreds: " + + "global OK-AS-DELEGATE turned off at " + + newTgt.getServer()); + } + okAsDelegate = false; + } if (DEBUG) { @@ -283,6 +293,9 @@ System.out.println(">>> Credentials acquireServiceCreds: returning creds:"); Credentials.printDebug(theCreds); } + if (!okAsDelegate) { + theCreds.resetDelegate(); + } return theCreds; } throw new KrbApErrException(Krb5.KRB_AP_ERR_GEN_CRED,