From c8e79a8b6095980c08de380614d438695333c2eb Mon Sep 17 00:00:00 2001
From: jvergara <jvergara@localhost>
Date: Tue, 18 Nov 2008 15:36:22 +0000
Subject: [PATCH] Fix for issue 3616 (control panel :missing --useSSL option)
---
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/task/Task.java | 50 +++++++++++++++++++++++++++++++++++++++++++-------
1 files changed, 43 insertions(+), 7 deletions(-)
diff --git a/opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/task/Task.java b/opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/task/Task.java
index e21e096..ab8ccdf 100644
--- a/opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/task/Task.java
+++ b/opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/task/Task.java
@@ -681,8 +681,32 @@
*/
protected List<String> getConnectionCommandLineArguments()
{
+ return getConnectionCommandLineArguments(true, false);
+ }
+
+ /**
+ * Returns the list of arguments related to the connection (host, port, bind
+ * DN, etc.).
+ * @param useAdminConnector use the administration connector to generate
+ * the command line.
+ * @param addConnectionTypeParameters add the connection type parameters
+ * (--useSSL or --useStartTLS parameters: for ldapadd, ldapdelete, etc.).
+ * @return the list of arguments related to the connection.
+ */
+ protected List<String> getConnectionCommandLineArguments(
+ boolean useAdminConnector, boolean addConnectionTypeParameters)
+ {
ArrayList<String> args = new ArrayList<String>();
- InitialLdapContext ctx = getInfo().getDirContext();
+ InitialLdapContext ctx;
+
+ if (useAdminConnector)
+ {
+ ctx = getInfo().getDirContext();
+ }
+ else
+ {
+ ctx = getInfo().getUserDataDirContext();
+ }
if (isServerRunning() && (ctx != null))
{
String hostName = ConnectionUtils.getHostName(ctx);
@@ -703,6 +727,14 @@
{
args.add("--trustAll");
}
+ if (isSSL && addConnectionTypeParameters)
+ {
+ args.add("--useSSL");
+ }
+ else if (isStartTLS && addConnectionTypeParameters)
+ {
+ args.add("--useStartTLS");
+ }
}
return args;
}
@@ -769,25 +801,27 @@
* Prints the equivalent modify command line in the progress dialog.
* @param dn the dn of the modified entry.
* @param mods the modifications.
+ * @param useAdminCtx use the administration connector.
*/
protected void printEquivalentCommandToModify(DN dn,
- Collection<ModificationItem> mods)
+ Collection<ModificationItem> mods, boolean useAdminCtx)
{
- printEquivalentCommandToModify(dn.toString(), mods);
+ printEquivalentCommandToModify(dn.toString(), mods, useAdminCtx);
}
/**
* Prints the equivalent modify command line in the progress dialog.
* @param dn the dn of the modified entry.
* @param mods the modifications.
+ * @param useAdminCtx use the administration connector.
*/
protected void printEquivalentCommandToModify(String dn,
- Collection<ModificationItem> mods)
+ Collection<ModificationItem> mods, boolean useAdminCtx)
{
ArrayList<String> args = new ArrayList<String>();
args.add(getCommandLinePath("ldapmodify"));
args.addAll(getObfuscatedCommandLineArguments(
- getConnectionCommandLineArguments()));
+ getConnectionCommandLineArguments(useAdminCtx, true)));
StringBuilder sb = new StringBuilder();
for (String arg : args)
{
@@ -875,13 +909,15 @@
* Prints the equivalent rename command line in the progress dialog.
* @param oldDN the old DN of the entry.
* @param newDN the new DN of the entry.
+ * @param useAdminCtx use the administration connector.
*/
- protected void printEquivalentRenameCommand(DN oldDN, DN newDN)
+ protected void printEquivalentRenameCommand(DN oldDN, DN newDN,
+ boolean useAdminCtx)
{
ArrayList<String> args = new ArrayList<String>();
args.add(getCommandLinePath("ldapmodify"));
args.addAll(getObfuscatedCommandLineArguments(
- getConnectionCommandLineArguments()));
+ getConnectionCommandLineArguments(useAdminCtx, true)));
StringBuilder sb = new StringBuilder();
for (String arg : args)
{
--
Gitblit v1.10.0