HDFS-3639. JspHelper#getUGI should always verify the token if security is enabled. Contributed by Eli Collins

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1360485 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Eli Collins 2012-07-12 00:12:15 +00:00
parent 4c13b6f34e
commit 8ced7381a4
2 changed files with 5 additions and 9 deletions

View File

@ -454,6 +454,9 @@ Branch-2 ( Unreleased changes )
HDFS-3615. Two BlockTokenSecretManager findbugs warnings. (atm)
HDFS-3639. JspHelper#getUGI should always verify the token if
security is enabled. (eli)
BREAKDOWN OF HDFS-3042 SUBTASKS
HDFS-2185. HDFS portion of ZK-based FailoverController (todd)

View File

@ -44,7 +44,6 @@
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.hdfs.BlockReader;
import org.apache.hadoop.hdfs.BlockReaderFactory;
import org.apache.hadoop.hdfs.DFSConfigKeys;
import org.apache.hadoop.hdfs.DFSUtil;
import org.apache.hadoop.hdfs.protocol.DatanodeInfo;
import org.apache.hadoop.hdfs.protocol.ExtendedBlock;
@ -59,7 +58,6 @@
import org.apache.hadoop.hdfs.web.resources.DoAsParam;
import org.apache.hadoop.hdfs.web.resources.UserParam;
import org.apache.hadoop.http.HtmlQuoting;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.net.NetUtils;
import org.apache.hadoop.security.AccessControlException;
import org.apache.hadoop.security.SecurityUtil;
@ -557,13 +555,8 @@ public static UserGroupInformation getUGI(ServletContext context,
DataInputStream in = new DataInputStream(buf);
DelegationTokenIdentifier id = new DelegationTokenIdentifier();
id.readFields(in);
if (context != null) {
final NameNode nn = NameNodeHttpServer.getNameNodeFromContext(context);
if (nn != null) {
// Verify the token.
nn.getNamesystem().verifyToken(id, token.getPassword());
}
}
final NameNode nn = NameNodeHttpServer.getNameNodeFromContext(context);
nn.getNamesystem().verifyToken(id, token.getPassword());
ugi = id.getUser();
if (ugi.getRealUser() == null) {
//non-proxy case