Commit 82eec113 authored by Gabriel Guardincerri's avatar Gabriel Guardincerri Committed by gguardin

Bug Fix. The default secret is hashed before displaying it.

git-svn-id: http://svn.igniterealtime.org/svn/repos/openfire/trunk@9315 b35dd754-fafc-0310-a699-88a17e54d16e
parent 12d9ae8c
...@@ -17,7 +17,8 @@ ...@@ -17,7 +17,8 @@
org.jivesoftware.openfire.XMPPServer, org.jivesoftware.openfire.XMPPServer,
org.jivesoftware.openfire.multiplex.ConnectionMultiplexerManager, org.jivesoftware.openfire.multiplex.ConnectionMultiplexerManager,
org.jivesoftware.openfire.session.ConnectionMultiplexerSession, org.jivesoftware.openfire.session.ConnectionMultiplexerSession,
org.jivesoftware.util.ParamUtils" org.jivesoftware.util.ParamUtils,
org.jivesoftware.util.StringUtils"
errorPage="error.jsp" errorPage="error.jsp"
%> %>
<%@ page import="java.util.Collection"%> <%@ page import="java.util.Collection"%>
...@@ -65,8 +66,29 @@ ...@@ -65,8 +66,29 @@
else { else {
connectionManager.enableConnectionManagerListener(true); connectionManager.enableConnectionManagerListener(true);
connectionManager.setConnectionManagerListenerPort(port); connectionManager.setConnectionManagerListenerPort(port);
// Get hash value of existing default secret
String existingHashDefaultSecret = "";
if (ConnectionMultiplexerManager.getDefaultSecret() != null) {
existingHashDefaultSecret = StringUtils.hash(ConnectionMultiplexerManager.getDefaultSecret());
}
// Check if the new default secret was changed. If it wasn't changed, then it is the original hashed
// default secret
// NOTE: if the new PLAIN default secret equals the previous HASHED default secret this fails,
// but is unlikely.
if (!existingHashDefaultSecret.equals(defaultSecret)) {
// Hash the new default secret since it was changed
String newHashDefaultSecret = "";
if (defaultSecret != null) {
newHashDefaultSecret = StringUtils.hash(defaultSecret);
}
// Change default secret if hash values are different
if (!existingHashDefaultSecret.equals(newHashDefaultSecret)) {
ConnectionMultiplexerManager.setDefaultSecret(defaultSecret); ConnectionMultiplexerManager.setDefaultSecret(defaultSecret);
} }
}
}
updateSucess = true; updateSucess = true;
} }
} }
...@@ -182,8 +204,8 @@ ...@@ -182,8 +204,8 @@
<fmt:message key="connection-manager.settings.defaultSecret" /> <fmt:message key="connection-manager.settings.defaultSecret" />
</td> </td>
<td width="99%"> <td width="99%">
<input type="text" size="15" maxlength="70" name="defaultSecret" <input type="password" size="30" maxlength="150" name="defaultSecret"
value="<%= ((defaultSecret != null) ? defaultSecret : "") %>"> value="<%= ((defaultSecret != null) ? StringUtils.hash(defaultSecret) : "") %>">
</td> </td>
</tr> </tr>
</table> </table>
......
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