From 766ba6b28669b54a6a90c539822661690cf5fa2d Mon Sep 17 00:00:00 2001
From: jvergara <jvergara@localhost>
Date: Wed, 25 Nov 2009 20:42:49 +0000
Subject: [PATCH] Fix for issue 4371 (setup throws NullPointerException when trying to use a PKCS12 certificate) Handle the case where the user provides a certificate without an alias.  The code in CertificateManager has been updated to detect this situation. The code in ConfigureDS has also been updated to handle the case where the user does not provide a certificate nickname.

---
 opends/src/server/org/opends/server/tools/ConfigureDS.java |   45 +++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 45 insertions(+), 0 deletions(-)

diff --git a/opends/src/server/org/opends/server/tools/ConfigureDS.java b/opends/src/server/org/opends/server/tools/ConfigureDS.java
index 2bb0960..7c92a5f 100644
--- a/opends/src/server/org/opends/server/tools/ConfigureDS.java
+++ b/opends/src/server/org/opends/server/tools/ConfigureDS.java
@@ -1123,6 +1123,51 @@
           return 1;
         }
       }
+      else
+      {
+        try
+        {
+          if (ldapPort.isPresent())
+          {
+            // Use the key manager specified for the LDAP connection handler.
+            DN ldapListenerDN = DN.decode(DN_LDAP_CONNECTION_HANDLER);
+            ConfigEntry configEntry =
+              configHandler.getConfigEntry(ldapListenerDN);
+
+            configEntry.removeConfigAttribute(
+                ATTR_SSL_CERT_NICKNAME.toLowerCase());
+          }
+
+          if (ldapsPort.isPresent())
+          {
+            // Use the key manager specified for the LDAPS connection handler.
+            DN ldapsListenerDN = DN.decode(DN_LDAPS_CONNECTION_HANDLER);
+            ConfigEntry configEntry =
+              configHandler.getConfigEntry(ldapsListenerDN);
+
+            configEntry.removeConfigAttribute(
+                ATTR_SSL_CERT_NICKNAME.toLowerCase());
+          }
+
+          if (jmxPort.isPresent())
+          {
+            // Use the key manager specified for the JMX connection handler.
+            DN jmxListenerDN = DN.decode(DN_JMX_CONNECTION_HANDLER);
+            ConfigEntry configEntry =
+              configHandler.getConfigEntry(jmxListenerDN);
+
+            configEntry.removeConfigAttribute(
+                ATTR_SSL_CERT_NICKNAME.toLowerCase());
+          }
+        }
+        catch (Exception e)
+        {
+          Message message = ERR_CONFIGDS_CANNOT_UPDATE_CERT_NICKNAME.get(
+                  String.valueOf(e));
+          err.println(wrapText(message, MAX_LINE_WIDTH));
+          return 1;
+        }
+      }
 
       // If a root user DN and password were specified, then update the config
       // accordingly.

--
Gitblit v1.10.0