Explorar el Código

commit d9bfc06c66f415ba3e749caba52a2adf6040b2bb
Author: Lee Tucker <ltucker@yahoo-inc.com>
Date: Thu Jul 30 17:40:26 2009 -0700

Applying patch 2788241.5818.patch


git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-0.20-security-patches@1076941 13f79535-47bb-0310-9956-ffa450edef68

Owen O'Malley hace 14 años
padre
commit
d2f7565fa7
Se han modificado 1 ficheros con 10 adiciones y 10 borrados
  1. 10 10
      src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java

+ 10 - 10
src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java

@@ -501,7 +501,7 @@ public class FSNamesystem implements FSConstants, FSNamesystemMBean {
    * Dump all metadata into specified file
    */
   synchronized void metaSave(String filename) throws IOException {
-    checkAccess();
+    checkSuperuserPrivilege();
     File file = new File(System.getProperty("hadoop.log.dir"), 
                          filename);
     PrintWriter out = new PrintWriter(new BufferedWriter(
@@ -606,7 +606,7 @@ public class FSNamesystem implements FSConstants, FSNamesystemMBean {
    */
   synchronized BlocksWithLocations getBlocks(DatanodeID datanode, long size)
       throws IOException {
-    checkAccess();
+    checkSuperuserPrivilege();
 
     DatanodeDescriptor node = getDatanode(datanode);
     if (node == null) {
@@ -1788,7 +1788,7 @@ public class FSNamesystem implements FSConstants, FSNamesystemMBean {
    */
   void setQuota(String path, long nsQuota, long dsQuota) throws IOException {
     if (isPermissionEnabled) {
-      checkAccess();
+      checkSuperuserPrivilege();
     }
     
     dir.setQuota(path, nsQuota, dsQuota);
@@ -3410,7 +3410,7 @@ public class FSNamesystem implements FSConstants, FSNamesystemMBean {
   }
   
   long[] getStats() throws IOException {
-    checkAccess();
+    checkSuperuserPrivilege();
     synchronized(heartbeats) {
       return new long[] {this.capacityTotal, this.capacityUsed, 
                          this.capacityRemaining,
@@ -3550,7 +3550,7 @@ public class FSNamesystem implements FSConstants, FSNamesystemMBean {
 
   public synchronized DatanodeInfo[] datanodeReport( DatanodeReportType type
       ) throws AccessControlException {
-    checkAccess();
+    checkSuperuserPrivilege();
 
     ArrayList<DatanodeDescriptor> results = getDatanodeListForReport(type);
     DatanodeInfo[] arr = new DatanodeInfo[results.size()];
@@ -3569,7 +3569,7 @@ public class FSNamesystem implements FSConstants, FSNamesystemMBean {
    * @throws IOException if 
    */
   synchronized void saveNamespace() throws AccessControlException, IOException {
-    checkAccess();
+    checkSuperuserPrivilege();
     if(!isInSafeMode()) {
       throw new IOException("Safe mode should be turned ON " +
                             "in order to create namespace image.");
@@ -3825,7 +3825,7 @@ public class FSNamesystem implements FSConstants, FSNamesystemMBean {
    * 4. Removed from exclude --> stop decommission.
    */
   public void refreshNodes(Configuration conf) throws IOException {
-    checkAccess();
+    checkSuperuserPrivilege();
     // Reread the config to get dfs.hosts and dfs.hosts.exclude filenames.
     // Update the file names and refresh internal includes and excludes list
     if (conf == null)
@@ -3859,7 +3859,7 @@ public class FSNamesystem implements FSConstants, FSNamesystemMBean {
   }
     
   void finalizeUpgrade() throws IOException {
-    checkAccess();
+    checkSuperuserPrivilege();
     getFSImage().finalizeUpgrade();
   }
 
@@ -4302,7 +4302,7 @@ public class FSNamesystem implements FSConstants, FSNamesystemMBean {
     
   boolean setSafeMode(SafeModeAction action) throws IOException {
     if (action != SafeModeAction.SAFEMODE_GET) {
-      checkAccess();
+      checkSuperuserPrivilege();
       switch(action) {
       case SAFEMODE_LEAVE: // leave safe mode
         leaveSafeMode(false);
@@ -4484,7 +4484,7 @@ public class FSNamesystem implements FSConstants, FSNamesystemMBean {
     return checkPermission(path, false, null, null, null, null);
   }
 
-  private void checkAccess() throws AccessControlException {
+  private void checkSuperuserPrivilege() throws AccessControlException {
     if (isPermissionEnabled) {
       PermissionChecker.checkSuperuserPrivilege(fsOwner, supergroup);
     }