Commit f51428cf authored by Tom Evans's avatar Tom Evans Committed by tevans

OF-692: Ensure a valid hostname (or "node") is available when writing to the security audit log

git-svn-id: http://svn.igniterealtime.org/svn/repos/openfire/trunk@14009 b35dd754-fafc-0310-a699-88a17e54d16e
parent c8afb035
......@@ -334,12 +334,16 @@ public class XMPPServer {
private void initialize() throws FileNotFoundException {
locateOpenfire();
startDate = new Date();
try {
host = InetAddress.getLocalHost().getHostName();
}
catch (UnknownHostException ex) {
Log.warn("Unable to determine local hostname.", ex);
host = "127.0.0.1";
}
if (host == null) {
host = "127.0.0.1";
}
version = new Version(3, 9, 2, Version.ReleaseStatus.Alpha, -1);
......@@ -367,6 +371,10 @@ public class XMPPServer {
org.jivesoftware.util.Log.setDebugEnabled(JiveGlobals.getXMLProperty("log.debug.enabled", false));
// Update server info
xmppServerInfo = new XMPPServerInfoImpl(name, host, version, startDate);
initialized = true;
}
......@@ -451,9 +459,6 @@ public class XMPPServer {
finishSetup.start();
// We can now safely indicate that setup has finished
setupMode = false;
// Update server info
xmppServerInfo = new XMPPServerInfoImpl(name, host, version, startDate, getConnectionManager());
}
}
......@@ -461,10 +466,6 @@ public class XMPPServer {
try {
initialize();
startDate = new Date();
// Store server info
xmppServerInfo = new XMPPServerInfoImpl(name, host, version, startDate, getConnectionManager());
// Create PluginManager now (but don't start it) so that modules may use it
File pluginDir = new File(openfireHome, "plugins");
pluginManager = new PluginManager(pluginDir);
......
......@@ -22,6 +22,7 @@ package org.jivesoftware.openfire.spi;
import org.jivesoftware.openfire.ConnectionManager;
import org.jivesoftware.openfire.ServerPort;
import org.jivesoftware.openfire.XMPPServer;
import org.jivesoftware.openfire.XMPPServerInfo;
import org.jivesoftware.util.JiveGlobals;
import org.jivesoftware.util.Version;
......@@ -54,12 +55,11 @@ public class XMPPServerInfoImpl implements XMPPServerInfo {
* it hasn't been started).
* @param connectionManager the object that keeps track of the active ports.
*/
public XMPPServerInfoImpl(String xmppDomain, String hostname, Version version, Date startDate, ConnectionManager connectionManager) {
public XMPPServerInfoImpl(String xmppDomain, String hostname, Version version, Date startDate) {
this.xmppDomain = xmppDomain;
this.hostname = hostname;
this.ver = version;
this.startDate = startDate;
this.connectionManager = connectionManager;
}
public Version getVersion() {
......@@ -103,10 +103,10 @@ public class XMPPServerInfoImpl implements XMPPServerInfo {
public Collection<ServerPort> getServerPorts() {
if (connectionManager == null) {
return Collections.emptyList();
}
else {
return connectionManager.getPorts();
connectionManager = XMPPServer.getInstance().getConnectionManager();
}
return (Collection<ServerPort>) (connectionManager == null ?
Collections.emptyList() :
connectionManager.getPorts());
}
}
\ No newline at end of file
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