From 7d245e6153d15095240d414f2e487a50d62a9580 Mon Sep 17 00:00:00 2001
From: Gaetan Boismal <gaetan.boismal@forgerock.com>
Date: Tue, 01 Mar 2016 09:44:57 +0000
Subject: [PATCH] OPENDJ-2701 Fix status tool
---
opendj-server-legacy/src/main/java/org/opends/server/util/cli/LDAPConnectionConsoleInteraction.java | 26 +++++++++++++++++++++++++-
1 files changed, 25 insertions(+), 1 deletions(-)
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/util/cli/LDAPConnectionConsoleInteraction.java b/opendj-server-legacy/src/main/java/org/opends/server/util/cli/LDAPConnectionConsoleInteraction.java
index c4569cb..5beb0be 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/util/cli/LDAPConnectionConsoleInteraction.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/util/cli/LDAPConnectionConsoleInteraction.java
@@ -77,6 +77,7 @@
private static final boolean ALLOW_EMPTY_PATH = true;
private static final boolean FILE_MUST_EXISTS = true;
+ private boolean allowAnonymousIfNonInteractive;
/**
* Information from the latest console interaction.
@@ -280,7 +281,7 @@
}
/**
- * Constructs a parameterized instance.
+ * Constructs a new console interaction.
*
* @param app
* console application
@@ -290,9 +291,28 @@
*/
public LDAPConnectionConsoleInteraction(ConsoleApplication app, SecureConnectionCliArgs secureArgs)
{
+ this(app, secureArgs, false);
+ }
+
+ /**
+ * Constructs a new console interaction.
+ *
+ * @param app
+ * console application
+ * @param secureArgs
+ * existing set of arguments that have already been parsed and
+ * contain some potential command line specified LDAP arguments
+ * @param allowAnonymousIfNonInteractive
+ * If this console interaction should allow anonymous user in non interactive mode.
+ * If console application is interactive, the user will always be prompted for credentials.
+ */
+ public LDAPConnectionConsoleInteraction(
+ ConsoleApplication app, SecureConnectionCliArgs secureArgs, final boolean allowAnonymousIfNonInteractive)
+ {
this.app = app;
this.secureArgsList = secureArgs;
this.commandBuilder = new CommandBuilder();
+ this.allowAnonymousIfNonInteractive = allowAnonymousIfNonInteractive;
state = new State(secureArgs);
copySecureArgsList = new SecureConnectionCliArgs(secureArgs.alwaysSSL());
try
@@ -641,6 +661,10 @@
{
if (!app.isInteractive())
{
+ if (allowAnonymousIfNonInteractive)
+ {
+ return;
+ }
throw new ArgumentException(ERR_ERROR_BIND_PASSWORD_NONINTERACTIVE.get());
}
checkHeadingDisplayed();
--
Gitblit v1.10.0