You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by om...@apache.org on 2011/03/04 05:12:28 UTC

svn commit: r1077414 - in /hadoop/common/branches/branch-0.20-security-patches/src/contrib/hdfsproxy: build.xml src/java/org/apache/hadoop/hdfsproxy/ProxyFilter.java src/test/org/apache/hadoop/hdfsproxy/TestHdfsProxy.java

Author: omalley
Date: Fri Mar  4 04:12:28 2011
New Revision: 1077414

URL: http://svn.apache.org/viewvc?rev=1077414&view=rev
Log:
commit 695614feabd332f20c46f91542a71365e8b795f3
Author: Srikanth Sundarrajan <sr...@yahoo-inc.com>
Date:   Tue Apr 20 17:42:58 2010 +0530

    HDFS:481 from https://issues.apache.org/jira/secure/attachment/12442280/HDFS-481-bp-y20s.patch
    
    +++ b/YAHOO-CHANGES.txt
    +    HDFS-481. Incremental patch to fix broken unit test in contrib/hdfsproxy
    +

Modified:
    hadoop/common/branches/branch-0.20-security-patches/src/contrib/hdfsproxy/build.xml
    hadoop/common/branches/branch-0.20-security-patches/src/contrib/hdfsproxy/src/java/org/apache/hadoop/hdfsproxy/ProxyFilter.java
    hadoop/common/branches/branch-0.20-security-patches/src/contrib/hdfsproxy/src/test/org/apache/hadoop/hdfsproxy/TestHdfsProxy.java

Modified: hadoop/common/branches/branch-0.20-security-patches/src/contrib/hdfsproxy/build.xml
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.20-security-patches/src/contrib/hdfsproxy/build.xml?rev=1077414&r1=1077413&r2=1077414&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.20-security-patches/src/contrib/hdfsproxy/build.xml (original)
+++ hadoop/common/branches/branch-0.20-security-patches/src/contrib/hdfsproxy/build.xml Fri Mar  4 04:12:28 2011
@@ -45,6 +45,8 @@
   <property name="cargo.logging" value="high"/>
   <property name="cactus.formatter.type" value="xml"/>
   <property name="cactus.warfile.name" value="test"/>
+  <!-- Used for krb5.conf which is required to run unit tests with MiniDFS -->
+  <property name="test.krb5.conf.location" location="${hadoop.root}/src/test/krb5.conf"/>
 
   <available file="${hadoop.root}/build/classes" type="dir" property="test.available"/>
   <property environment="env"/>
@@ -223,10 +225,16 @@
     </cactifywar>
   </target>
 
-  <target name="test" depends="compile,compile-test,test-junit,test-cactus" description="Automated Test Framework"
+  <target name="test" depends="compile,compile-test,test-junit" description="Automated Test Framework"
           if="test.available"/>
 
   <target name="test-junit" depends="compile,compile-test" if="test.available">
+    <copy todir="${src.test.resources}/proxy-config">
+      <fileset dir="${proxy.conf.dir}" />
+    </copy>
+    <copy file="${proxy.conf.dir}/tomcat-web.xml" todir="${src.test.resources}"/>
+    <copy file="${proxy.conf.dir}/tomcat-forward-web.xml" todir="${src.test.resources}"/>
+
     <junit fork="yes" printsummary="yes" errorProperty="tests.failed" failureProperty="tests.failed">
       <classpath refid="test.classpath"/>
       <sysproperty key="test.build.data" value="${build.test}/data"/>
@@ -243,6 +251,7 @@
       <sysproperty key="javax.net.ssl.keyStorePassword" value="changeme"/>
       <sysproperty key="javax.net.ssl.keyPassword" value="changeme"/>
       <sysproperty key="javax.net.ssl.clientCert" value="${ssl.client.cert}"/>
+      <sysproperty key="java.security.krb5.conf" value="${test.krb5.conf.location}"/>
       <formatter type="xml"/>
       <batchtest todir="${test.build.dir}" unless="testcase">
         <fileset dir="${src.test}">

Modified: hadoop/common/branches/branch-0.20-security-patches/src/contrib/hdfsproxy/src/java/org/apache/hadoop/hdfsproxy/ProxyFilter.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.20-security-patches/src/contrib/hdfsproxy/src/java/org/apache/hadoop/hdfsproxy/ProxyFilter.java?rev=1077414&r1=1077413&r2=1077414&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.20-security-patches/src/contrib/hdfsproxy/src/java/org/apache/hadoop/hdfsproxy/ProxyFilter.java (original)
+++ hadoop/common/branches/branch-0.20-security-patches/src/contrib/hdfsproxy/src/java/org/apache/hadoop/hdfsproxy/ProxyFilter.java Fri Mar  4 04:12:28 2011
@@ -311,7 +311,7 @@ public class ProxyFilter implements Filt
       String ugi = rqst.getParameter("ugi");
       if (ugi != null) {
         rqst.setAttribute("authorized.ugi", UserGroupInformation.createRemoteUser(ugi));
-        rqst.setAttribute("org.apache.hadoop.hdfsproxy.authorized.userID", ugi);
+        rqst.setAttribute("org.apache.hadoop.hdfsproxy.authorized.userID", ugi.split(",")[0]);
       }
     }
     chain.doFilter(request, response);

Modified: hadoop/common/branches/branch-0.20-security-patches/src/contrib/hdfsproxy/src/test/org/apache/hadoop/hdfsproxy/TestHdfsProxy.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.20-security-patches/src/contrib/hdfsproxy/src/test/org/apache/hadoop/hdfsproxy/TestHdfsProxy.java?rev=1077414&r1=1077413&r2=1077414&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.20-security-patches/src/contrib/hdfsproxy/src/test/org/apache/hadoop/hdfsproxy/TestHdfsProxy.java (original)
+++ hadoop/common/branches/branch-0.20-security-patches/src/contrib/hdfsproxy/src/test/org/apache/hadoop/hdfsproxy/TestHdfsProxy.java Fri Mar  4 04:12:28 2011
@@ -204,6 +204,12 @@ public class TestHdfsProxy extends TestC
     try {
 
       final Configuration dfsConf = new Configuration();
+      dfsConf.set("hadoop.proxyuser." + System.getProperty("user.name") +
+          ".groups", "users");
+      dfsConf.set("hadoop.proxyuser.users.hosts", "127.0.0.1,localhost");
+      dfsConf.set("hadoop.proxyuser." + System.getProperty("user.name") +
+          ".hosts", "127.0.0.1,localhost");
+      dfsConf.set("hadoop.security.authentication", "simple");
       cluster = new MiniDFSCluster(dfsConf, 2, true, null);
       cluster.waitActive();