HADOOP-9880. Merge change r1514913 from trunk.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1514915 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jing Zhao 2013-08-16 22:39:26 +00:00
parent f766cc09ac
commit 8c6234aa00
4 changed files with 34 additions and 2 deletions

View File

@ -126,6 +126,9 @@ Release 2.1.1-beta - UNRELEASED
HADOOP-9868. Server must not advertise kerberos realm. (daryn via kihwal) HADOOP-9868. Server must not advertise kerberos realm. (daryn via kihwal)
HADOOP-9880. SASL changes from HADOOP-9421 breaks Secure HA NN. (daryn via
jing9)
Release 2.1.0-beta - 2013-08-22 Release 2.1.0-beta - 2013-08-22
INCOMPATIBLE CHANGES INCOMPATIBLE CHANGES

View File

@ -1308,7 +1308,15 @@ private void saslProcess(RpcSaslProto saslMessage)
Throwable cause = e; Throwable cause = e;
while (cause != null) { while (cause != null) {
if (cause instanceof InvalidToken) { if (cause instanceof InvalidToken) {
sendToClient = (InvalidToken) cause; // FIXME: hadoop method signatures are restricting the SASL
// callbacks to only returning InvalidToken, but some services
// need to throw other exceptions (ex. NN + StandyException),
// so for now we'll tunnel the real exceptions via an
// InvalidToken's cause which normally is not set
if (cause.getCause() != null) {
cause = cause.getCause();
}
sendToClient = (IOException) cause;
break; break;
} }
cause = cause.getCause(); cause = cause.getCause();

View File

@ -127,7 +127,6 @@ public SaslServer create(Connection connection,
final CallbackHandler callback; final CallbackHandler callback;
switch (authMethod) { switch (authMethod) {
case TOKEN: { case TOKEN: {
secretManager.checkAvailableForRead();
callback = new SaslDigestCallbackHandler(secretManager, connection); callback = new SaslDigestCallbackHandler(secretManager, connection);
break; break;
} }

View File

@ -81,6 +81,28 @@ public DelegationTokenIdentifier createIdentifier() {
return new DelegationTokenIdentifier(); return new DelegationTokenIdentifier();
} }
@Override
public synchronized byte[] retrievePassword(
DelegationTokenIdentifier identifier) throws InvalidToken {
try {
// this check introduces inconsistency in the authentication to a
// HA standby NN. non-token auths are allowed into the namespace which
// decides whether to throw a StandbyException. tokens are a bit
// different in that a standby may be behind and thus not yet know
// of all tokens issued by the active NN. the following check does
// not allow ANY token auth, however it should allow known tokens in
checkAvailableForRead();
} catch (StandbyException se) {
// FIXME: this is a hack to get around changing method signatures by
// tunneling a non-InvalidToken exception as the cause which the
// RPC server will unwrap before returning to the client
InvalidToken wrappedStandby = new InvalidToken("StandbyException");
wrappedStandby.initCause(se);
throw wrappedStandby;
}
return super.retrievePassword(identifier);
}
@Override //SecretManager @Override //SecretManager
public void checkAvailableForRead() throws StandbyException { public void checkAvailableForRead() throws StandbyException {
namesystem.checkOperation(OperationCategory.READ); namesystem.checkOperation(OperationCategory.READ);