git-svn-id: https://svn.apache.org/repos/asf/incubator/ambari/trunk@1354780 13f79535-47bb-0310-9956-ffa450edef68
@@ -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)
@@ -75,6 +75,8 @@ if (move_uploaded_file($_FILES['clusterHostsFile']['tmp_name'], $hostsFileDestin
//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
@@ -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");
+ }
+}
?>