Ver Fonte

AMBARI-388. Do not allow invalid chars for database name and user name for hive (Contributed by Hitesh)

git-svn-id: https://svn.apache.org/repos/asf/incubator/ambari/branches/ambari-186@1347163 13f79535-47bb-0310-9956-ffa450edef68
Vikram Dixit K há 13 anos atrás
pai
commit
dd24863350
2 ficheiros alterados com 6 adições e 0 exclusões
  1. 2 0
      CHANGES.txt
  2. 4 0
      hmc/php/frontend/configUtils.php

+ 2 - 0
CHANGES.txt

@@ -6,6 +6,8 @@ characters wide.
 
 Release 0.1.x - unreleased
 
+  AMBARI-389. Do not allow invalid chars for database name and user name for hive (Hitesh via Vikram)
+
   AMBARI-388. Prevent the user from assigning NameNode and Secondary NameNode services on the same host (Yusaku via Vikram)
 
   AMBARI-386. On Single Node install when install all the components the recommended num for Map/Reduce Tasks is too high (Hitesh via Vikram)

+ 4 - 0
hmc/php/frontend/configUtils.php

@@ -89,10 +89,14 @@ function validateConfigs($svcConfigs) {
       } else if ($key == "hive_database_name") {
         if ($val == "") {
           $errors[$key] = array ( "error" => "Database name cannot be empty");
+        } else if (preg_match("/^\w+$/", $val) == 0) {
+          $errors[$key] = array ( "error" => "Database name should only contain alphanumeric characters");
         }
       } else if ($key == "hive_metastore_user_name") {
         if ($val == "") {
           $errors[$key] = array ( "error" => "Database user name cannot be empty");
+        } else if (preg_match("/^\w+$/", $val) == 0) {
+          $errors[$key] = array ( "error" => "Database user name should only contain alphanumeric characters");
         }
       } else if ($key == "hive_metastore_user_passwd") {
         if ($val == "") {