knox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kmin...@apache.org
Subject [2/2] knox git commit: [KNOX-639] - Knoxcli.sh create-master should not allow empty strings
Date Thu, 10 Dec 2015 21:25:34 GMT
[KNOX-639] - Knoxcli.sh create-master should not allow empty strings

(cherry picked from commit a8abfdd11a50baf766227ad82cad814c371ff227)


Project: http://git-wip-us.apache.org/repos/asf/knox/repo
Commit: http://git-wip-us.apache.org/repos/asf/knox/commit/13a50a67
Tree: http://git-wip-us.apache.org/repos/asf/knox/tree/13a50a67
Diff: http://git-wip-us.apache.org/repos/asf/knox/diff/13a50a67

Branch: refs/heads/v0.7.0
Commit: 13a50a678393a1c6172a52bf07a7ad78a27483d0
Parents: 477be19
Author: Kevin Minder <kevin.minder@hortonworks.com>
Authored: Thu Dec 10 16:08:55 2015 -0500
Committer: Kevin Minder <kevin.minder@hortonworks.com>
Committed: Thu Dec 10 16:19:42 2015 -0500

----------------------------------------------------------------------
 CHANGES                                                 |  1 +
 .../services/security/impl/CMFMasterService.java        | 12 +++++++-----
 2 files changed, 8 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/knox/blob/13a50a67/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index ab1206d..79c8bc3 100644
--- a/CHANGES
+++ b/CHANGES
@@ -34,6 +34,7 @@ Release Notes - Apache Knox - Version 0.7.0
     * [KNOX-623] - Gateway provider rewriter doesn't support boolean attributes in HTML.
     * [KNOX-633] - Upgrade apache commons-collections
     * [KNOX-638] - Hive dispatch failing for secure clusters
+    * [KNOX-639] - Knoxcli.sh create-master should not allow empty strings
 
 ------------------------------------------------------------------------------
 Release Notes - Apache Knox - Version 0.6.0

http://git-wip-us.apache.org/repos/asf/knox/blob/13a50a67/gateway-spi/src/main/java/org/apache/hadoop/gateway/services/security/impl/CMFMasterService.java
----------------------------------------------------------------------
diff --git a/gateway-spi/src/main/java/org/apache/hadoop/gateway/services/security/impl/CMFMasterService.java
b/gateway-spi/src/main/java/org/apache/hadoop/gateway/services/security/impl/CMFMasterService.java
index 97abb3c..7960787 100644
--- a/gateway-spi/src/main/java/org/apache/hadoop/gateway/services/security/impl/CMFMasterService.java
+++ b/gateway-spi/src/main/java/org/apache/hadoop/gateway/services/security/impl/CMFMasterService.java
@@ -82,20 +82,22 @@ public class CMFMasterService {
       System.err.println("No console.");
       System.exit(1);
     }
-  
-    boolean noMatch;
+
+    boolean valid = false;
     do {
         char [] newPassword1 = c.readPassword("Enter master secret: ");
         char [] newPassword2 = c.readPassword("Enter master secret again: ");
-        noMatch = ! Arrays.equals(newPassword1, newPassword2);
-        if (noMatch) {
+        if ( newPassword1.length == 0 ) {
+            c.format("Password too short. Try again.%n");
+        } else if (!Arrays.equals(newPassword1, newPassword2) ) {
             c.format("Passwords don't match. Try again.%n");
         } else {
             this.master = Arrays.copyOf(newPassword1, newPassword1.length);
+            valid = true;
         }
         Arrays.fill(newPassword1, ' ');
         Arrays.fill(newPassword2, ' ');
-    } while (noMatch);
+    } while (!valid);
   }
 
   protected void displayWarning(boolean persisting) {


Mime
View raw message