Repository: incubator-ranger Updated Branches: refs/heads/ranger-0.5 cb8f30c4a -> 3c42cf249
RANGER-755,756,757: ldaptool fixes (Sailaja Polavarapu via Velmurugan Periasamy) Signed-off-by: Velmurugan Periasamy <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/incubator-ranger/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ranger/commit/3c42cf24 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ranger/tree/3c42cf24 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ranger/diff/3c42cf24 Branch: refs/heads/ranger-0.5 Commit: 3c42cf249d99e8e42067abd00a09a03085f030a4 Parents: cb8f30c Author: Velmurugan Periasamy <[email protected]> Authored: Tue Dec 1 14:19:41 2015 -0800 Committer: Velmurugan Periasamy <[email protected]> Committed: Tue Dec 1 14:23:54 2015 -0800 ---------------------------------------------------------------------- .../ldapconfigcheck/scripts/run.sh | 8 ++++---- .../ranger/ldapconfigcheck/CommandLineOptions.java | 14 ++++++-------- 2 files changed, 10 insertions(+), 12 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/3c42cf24/ugsync/ldapconfigchecktool/ldapconfigcheck/scripts/run.sh ---------------------------------------------------------------------- diff --git a/ugsync/ldapconfigchecktool/ldapconfigcheck/scripts/run.sh b/ugsync/ldapconfigchecktool/ldapconfigcheck/scripts/run.sh index 787e216..e5c313a 100755 --- a/ugsync/ldapconfigchecktool/ldapconfigcheck/scripts/run.sh +++ b/ugsync/ldapconfigchecktool/ldapconfigcheck/scripts/run.sh @@ -19,7 +19,7 @@ AUTH=1 usage() { echo "usage: run.sh - -noauth ignore authentication properties + -a ignore authentication properties -d <arg> {all|users|groups} -h show help. -i <arg> Input file name @@ -33,7 +33,7 @@ cp="${cdir}/lib/*:${cdir}/conf" OUTDIR="${cdir}/output/" JAVA_CMD="java -cp ${cdir}/lib/ldapconfigcheck.jar:${cp} org.apache.ranger.ldapconfigcheck.LdapConfigCheckMain" -while getopts "i:o:d:r:noauthh" opt; do +while getopts "i:o:d:r:ah" opt; do case $opt in i) INFILE=$OPTARG JAVA_CMD="$JAVA_CMD -i $OPTARG" @@ -46,8 +46,8 @@ while getopts "i:o:d:r:noauthh" opt; do r) RETRIEVE=$OPTARG JAVA_CMD="$JAVA_CMD -r $OPTARG" ;; - noauth) AUTH=0 - JAVA_CMD="$JAVA_CMD -noauth" + a) AUTH=0 + JAVA_CMD="$JAVA_CMD -a" ;; h) usage ;; http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/3c42cf24/ugsync/ldapconfigchecktool/ldapconfigcheck/src/main/java/org/apache/ranger/ldapconfigcheck/CommandLineOptions.java ---------------------------------------------------------------------- diff --git a/ugsync/ldapconfigchecktool/ldapconfigcheck/src/main/java/org/apache/ranger/ldapconfigcheck/CommandLineOptions.java b/ugsync/ldapconfigchecktool/ldapconfigcheck/src/main/java/org/apache/ranger/ldapconfigcheck/CommandLineOptions.java index 790330f..c71e5cc 100644 --- a/ugsync/ldapconfigchecktool/ldapconfigcheck/src/main/java/org/apache/ranger/ldapconfigcheck/CommandLineOptions.java +++ b/ugsync/ldapconfigchecktool/ldapconfigcheck/src/main/java/org/apache/ranger/ldapconfigcheck/CommandLineOptions.java @@ -28,7 +28,7 @@ public class CommandLineOptions { private Options options = new Options(); private String input = null; private String output = null; - private String discoverProperties; + private String discoverProperties = null; private String retrieveValues = null; private boolean isAuthEnabled = true; private String ldapUrl = ""; @@ -46,7 +46,7 @@ public class CommandLineOptions { options.addOption("o", "outputdir", true, "Output directory"); options.addOption("d", "discoverProperties", true, "{all|users|groups}"); options.addOption("r", "retrieve", true, "{all|users|groups}"); - options.addOption("noauth", "noAuthentication", false, "Ignore authentication properties"); + options.addOption("a", "noAuthentication", false, "Ignore authentication properties"); } public void parse() { @@ -72,9 +72,7 @@ public class CommandLineOptions { System.out.println("Unsupported value for option d"); help(); } - } - - if (cmd.hasOption("r")) { + } else if (cmd.hasOption("r")) { retrieveValues = cmd.getOptionValue("r"); if (retrieveValues == null || (!retrieveValues.equalsIgnoreCase("all") && !retrieveValues.equalsIgnoreCase("users") && !retrieveValues.equalsIgnoreCase("groups"))) { @@ -82,15 +80,15 @@ public class CommandLineOptions { help(); } } else { - if (discoverProperties == null || discoverProperties.isEmpty()) { + //if (discoverProperties == null || discoverProperties.isEmpty()) { System.out.println("Default to discover all usersync properties"); //help(); // If "d" or "r" option is not specified, then default to discover all usersync properties discoverProperties = "all"; - } + //} } - if (cmd.hasOption("noauth")) { + if (cmd.hasOption("a") || discoverProperties == null || (discoverProperties != null && !discoverProperties.equalsIgnoreCase("all"))) { isAuthEnabled = false; }
