HADOOP-7091. reloginFromKeytab() should happen even if TGT can't be found. Contribued by Kan Zhang.
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1057455 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
c04751b1b4
commit
a42c891055
@ -56,6 +56,9 @@ Trunk (unreleased changes)
|
|||||||
HADOOP-6939. Inconsistent lock ordering in
|
HADOOP-6939. Inconsistent lock ordering in
|
||||||
AbstractDelegationTokenSecretManager. (Todd Lipcon via tomwhite)
|
AbstractDelegationTokenSecretManager. (Todd Lipcon via tomwhite)
|
||||||
|
|
||||||
|
HADOOP-7091. reloginFromKeytab() should happen even if TGT can't be found.
|
||||||
|
(Kan Zhang via jghoman)
|
||||||
|
|
||||||
Release 0.22.0 - Unreleased
|
Release 0.22.0 - Unreleased
|
||||||
|
|
||||||
INCOMPATIBLE CHANGES
|
INCOMPATIBLE CHANGES
|
||||||
|
@ -526,7 +526,7 @@ public boolean isFromKeytab() {
|
|||||||
* Get the Kerberos TGT
|
* Get the Kerberos TGT
|
||||||
* @return the user's TGT or null if none was found
|
* @return the user's TGT or null if none was found
|
||||||
*/
|
*/
|
||||||
private KerberosTicket getTGT() {
|
private synchronized KerberosTicket getTGT() {
|
||||||
Set<KerberosTicket> tickets = subject
|
Set<KerberosTicket> tickets = subject
|
||||||
.getPrivateCredentials(KerberosTicket.class);
|
.getPrivateCredentials(KerberosTicket.class);
|
||||||
for (KerberosTicket ticket : tickets) {
|
for (KerberosTicket ticket : tickets) {
|
||||||
@ -657,12 +657,14 @@ public synchronized void reloginFromKeytab()
|
|||||||
!isKeytab)
|
!isKeytab)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
KerberosTicket tgt = getTGT();
|
long now = System.currentTimeMillis();
|
||||||
if (tgt == null) {
|
if (!hasSufficientTimeElapsed(now)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
KerberosTicket tgt = getTGT();
|
||||||
//Return if TGT is valid and is not going to expire soon.
|
//Return if TGT is valid and is not going to expire soon.
|
||||||
if (System.currentTimeMillis() < getRefreshTime(tgt)) {
|
if (tgt != null && now < getRefreshTime(tgt)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -670,7 +672,6 @@ public synchronized void reloginFromKeytab()
|
|||||||
if (login == null || keytabFile == null) {
|
if (login == null || keytabFile == null) {
|
||||||
throw new IOException("loginUserFromKeyTab must be done first");
|
throw new IOException("loginUserFromKeyTab must be done first");
|
||||||
}
|
}
|
||||||
long now = System.currentTimeMillis();
|
|
||||||
|
|
||||||
long start = 0;
|
long start = 0;
|
||||||
// register most recent relogin attempt
|
// register most recent relogin attempt
|
||||||
|
Loading…
Reference in New Issue
Block a user