HADOOP-11117 UGI HadoopLoginModule doesn't catch & wrap all kerberos-related exceptions (stevel)
This commit is contained in:
parent
489b4008df
commit
49be85005e
|
@ -580,6 +580,9 @@ Release 2.6.0 - UNRELEASED
|
||||||
|
|
||||||
HADOOP-11145. TestFairCallQueue fails. (Akira AJISAKA via cnauroth)
|
HADOOP-11145. TestFairCallQueue fails. (Akira AJISAKA via cnauroth)
|
||||||
|
|
||||||
|
HADOOP-11117 UGI HadoopLoginModule doesn't catch & wrap all
|
||||||
|
kerberos-related exceptions (stevel)
|
||||||
|
|
||||||
Release 2.5.1 - 2014-09-05
|
Release 2.5.1 - 2014-09-05
|
||||||
|
|
||||||
INCOMPATIBLE CHANGES
|
INCOMPATIBLE CHANGES
|
||||||
|
|
|
@ -47,7 +47,8 @@ class User implements Principal {
|
||||||
try {
|
try {
|
||||||
shortName = new HadoopKerberosName(name).getShortName();
|
shortName = new HadoopKerberosName(name).getShortName();
|
||||||
} catch (IOException ioe) {
|
} catch (IOException ioe) {
|
||||||
throw new IllegalArgumentException("Illegal principal name " + name, ioe);
|
throw new IllegalArgumentException("Illegal principal name " + name
|
||||||
|
+": " + ioe.toString(), ioe);
|
||||||
}
|
}
|
||||||
fullName = name;
|
fullName = name;
|
||||||
|
|
||||||
|
|
|
@ -176,7 +176,21 @@ public class UserGroupInformation {
|
||||||
}
|
}
|
||||||
// if we found the user, add our principal
|
// if we found the user, add our principal
|
||||||
if (user != null) {
|
if (user != null) {
|
||||||
subject.getPrincipals().add(new User(user.getName()));
|
if (LOG.isDebugEnabled()) {
|
||||||
|
LOG.debug("Using user: \"" + user + "\" with name " + user.getName());
|
||||||
|
}
|
||||||
|
|
||||||
|
User userEntry = null;
|
||||||
|
try {
|
||||||
|
userEntry = new User(user.getName());
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw (LoginException)(new LoginException(e.toString()).initCause(e));
|
||||||
|
}
|
||||||
|
if (LOG.isDebugEnabled()) {
|
||||||
|
LOG.debug("User entry: \"" + userEntry.toString() + "\"" );
|
||||||
|
}
|
||||||
|
|
||||||
|
subject.getPrincipals().add(userEntry);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
LOG.error("Can't find user in " + subject);
|
LOG.error("Can't find user in " + subject);
|
||||||
|
@ -919,7 +933,7 @@ public class UserGroupInformation {
|
||||||
metrics.loginFailure.add(Time.now() - start);
|
metrics.loginFailure.add(Time.now() - start);
|
||||||
}
|
}
|
||||||
throw new IOException("Login failure for " + user + " from keytab " +
|
throw new IOException("Login failure for " + user + " from keytab " +
|
||||||
path, le);
|
path+ ": " + le, le);
|
||||||
}
|
}
|
||||||
LOG.info("Login successful for user " + keytabPrincipal
|
LOG.info("Login successful for user " + keytabPrincipal
|
||||||
+ " using keytab file " + keytabFile);
|
+ " using keytab file " + keytabFile);
|
||||||
|
|
|
@ -339,7 +339,8 @@ public class TestUserGroupInformation {
|
||||||
} catch (IllegalArgumentException e) {
|
} catch (IllegalArgumentException e) {
|
||||||
String expect = (userName == null || userName.isEmpty())
|
String expect = (userName == null || userName.isEmpty())
|
||||||
? "Null user" : "Illegal principal name "+userName;
|
? "Null user" : "Illegal principal name "+userName;
|
||||||
assertEquals(expect, e.getMessage());
|
assertTrue("Did not find "+ expect + " in " + e,
|
||||||
|
e.toString().contains(expect));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue