Repository: knox
Updated Branches:
  refs/heads/master d9a4ce6ca -> f76eec991


KNOX-629 - Misleading output for system-user-auth-test when userSearchBase used

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

Branch: refs/heads/master
Commit: f76eec9914c02b97f870326b825d7604dfec02d1
Parents: d9a4ce6
Author: Larry McCay <lmc...@hortonworks.com>
Authored: Thu Oct 27 12:06:04 2016 -0400
Committer: Larry McCay <lmc...@hortonworks.com>
Committed: Thu Oct 27 12:06:04 2016 -0400

----------------------------------------------------------------------
 .../org/apache/hadoop/gateway/util/KnoxCLI.java    | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/knox/blob/f76eec99/gateway-server/src/main/java/org/apache/hadoop/gateway/util/KnoxCLI.java
----------------------------------------------------------------------
diff --git 
a/gateway-server/src/main/java/org/apache/hadoop/gateway/util/KnoxCLI.java 
b/gateway-server/src/main/java/org/apache/hadoop/gateway/util/KnoxCLI.java
index acb2034..ebffc48 100644
--- a/gateway-server/src/main/java/org/apache/hadoop/gateway/util/KnoxCLI.java
+++ b/gateway-server/src/main/java/org/apache/hadoop/gateway/util/KnoxCLI.java
@@ -1108,27 +1108,34 @@ public class KnoxCLI extends Configured implements Tool 
{
 
           if(hasParam(params, authorizationEnabled, false)) {
             int errors = 0;
+            int searchBaseErrors = 0;
             errors += hasParam(params, systemUsername, true) ? 0 : 1;
             errors += hasParam(params, systemPassword, true) ? 0 : 1;
-            errors += hasParam(params, searchBase, true) ? 0 : 1;
+            searchBaseErrors += hasParam(params, searchBase, false) ? 0 : 
hasParam(params, userSearchBase, false) ? 0 : 1;
+            if (searchBaseErrors > 0) {
+              out.println("Warn: Both " + searchBase + " and " + 
userSearchBase + " are missing from the topology");
+            }
+            errors += searchBaseErrors;
             errs += errors;
           }
 
 //        If any one of these is present they must all be present
           if( hasParam(params, userSearchAttributeName, false) ||
               hasParam(params, userObjectClass, false) ||
-              hasParam(params, searchBase, false)) {
+              hasParam(params, searchBase, false) ||
+              hasParam(params, userSearchBase, false)) {
 
             int errors = 0;
             errors += hasParam(params, userSearchAttributeName, true) ? 0 : 1;
             errors += hasParam(params, userObjectClass, true) ? 0 : 1;
-            errors += hasParam(params, searchBase, true) ? 0 : 1;
+            errors += hasParam(params, searchBase, false) ? 0 : 
hasParam(params, userSearchBase, false) ? 0 : 1;
             errors += hasParam(params, systemUsername, true) ? 0 : 1;
             errors += hasParam(params, systemPassword, true) ? 0 : 1;
 
             if(errors > 0) {
-              out.println(userSearchAttributeName + " or " + userObjectClass + 
" or " + searchBase + " was found in the topology");
-              out.println("If any one of the above params is present, all must 
be present.");
+              out.println(userSearchAttributeName + " or " + userObjectClass + 
" or " + searchBase + " or " + userSearchBase + " was found in the topology");
+              out.println("If any one of the above params is present then " + 
userSearchAttributeName + 
+                  " and " + userObjectClass + " must both be present and 
either " + searchBase + " or " + userSearchBase + " must also be present.");
             }
             errs += errors;
           } else {

Reply via email to