From 4525af355d0db0cf9edc1da642aacd14ed52f2ba Mon Sep 17 00:00:00 2001
From: jvergara <jvergara@localhost>
Date: Mon, 19 Nov 2007 17:14:24 +0000
Subject: [PATCH] Fix for issue 2214 (Provide a manner to accept permanently certificates).

---
 opends/src/quicksetup/org/opends/quicksetup/ui/GuiApplication.java |   20 +++++++++++++++++++-
 1 files changed, 19 insertions(+), 1 deletions(-)

diff --git a/opends/src/quicksetup/org/opends/quicksetup/ui/GuiApplication.java b/opends/src/quicksetup/org/opends/quicksetup/ui/GuiApplication.java
index 8fbc49a..a666690 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/ui/GuiApplication.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/ui/GuiApplication.java
@@ -30,6 +30,7 @@
 import org.opends.quicksetup.*;
 import org.opends.quicksetup.util.ServerController;
 import org.opends.quicksetup.util.InProcessServerController;
+import org.opends.quicksetup.util.UIKeyStore;
 import org.opends.quicksetup.util.Utils;
 import org.opends.quicksetup.UserInteraction;
 import org.opends.quicksetup.webstart.WebStartDownloader;
@@ -435,8 +436,11 @@
    * when trying to connect in secure mode.
    * @param ce the UserDataCertificateException that contains the information to
    * be used.
+   * @param acceptPermanently whether the certificate must be accepted
+   * permanently or not.
    */
-  protected void acceptCertificateForException(UserDataCertificateException ce)
+  protected void acceptCertificateForException(UserDataCertificateException ce,
+      boolean acceptPermanently)
   {
     X509Certificate[] chain = ce.getChain();
     String authType = ce.getAuthType();
@@ -465,6 +469,20 @@
             "The host is null for the UserDataCertificateException");
       }
     }
+    if (acceptPermanently)
+    {
+      if (chain != null)
+      {
+        try
+        {
+          UIKeyStore.acceptCertificate(chain);
+        }
+        catch (Throwable t)
+        {
+          LOG.log(Level.WARNING, "Error accepting certificate: "+t, t);
+        }
+      }
+    }
   }
 
   /**

--
Gitblit v1.10.0