You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by hi...@apache.org on 2012/06/28 02:27:11 UTC

svn commit: r1354780 - in /incubator/ambari/trunk: CHANGES.txt hmc/php/frontend/addNodes.php hmc/php/util/util.php

Author: hitesh
Date: Thu Jun 28 00:27:10 2012
New Revision: 1354780

URL: http://svn.apache.org/viewvc?rev=1354780&view=rev
Log:
AMBARI-581. Strip carriage-return related control-chars from hosts files (Contributed by Jaimin Jetly)

Modified:
    incubator/ambari/trunk/CHANGES.txt
    incubator/ambari/trunk/hmc/php/frontend/addNodes.php
    incubator/ambari/trunk/hmc/php/util/util.php

Modified: incubator/ambari/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/CHANGES.txt?rev=1354780&r1=1354779&r2=1354780&view=diff
==============================================================================
--- incubator/ambari/trunk/CHANGES.txt (original)
+++ incubator/ambari/trunk/CHANGES.txt Thu Jun 28 00:27:10 2012
@@ -6,6 +6,9 @@ characters wide.
 
 Release 1.0.0 - unreleased
 
+  AMBARI-581. Strip carriage-return related control-chars from hosts files
+  (Jaimin Jetly via hitesh)
+
   AMBARI-582. Update the installation guide - monitoring dashboard install
   instructions (yusaku) 
 

Modified: incubator/ambari/trunk/hmc/php/frontend/addNodes.php
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/hmc/php/frontend/addNodes.php?rev=1354780&r1=1354779&r2=1354780&view=diff
==============================================================================
--- incubator/ambari/trunk/hmc/php/frontend/addNodes.php (original)
+++ incubator/ambari/trunk/hmc/php/frontend/addNodes.php Thu Jun 28 00:27:10 2012
@@ -75,6 +75,8 @@ if (move_uploaded_file($_FILES['clusterH
     //echo "Possible file upload attack!\n";
 }
 
+removeCarriageReturn($hostsFileDestination);
+
 header("Content-type: application/json");
 
 // Validate that there are no nodes that are already in use in case of addNodesWizard

Modified: incubator/ambari/trunk/hmc/php/util/util.php
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/hmc/php/util/util.php?rev=1354780&r1=1354779&r2=1354780&view=diff
==============================================================================
--- incubator/ambari/trunk/hmc/php/util/util.php (original)
+++ incubator/ambari/trunk/hmc/php/util/util.php Thu Jun 28 00:27:10 2012
@@ -51,4 +51,11 @@ function convertToLowerCase($hosts) {
   return $result;
 }
 
+function removeCarriageReturn($hostsFileDestination) {
+  exec("sed -i -e 's/\r//g' ". $hostsFileDestination, $output, $retVal);
+  if($retVal != 0) {
+    $logger->log_error("shell command exec() removing '\r' from ". $hostsFileDestination . " file failed");
+  }
+}
+
 ?>