HADOOP-15307. NFS: flavor AUTH_SYS should use VerifierNone. Contributed by Gabor Bota.

This commit is contained in:
Xiao Chen 2018-06-12 11:14:33 -07:00
parent c35481594f
commit a16623df21
1 changed files with 9 additions and 3 deletions

View File

@ -41,12 +41,18 @@ public abstract class Verifier extends RpcAuthInfo {
public static Verifier readFlavorAndVerifier(XDR xdr) { public static Verifier readFlavorAndVerifier(XDR xdr) {
AuthFlavor flavor = AuthFlavor.fromValue(xdr.readInt()); AuthFlavor flavor = AuthFlavor.fromValue(xdr.readInt());
final Verifier verifer; final Verifier verifer;
if(flavor == AuthFlavor.AUTH_NONE) { if (flavor == AuthFlavor.AUTH_NONE) {
verifer = new VerifierNone(); verifer = new VerifierNone();
} else if(flavor == AuthFlavor.RPCSEC_GSS) { } else if (flavor == AuthFlavor.AUTH_SYS) {
// Added in HADOOP-15307 based on HDFS-5085:
// When the auth flavor is AUTH_SYS, the corresponding verifier is
// AUTH_NONE. I.e., it is impossible to have a verifier with auth
// flavor AUTH_SYS.
verifer = new VerifierNone();
} else if (flavor == AuthFlavor.RPCSEC_GSS) {
verifer = new VerifierGSS(); verifer = new VerifierGSS();
} else { } else {
throw new UnsupportedOperationException("Unsupported verifier flavor" throw new UnsupportedOperationException("Unsupported verifier flavor: "
+ flavor); + flavor);
} }
verifer.read(xdr); verifer.read(xdr);