summaryrefslogtreecommitdiffstats
path: root/base
diff options
context:
space:
mode:
authorEndi Sukma Dewata <edewata@redhat.com>2013-02-06 16:39:33 -0500
committerEndi Sukma Dewata <edewata@redhat.com>2013-02-07 10:42:04 -0500
commitc232ca016f042b46ecd60449207a8109b6c71a44 (patch)
tree2c42ae2a9d06cece45600e75d3499b2f0bd39fb0 /base
parent972e1896cad299faf49a791371089ccdf1536c70 (diff)
downloadpki-c232ca016f042b46ecd60449207a8109b6c71a44.tar.gz
pki-c232ca016f042b46ecd60449207a8109b6c71a44.tar.xz
pki-c232ca016f042b46ecd60449207a8109b6c71a44.zip
Fixed conflicting security domain hosts.
The SecurityDomainProcessor has been modified to generate the host ID from the subsystem type, hostname, and secure port instead of relying on the user-configurable SubsystemName attribute. Ticket #503
Diffstat (limited to 'base')
-rw-r--r--base/common/src/com/netscape/certsrv/system/DomainInfo.java2
-rw-r--r--base/common/src/com/netscape/certsrv/system/SecurityDomainHost.java32
-rw-r--r--base/common/src/com/netscape/certsrv/system/SecurityDomainSubsystem.java2
-rw-r--r--base/common/src/com/netscape/cms/servlet/csadmin/SecurityDomainProcessor.java78
4 files changed, 69 insertions, 45 deletions
diff --git a/base/common/src/com/netscape/certsrv/system/DomainInfo.java b/base/common/src/com/netscape/certsrv/system/DomainInfo.java
index 3f38c64ab..32e64bf6a 100644
--- a/base/common/src/com/netscape/certsrv/system/DomainInfo.java
+++ b/base/common/src/com/netscape/certsrv/system/DomainInfo.java
@@ -148,7 +148,7 @@ public class DomainInfo {
before.setName("EXAMPLE");
SecurityDomainHost host = new SecurityDomainHost();
- host.setId("CA localhost:8443");
+ host.setId("CA localhost 8443");
host.setHostname("localhost");
host.setPort("8080");
host.setSecurePort("8443");
diff --git a/base/common/src/com/netscape/certsrv/system/SecurityDomainHost.java b/base/common/src/com/netscape/certsrv/system/SecurityDomainHost.java
index e4357ffe8..730e36cae 100644
--- a/base/common/src/com/netscape/certsrv/system/SecurityDomainHost.java
+++ b/base/common/src/com/netscape/certsrv/system/SecurityDomainHost.java
@@ -41,10 +41,11 @@ public class SecurityDomainHost {
protected String hostname;
protected String port;
protected String securePort;
+ protected String secureEEClientAuthPort;
protected String secureAgentPort;
protected String secureAdminPort;
- protected String secureEEClientAuthPort;
protected String clone;
+ protected String subsystemName;
protected String domainManager;
@XmlAttribute(name="id")
@@ -119,6 +120,15 @@ public class SecurityDomainHost {
this.clone = clone;
}
+ @XmlElement(name="SubsystemName")
+ public String getSubsystemName() {
+ return subsystemName;
+ }
+
+ public void setSubsystemName(String subsystemName) {
+ this.subsystemName = subsystemName;
+ }
+
@XmlElement(name="DomainManager")
public String getDomainManager() {
return domainManager;
@@ -159,10 +169,11 @@ public class SecurityDomainHost {
result = prime * result + ((hostname == null) ? 0 : hostname.hashCode());
result = prime * result + ((id == null) ? 0 : id.hashCode());
result = prime * result + ((port == null) ? 0 : port.hashCode());
- result = prime * result + ((secureAgentPort == null) ? 0 : secureAgentPort.hashCode());
result = prime * result + ((secureAdminPort == null) ? 0 : secureAdminPort.hashCode());
+ result = prime * result + ((secureAgentPort == null) ? 0 : secureAgentPort.hashCode());
result = prime * result + ((secureEEClientAuthPort == null) ? 0 : secureEEClientAuthPort.hashCode());
result = prime * result + ((securePort == null) ? 0 : securePort.hashCode());
+ result = prime * result + ((subsystemName == null) ? 0 : subsystemName.hashCode());
return result;
}
@@ -200,16 +211,16 @@ public class SecurityDomainHost {
return false;
} else if (!port.equals(other.port))
return false;
- if (secureAgentPort == null) {
- if (other.secureAgentPort != null)
- return false;
- } else if (!secureAgentPort.equals(other.secureAgentPort))
- return false;
if (secureAdminPort == null) {
if (other.secureAdminPort != null)
return false;
} else if (!secureAdminPort.equals(other.secureAdminPort))
return false;
+ if (secureAgentPort == null) {
+ if (other.secureAgentPort != null)
+ return false;
+ } else if (!secureAgentPort.equals(other.secureAgentPort))
+ return false;
if (secureEEClientAuthPort == null) {
if (other.secureEEClientAuthPort != null)
return false;
@@ -220,13 +231,18 @@ public class SecurityDomainHost {
return false;
} else if (!securePort.equals(other.securePort))
return false;
+ if (subsystemName == null) {
+ if (other.subsystemName != null)
+ return false;
+ } else if (!subsystemName.equals(other.subsystemName))
+ return false;
return true;
}
public static void main(String args[]) throws Exception {
SecurityDomainHost before = new SecurityDomainHost();
- before.setId("CA localhost:8443");
+ before.setId("CA localhost 8443");
before.setHostname("localhost");
before.setPort("8080");
before.setSecurePort("8443");
diff --git a/base/common/src/com/netscape/certsrv/system/SecurityDomainSubsystem.java b/base/common/src/com/netscape/certsrv/system/SecurityDomainSubsystem.java
index 74273c244..eec37a055 100644
--- a/base/common/src/com/netscape/certsrv/system/SecurityDomainSubsystem.java
+++ b/base/common/src/com/netscape/certsrv/system/SecurityDomainSubsystem.java
@@ -120,7 +120,7 @@ import javax.xml.bind.annotation.XmlRootElement;
before.setName("CA");
SecurityDomainHost host = new SecurityDomainHost();
- host.setId("CA localhost:8443");
+ host.setId("CA localhost 8443");
host.setHostname("localhost");
host.setPort("8080");
host.setSecurePort("8443");
diff --git a/base/common/src/com/netscape/cms/servlet/csadmin/SecurityDomainProcessor.java b/base/common/src/com/netscape/cms/servlet/csadmin/SecurityDomainProcessor.java
index 97e9d41b7..ddfa8fae1 100644
--- a/base/common/src/com/netscape/cms/servlet/csadmin/SecurityDomainProcessor.java
+++ b/base/common/src/com/netscape/cms/servlet/csadmin/SecurityDomainProcessor.java
@@ -195,23 +195,17 @@ public class SecurityDomainProcessor extends Processor {
String attrValue = (String) nextAttr.getStringValues().nextElement();
CMS.debug("SecurityDomainProcessor: - "+attrName+": "+attrValue);
- if ("SubsystemName".equalsIgnoreCase(attrName)) {
- host.setId(attrValue);
-
- } else if ("Host".equalsIgnoreCase(attrName)) {
+ if ("Host".equalsIgnoreCase(attrName)) {
host.setHostname(attrValue);
+ } else if ("UnSecurePort".equalsIgnoreCase(attrName)) {
+ host.setPort(attrValue);
+
} else if ("SecurePort".equalsIgnoreCase(attrName)) {
host.setSecurePort(attrValue);
- } else if ("Clone".equalsIgnoreCase(attrName)) {
- host.setClone(attrValue);
-
- } else if ("DomainManager".equalsIgnoreCase(attrName)) {
- host.setDomainManager(attrValue);
-
- } else if ("UnSecurePort".equalsIgnoreCase(attrName)) {
- host.setPort(attrValue);
+ } else if ("SecureEEClientAuthPort".equalsIgnoreCase(attrName)) {
+ host.setSecureEEClientAuthPort(attrValue);
} else if ("SecureAgentPort".equalsIgnoreCase(attrName)) {
host.setSecureAgentPort(attrValue);
@@ -219,11 +213,21 @@ public class SecurityDomainProcessor extends Processor {
} else if ("SecureAdminPort".equalsIgnoreCase(attrName)) {
host.setSecureAdminPort(attrValue);
- } else if ("SecureEEClientAuthPort".equalsIgnoreCase(attrName)) {
- host.setSecureEEClientAuthPort(attrValue);
+ } else if ("Clone".equalsIgnoreCase(attrName)) {
+ host.setClone(attrValue);
+
+ } else if ("SubsystemName".equalsIgnoreCase(attrName)) {
+ host.setSubsystemName(attrValue);
+
+ } else if ("DomainManager".equalsIgnoreCase(attrName)) {
+ host.setDomainManager(attrValue);
}
}
+ String port = host.getSecurePort();
+ if (port == null) port = host.getSecureEEClientAuthPort();
+ host.setId(subType+" "+host.getHostname()+" "+port);
+
domain.addHost(subType, host);
}
}
@@ -270,25 +274,25 @@ public class SecurityDomainProcessor extends Processor {
String value = host.getHostname();
if (value != null) xmlObject.addItemToContainer(node, "Host", value);
+ value = host.getPort();
+ if (value != null) xmlObject.addItemToContainer(node, "UnSecurePort", value);
+
value = host.getSecurePort();
if (value != null) xmlObject.addItemToContainer(node, "SecurePort", value);
+ value = host.getSecureEEClientAuthPort();
+ if (value != null) xmlObject.addItemToContainer(node, "SecureEEClientAuthPort", value);
+
value = host.getSecureAgentPort();
if (value != null) xmlObject.addItemToContainer(node, "SecureAgentPort", value);
value = host.getSecureAdminPort();
if (value != null) xmlObject.addItemToContainer(node, "SecureAdminPort", value);
- value = host.getSecureEEClientAuthPort();
- if (value != null) xmlObject.addItemToContainer(node, "SecureEEClientAuthPort", value);
-
- value = host.getPort();
- if (value != null) xmlObject.addItemToContainer(node, "UnSecurePort", value);
-
value = host.getClone();
if (value != null) xmlObject.addItemToContainer(node, "Clone", value);
- value = host.getId();
+ value = host.getSubsystemName();
if (value != null) xmlObject.addItemToContainer(node, "SubsystemName", value);
value = host.getDomainManager();
@@ -318,23 +322,17 @@ public class SecurityDomainProcessor extends Processor {
Node hostNode = hosts.item(j);
SecurityDomainHost host = new SecurityDomainHost();
- values = xmlObject.getValuesFromContainer(hostNode, "SubsystemName");
- if (!values.isEmpty()) host.setId(values.firstElement());
-
values = xmlObject.getValuesFromContainer(hostNode, "Host");
if (!values.isEmpty()) host.setHostname(values.firstElement());
+ values = xmlObject.getValuesFromContainer(hostNode, "UnSecurePort");
+ if (!values.isEmpty()) host.setPort(values.firstElement());
+
values = xmlObject.getValuesFromContainer(hostNode, "SecurePort");
if (!values.isEmpty()) host.setSecurePort(values.firstElement());
- values = xmlObject.getValuesFromContainer(hostNode, "Clone");
- if (!values.isEmpty()) host.setClone(values.firstElement());
-
- values = xmlObject.getValuesFromContainer(hostNode, "DomainManager");
- if (!values.isEmpty()) host.setDomainManager(values.firstElement());
-
- values = xmlObject.getValuesFromContainer(hostNode, "UnSecurePort");
- if (!values.isEmpty()) host.setPort(values.firstElement());
+ values = xmlObject.getValuesFromContainer(hostNode, "SecureEEClientAuthPort");
+ if (!values.isEmpty()) host.setSecureEEClientAuthPort(values.firstElement());
values = xmlObject.getValuesFromContainer(hostNode, "SecureAgentPort");
if (!values.isEmpty()) host.setSecureAgentPort(values.firstElement());
@@ -342,8 +340,18 @@ public class SecurityDomainProcessor extends Processor {
values = xmlObject.getValuesFromContainer(hostNode, "SecureAdminPort");
if (!values.isEmpty()) host.setSecureAdminPort(values.firstElement());
- values = xmlObject.getValuesFromContainer(hostNode, "SecureEEClientAuthPort");
- if (!values.isEmpty()) host.setSecureEEClientAuthPort(values.firstElement());
+ values = xmlObject.getValuesFromContainer(hostNode, "Clone");
+ if (!values.isEmpty()) host.setClone(values.firstElement());
+
+ values = xmlObject.getValuesFromContainer(hostNode, "SubsystemName");
+ if (!values.isEmpty()) host.setSubsystemName(values.firstElement());
+
+ values = xmlObject.getValuesFromContainer(hostNode, "DomainManager");
+ if (!values.isEmpty()) host.setDomainManager(values.firstElement());
+
+ String port = host.getSecurePort();
+ if (port == null) port = host.getSecureEEClientAuthPort();
+ host.setId(type+" "+host.getHostname()+" "+port);
domain.addHost(type, host);
}
@@ -358,7 +366,7 @@ public class SecurityDomainProcessor extends Processor {
before.setName("EXAMPLE");
SecurityDomainHost host = new SecurityDomainHost();
- host.setId("CA localhost:8443");
+ host.setId("CA localhost 8443");
host.setHostname("localhost");
host.setPort("8080");
host.setSecurePort("8443");