src/com/netscape/admin/dirserv/panel/EncryptionPanel.java | 51 ++++++++++++++
1 file changed, 51 insertions(+)
New commits:
commit 7c3d88a741835757d21824b4d514fba04ff56a4e
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Thu Dec 1 14:35:52 2011 -0800
Bug 757773 - SSL Port issue in Console
https://bugzilla.redhat.com/show_bug.cgi?id=757773
Description: If non-standard SSL ports are set from outside of
Console, there is no chance for Console to update nsSecureServerPort
in o=netscaperoot.
When enabling "Use SSL in Console", if the secure port in cn=config
is not the standard SSL port 636, replace nsSecureServerPort in
o=netscaperoot with the one read from cn=config.
Reviewed by nkinder(a)redhat.com (Thanks!!)
diff --git a/src/com/netscape/admin/dirserv/panel/EncryptionPanel.java
b/src/com/netscape/admin/dirserv/panel/EncryptionPanel.java
index e131bf4..1a6023b 100644
--- a/src/com/netscape/admin/dirserv/panel/EncryptionPanel.java
+++ b/src/com/netscape/admin/dirserv/panel/EncryptionPanel.java
@@ -619,6 +619,57 @@ public class EncryptionPanel extends BlankPanel
_cbConsoleSSL.setEnabled(_configData.sslServerOn &&
!_rbRequired.isSelected());
_cbSSLCheckHostName.setEnabled(_configData.sslServerOn);
+ // Get secure port
+ DSResourceModel model = (DSResourceModel)getModel();
+ ConsoleInfo serverInfo = model.getServerInfo();
+ LDAPConnection ldc = serverInfo.getLDAPConnection();
+ int securePort = -1;
+ // Read cn=config
+ String configDn = "cn=config";
+ String[] configAttrs = { "nsslapd-secureport" };
+ LDAPEntry configEntry = null;
+ try {
+ configEntry = ldc.read(configDn, configAttrs);
+ }
+ catch(LDAPException x) {
+ Debug.println(0,
+ "EncryptionPanel.updateComponentState: failure while reading config
data");
+ if (Debug.getTrace()) {
+ x.printStackTrace();
+ }
+ }
+
+ // Parse configEntry
+ if (configEntry != null) {
+ String securePortStr = DSUtil.getAttrValue(configEntry, configAttrs[0]);
+ try {
+ securePort = Integer.parseInt(securePortStr);
+ }
+ catch(NumberFormatException x) {
+ Debug.println(0,
+ "EncryptionPanel.updateComponentState: cannot convert
nsslapd-secureport to an int !");
+ }
+
+ // If securePort is not a default value, set it to NetscapeRoot
+ if (636 != securePort) {
+ ConsoleInfo consoleInfo = model.getConsoleInfo();
+ LDAPConnection sieldc = consoleInfo.getLDAPConnection();
+ String sieDn = consoleInfo.getCurrentDN();
+ LDAPAttribute attr =
+ new LDAPAttribute("nssecureserverport", securePortStr);
+ try {
+ sieldc.modify(sieDn,
+ new LDAPModification(LDAPModification.REPLACE, attr));
+ }
+ catch(LDAPException xx) {
+ Debug.println(0,
+ "EncryptionPanel.updateComponentState: failure while modifying
console config data");
+ if (Debug.getTrace()) {
+ xx.printStackTrace();
+ }
+ }
+ }
+ }
}