mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

jvergara
18.36.2008 3baf38c823e31bddf3c2905e8781653404ab995c
Fix for issue 3616 (control panel :missing  --useSSL option)

Analyze whether the equivalent command-line accepts --useSSL and --startTLS. Also analyze which connection (admin connection or regular LDAP connection) is being used.
9 files modified
82 ■■■■ changed files
opends/src/guitools/org/opends/guitools/controlpanel/browser/BrowserController.java 2 ●●● patch | view | raw | blame | history
opends/src/guitools/org/opends/guitools/controlpanel/task/AddToGroupTask.java 2 ●●● patch | view | raw | blame | history
opends/src/guitools/org/opends/guitools/controlpanel/task/DeleteEntryTask.java 4 ●●● patch | view | raw | blame | history
opends/src/guitools/org/opends/guitools/controlpanel/task/DeleteSchemaElementsTask.java 2 ●●● patch | view | raw | blame | history
opends/src/guitools/org/opends/guitools/controlpanel/task/ModifyEntryTask.java 9 ●●●●● patch | view | raw | blame | history
opends/src/guitools/org/opends/guitools/controlpanel/task/NewEntryTask.java 5 ●●●● patch | view | raw | blame | history
opends/src/guitools/org/opends/guitools/controlpanel/task/ResetUserPasswordTask.java 6 ●●●●● patch | view | raw | blame | history
opends/src/guitools/org/opends/guitools/controlpanel/task/SchemaTask.java 2 ●●● patch | view | raw | blame | history
opends/src/guitools/org/opends/guitools/controlpanel/task/Task.java 50 ●●●● patch | view | raw | blame | history
opends/src/guitools/org/opends/guitools/controlpanel/browser/BrowserController.java
@@ -1055,7 +1055,7 @@
   * @return <CODE>true</CODE> if the node is a configuration node and
   * <CODE>false</CODE> otherwise.
   */
  private boolean isConfigurationNode(BasicNode node)
  public boolean isConfigurationNode(BasicNode node)
  {
    boolean isConfigurationNode = false;
    if (node instanceof SuffixNode)
opends/src/guitools/org/opends/guitools/controlpanel/task/AddToGroupTask.java
@@ -201,7 +201,7 @@
          {
            public void run()
            {
              printEquivalentCommandToModify(groupDn, modifications);
              printEquivalentCommandToModify(groupDn, modifications, false);
              getProgressDialog().appendProgressHtml(
                  Utilities.getProgressWithPoints(
                      INFO_CTRL_PANEL_ADDING_TO_GROUP.get(groupDn.toString()),
opends/src/guitools/org/opends/guitools/controlpanel/task/DeleteEntryTask.java
@@ -78,6 +78,7 @@
  private long lastProgressTime;
  private boolean equivalentCommandWithControlPrinted = false;
  private boolean equivalentCommandWithoutControlPrinted = false;
  private boolean useAdminCtx;
  /**
   * Constructor of the task.
@@ -237,6 +238,7 @@
          {
            InitialLdapContext ctx =
              controller.findConnectionForDisplayedEntry(node);
            useAdminCtx = controller.isConfigurationNode(node);
            if (node.getNumSubOrdinates() > 0)
            {
              deleteSubtreeWithControl(ctx, dn, path, toNotify);
@@ -511,7 +513,7 @@
    ArrayList<String> args = new ArrayList<String>();
    args.add(getCommandLinePath("ldapdelete"));
    args.addAll(getObfuscatedCommandLineArguments(
        getConnectionCommandLineArguments()));
        getConnectionCommandLineArguments(useAdminCtx, true)));
    if (usingControl)
    {
      args.add("-J");
opends/src/guitools/org/opends/guitools/controlpanel/task/DeleteSchemaElementsTask.java
@@ -444,7 +444,7 @@
      args.add(getCommandLinePath("ldapmodify"));
      args.add("-a");
      args.addAll(getObfuscatedCommandLineArguments(
          getConnectionCommandLineArguments()));
          getConnectionCommandLineArguments(true, true)));
      StringBuilder sb = new StringBuilder();
      for (String arg : args)
      {
opends/src/guitools/org/opends/guitools/controlpanel/task/ModifyEntryTask.java
@@ -87,6 +87,7 @@
  private Entry newEntry;
  private BrowserController controller;
  private TreePath treePath;
  private boolean useAdminCtx = false;
  /**
   * Constructor of the task.
@@ -234,6 +235,7 @@
    {
      BasicNode node = (BasicNode)treePath.getLastPathComponent();
      InitialLdapContext ctx = controller.findConnectionForDisplayedEntry(node);
      useAdminCtx = controller.isConfigurationNode(node);
      if (!mustRename)
      {
        if (modifications.size() > 0) {
@@ -245,7 +247,8 @@
          {
            public void run()
            {
              printEquivalentCommandToModify(newEntry.getDN(), modifications);
              printEquivalentCommandToModify(newEntry.getDN(), modifications,
                  useAdminCtx);
              getProgressDialog().appendProgressHtml(
                  Utilities.getProgressWithPoints(
                      INFO_CTRL_PANEL_MODIFYING_ENTRY.get(oldEntry.getDN()),
@@ -354,7 +357,7 @@
    {
      public void run()
      {
        printEquivalentRenameCommand(oldDN, newEntry.getDN());
        printEquivalentRenameCommand(oldDN, newEntry.getDN(), useAdminCtx);
        getProgressDialog().appendProgressHtml(
            Utilities.getProgressWithPoints(
                INFO_CTRL_PANEL_RENAMING_ENTRY.get(oldDN.toString(),
@@ -393,7 +396,7 @@
        public void run()
        {
          DN dn = newEntry.getDN();
          printEquivalentCommandToModify(dn, originalMods);
          printEquivalentCommandToModify(dn, originalMods, useAdminCtx);
          getProgressDialog().appendProgressHtml(
              Utilities.getProgressWithPoints(
                  INFO_CTRL_PANEL_MODIFYING_ENTRY.get(dn.toString()),
opends/src/guitools/org/opends/guitools/controlpanel/task/NewEntryTask.java
@@ -71,6 +71,7 @@
  private BasicNode parentNode;
  private BrowserController controller;
  private DN dn;
  private boolean useAdminCtx = false;
  /**
   * Constructor of the task.
@@ -196,10 +197,12 @@
      if (parentNode != null)
      {
        ctx = controller.findConnectionForDisplayedEntry(parentNode);
        useAdminCtx = controller.isConfigurationNode(parentNode);
      }
      else
      {
        ctx = getInfo().getDirContext();
        useAdminCtx = true;
      }
      BasicAttributes attrs = new BasicAttributes();
      BasicAttribute objectclass =
@@ -288,7 +291,7 @@
    ArrayList<String> args = new ArrayList<String>();
    args.add(getCommandLinePath("ldapmodify"));
    args.addAll(getObfuscatedCommandLineArguments(
        getConnectionCommandLineArguments()));
        getConnectionCommandLineArguments(useAdminCtx, true)));
    args.add("--defaultAdd");
    StringBuilder sb = new StringBuilder();
    for (String arg : args)
opends/src/guitools/org/opends/guitools/controlpanel/task/ResetUserPasswordTask.java
@@ -66,7 +66,8 @@
  private BasicNode node;
  private char[] newPassword;
  private BrowserController controller;
  DN dn;
  private DN dn;
  private boolean useAdminCtx;
  /**
   * Constructor of the task.
@@ -192,6 +193,7 @@
    try
    {
      useAdminCtx = controller.isConfigurationNode(node);
      InitialLdapContext ctx =
        controller.findConnectionForDisplayedEntry(node);
      BasicAttribute attr =
@@ -208,7 +210,7 @@
      {
        public void run()
        {
          printEquivalentCommandToModify(dn, modifications);
          printEquivalentCommandToModify(dn, modifications, useAdminCtx);
          getProgressDialog().appendProgressHtml(
              Utilities.getProgressWithPoints(
                  INFO_CTRL_PANEL_RESETTING_USER_PASSWORD.get(node.getDN()),
opends/src/guitools/org/opends/guitools/controlpanel/task/SchemaTask.java
@@ -272,7 +272,7 @@
      args.add(getCommandLinePath("ldapmodify"));
      args.add("-a");
      args.addAll(getObfuscatedCommandLineArguments(
          getConnectionCommandLineArguments()));
          getConnectionCommandLineArguments(true, true)));
      StringBuilder sb = new StringBuilder();
      for (String arg : args)
      {
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)
    {