Commit 9d4416ce authored by Dave Cridland's avatar Dave Cridland

Merge pull request #65 from sdebnath/setup-props

Bug: properties in openfire.xml not properly loaded in setup
parents 9a05f400 3d115213
...@@ -390,6 +390,14 @@ public class XMPPServer { ...@@ -390,6 +390,14 @@ public class XMPPServer {
name = JiveGlobals.getProperty("xmpp.domain").toLowerCase(); name = JiveGlobals.getProperty("xmpp.domain").toLowerCase();
xmppServerInfo.setXMPPDomain(name); xmppServerInfo.setXMPPDomain(name);
// Iterate through all the provided XML properties and set the ones that haven't
// already been touched by setup prior to this method being called.
for (String propName : (List<String>)JiveGlobals.getXMLPropertyNames()) {
if (JiveGlobals.getProperty(propName) == null) {
JiveGlobals.setProperty(propName, JiveGlobals.getXMLProperty(propName));
}
}
// Update certificates (if required) // Update certificates (if required)
try { try {
// Check if keystore already has certificates for current domain // Check if keystore already has certificates for current domain
......
...@@ -522,6 +522,24 @@ public class JiveGlobals { ...@@ -522,6 +522,24 @@ public class JiveGlobals {
return values; return values;
} }
/**
* Return all property names as a list of strings, or an empty list if jiveHome has not been loaded.
*
* @return all child property for the given parent.
*/
public static List<String> getXMLPropertyNames() {
if (openfireProperties == null) {
loadOpenfireProperties();
}
// jiveHome not loaded?
if (openfireProperties == null) {
return Collections.emptyList();
}
return openfireProperties.getAllPropertyNames();
}
/** /**
* Deletes a locale property. If the property doesn't exist, the method * Deletes a locale property. If the property doesn't exist, the method
* does nothing. * does nothing.
...@@ -1085,4 +1103,4 @@ public class JiveGlobals { ...@@ -1085,4 +1103,4 @@ public class JiveGlobals {
} }
return false; return false;
} }
} }
\ No newline at end of file
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
int embeddedPort = ParamUtils.getIntParameter(request, "embeddedPort", Integer.MIN_VALUE); int embeddedPort = ParamUtils.getIntParameter(request, "embeddedPort", Integer.MIN_VALUE);
int securePort = ParamUtils.getIntParameter(request, "securePort", Integer.MIN_VALUE); int securePort = ParamUtils.getIntParameter(request, "securePort", Integer.MIN_VALUE);
boolean sslEnabled = ParamUtils.getBooleanParameter(request, "sslEnabled", true); boolean sslEnabled = ParamUtils.getBooleanParameter(request, "sslEnabled", true);
boolean anonymousAuthentication = JiveGlobals.getXMLProperty("xmpp.auth.anonymous", true);
String encryptionAlgorithm = ParamUtils.getParameter(request, "encryptionAlgorithm"); String encryptionAlgorithm = ParamUtils.getParameter(request, "encryptionAlgorithm");
String encryptionKey = ParamUtils.getParameter(request, "encryptionKey"); String encryptionKey = ParamUtils.getParameter(request, "encryptionKey");
...@@ -75,7 +76,7 @@ ...@@ -75,7 +76,7 @@
xmppSettings.put("xmpp.domain", domain); xmppSettings.put("xmpp.domain", domain);
xmppSettings.put("xmpp.socket.ssl.active", "" + sslEnabled); xmppSettings.put("xmpp.socket.ssl.active", "" + sslEnabled);
xmppSettings.put("xmpp.auth.anonymous", "true"); xmppSettings.put("xmpp.auth.anonymous", "" + anonymousAuthentication);
session.setAttribute("xmppSettings", xmppSettings); session.setAttribute("xmppSettings", xmppSettings);
Map<String, String> xmlSettings = new HashMap<String, String>(); Map<String, String> xmlSettings = new HashMap<String, String>();
...@@ -94,10 +95,10 @@ ...@@ -94,10 +95,10 @@
// Load the current values: // Load the current values:
if (!doContinue) { if (!doContinue) {
domain = JiveGlobals.getProperty("xmpp.domain"); domain = JiveGlobals.getXMLProperty("xmpp.domain");
embeddedPort = JiveGlobals.getXMLProperty("adminConsole.port", 9090); embeddedPort = JiveGlobals.getXMLProperty("adminConsole.port", 9090);
securePort = JiveGlobals.getXMLProperty("adminConsole.securePort", 9091); securePort = JiveGlobals.getXMLProperty("adminConsole.securePort", 9091);
sslEnabled = JiveGlobals.getBooleanProperty("xmpp.socket.ssl.active", true); sslEnabled = JiveGlobals.getXMLProperty("xmpp.socket.ssl.active", true);
// If the domain is still blank, guess at the value: // If the domain is still blank, guess at the value:
if (domain == null) { if (domain == null) {
......
...@@ -34,20 +34,22 @@ ...@@ -34,20 +34,22 @@
// Set to default providers by deleting any existing values. // Set to default providers by deleting any existing values.
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
Map<String,String> xmppSettings = (Map<String,String>)session.getAttribute("xmppSettings"); Map<String,String> xmppSettings = (Map<String,String>)session.getAttribute("xmppSettings");
xmppSettings.put("provider.auth.className",
org.jivesoftware.openfire.auth.DefaultAuthProvider.class.getName()); xmppSettings.put("provider.auth.className", JiveGlobals.getXMLProperty("provider.auth.className",
xmppSettings.put("provider.user.className", org.jivesoftware.openfire.auth.DefaultAuthProvider.class.getName()));
org.jivesoftware.openfire.user.DefaultUserProvider.class.getName()); xmppSettings.put("provider.user.className", JiveGlobals.getXMLProperty("provider.user.className",
xmppSettings.put("provider.group.className", org.jivesoftware.openfire.user.DefaultUserProvider.class.getName()));
org.jivesoftware.openfire.group.DefaultGroupProvider.class.getName()); xmppSettings.put("provider.group.className", JiveGlobals.getXMLProperty("provider.group.className",
xmppSettings.put("provider.vcard.className", org.jivesoftware.openfire.group.DefaultGroupProvider.class.getName()));
org.jivesoftware.openfire.vcard.DefaultVCardProvider.class.getName()); xmppSettings.put("provider.vcard.className", JiveGlobals.getXMLProperty("provider.vcard.className",
xmppSettings.put("provider.lockout.className", org.jivesoftware.openfire.vcard.DefaultVCardProvider.class.getName()));
org.jivesoftware.openfire.lockout.DefaultLockOutProvider.class.getName()); xmppSettings.put("provider.lockout.className", JiveGlobals.getXMLProperty("provider.lockout.className",
xmppSettings.put("provider.securityAudit.className", org.jivesoftware.openfire.lockout.DefaultLockOutProvider.class.getName()));
org.jivesoftware.openfire.security.DefaultSecurityAuditProvider.class.getName()); xmppSettings.put("provider.securityAudit.className", JiveGlobals.getXMLProperty("provider.securityAudit.className",
xmppSettings.put("provider.admin.className", org.jivesoftware.openfire.security.DefaultSecurityAuditProvider.class.getName()));
org.jivesoftware.openfire.admin.DefaultAdminProvider.class.getName()); xmppSettings.put("provider.admin.className", JiveGlobals.getXMLProperty("provider.admin.className",
org.jivesoftware.openfire.admin.DefaultAdminProvider.class.getName()));
// Redirect // Redirect
response.sendRedirect("setup-admin-settings.jsp"); response.sendRedirect("setup-admin-settings.jsp");
return; return;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment