hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From omal...@apache.org
Subject svn commit: r1077439 - /hadoop/common/branches/branch-0.20-security-patches/src/test/system/aop/org/apache/hadoop/test/system/DaemonProtocolAspect.aj
Date Fri, 04 Mar 2011 04:15:05 GMT
Author: omalley
Date: Fri Mar  4 04:15:05 2011
New Revision: 1077439

URL: http://svn.apache.org/viewvc?rev=1077439&view=rev
Log:
commit cff4ddd772af65522337ba3380d2e75b7b5d61e0
Author: Konstantin Boudnik <cos@yahoo-inc.com>
Date:   Tue May 4 18:47:13 2010 -0700

    HADOOP-6332 from https://issues.apache.org/jira/secure/attachment/12443668/6332-phase2.fix1.patch
      on top of https://issues.apache.org/jira/secure/attachment/12443539/6332-phase2.patch
      fixing the issue with FileSystem access from Herriot via RPC

Modified:
    hadoop/common/branches/branch-0.20-security-patches/src/test/system/aop/org/apache/hadoop/test/system/DaemonProtocolAspect.aj

Modified: hadoop/common/branches/branch-0.20-security-patches/src/test/system/aop/org/apache/hadoop/test/system/DaemonProtocolAspect.aj
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.20-security-patches/src/test/system/aop/org/apache/hadoop/test/system/DaemonProtocolAspect.aj?rev=1077439&r1=1077438&r2=1077439&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.20-security-patches/src/test/system/aop/org/apache/hadoop/test/system/DaemonProtocolAspect.aj
(original)
+++ hadoop/common/branches/branch-0.20-security-patches/src/test/system/aop/org/apache/hadoop/test/system/DaemonProtocolAspect.aj
Fri Mar  4 04:15:05 2011
@@ -20,6 +20,7 @@ package org.apache.hadoop.test.system;
 
 import java.io.File;
 import java.io.IOException;
+import java.security.PrivilegedExceptionAction;
 import java.util.HashMap;
 import java.util.List;
 import java.util.ArrayList;
@@ -28,6 +29,7 @@ import java.util.Properties;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.io.Writable;
+import org.apache.hadoop.security.UserGroupInformation;
 import org.apache.hadoop.util.Shell.ShellCommandExecutor;
 import org.apache.hadoop.fs.FileStatus;
 import org.apache.hadoop.fs.FileSystem;
@@ -157,18 +159,27 @@ public aspect DaemonProtocolAspect {
         fileStatus.getPath());
   }
 
-  private FileSystem DaemonProtocol.getFS(Path path, boolean local) 
-    throws IOException {
-    FileSystem fs = null;
-    if (local) {
-      fs = FileSystem.getLocal(getDaemonConf());
-    } else {
-      fs = path.getFileSystem(getDaemonConf());
+  private FileSystem DaemonProtocol.getFS(final Path path, final boolean local)
+      throws IOException {
+    FileSystem ret = null;
+    try {
+      ret = UserGroupInformation.getLoginUser().doAs (
+          new PrivilegedExceptionAction<FileSystem>() {
+            public FileSystem run() throws IOException {
+              FileSystem fs = null;
+              if (local) {
+                fs = FileSystem.getLocal(getDaemonConf());
+              } else {
+                fs = path.getFileSystem(getDaemonConf());
+              }
+              return fs;
+            }
+          });
+    } catch (InterruptedException ie) {
     }
-    return fs;
+    return ret;
   }
   
-  
   @SuppressWarnings("unchecked")
   public ControlAction[] DaemonProtocol.getActions(Writable key) 
     throws IOException {



Mime
View raw message