Commit d87dbde4 authored by Gaston Dombiak's avatar Gaston Dombiak Committed by gato

Return an unmodified set of supported mechanisms so that the original list cannot be modified.

git-svn-id: http://svn.igniterealtime.org/svn/repos/wildfire/trunk@5002 b35dd754-fafc-0310-a699-88a17e54d16e
parent c0cd38cf
...@@ -124,7 +124,7 @@ public class SASLAuthentication { ...@@ -124,7 +124,7 @@ public class SASLAuthentication {
} }
} }
else { else {
for (String mech : getSupportedMechanisms()) { for (String mech : mechanisms) {
if (mech.equals("CRAM-MD5") || mech.equals("DIGEST-MD5")) { if (mech.equals("CRAM-MD5") || mech.equals("DIGEST-MD5")) {
// Check if the user provider in use supports passwords retrieval. Accessing // Check if the user provider in use supports passwords retrieval. Accessing
// to the users passwords will be required by the CallbackHandler // to the users passwords will be required by the CallbackHandler
...@@ -171,17 +171,17 @@ public class SASLAuthentication { ...@@ -171,17 +171,17 @@ public class SASLAuthentication {
session.setSessionData("SaslMechanism", mechanism); session.setSessionData("SaslMechanism", mechanism);
//Log.debug("SASLAuthentication.doHandshake() AUTH entered: "+mechanism); //Log.debug("SASLAuthentication.doHandshake() AUTH entered: "+mechanism);
if (mechanism.equalsIgnoreCase("PLAIN") && if (mechanism.equalsIgnoreCase("PLAIN") &&
getSupportedMechanisms().contains("PLAIN")) { mechanisms.contains("PLAIN")) {
status = doPlainAuthentication(session, doc); status = doPlainAuthentication(session, doc);
} }
else if (mechanism.equalsIgnoreCase("ANONYMOUS") && else if (mechanism.equalsIgnoreCase("ANONYMOUS") &&
getSupportedMechanisms().contains("ANONYMOUS")) { mechanisms.contains("ANONYMOUS")) {
status = doAnonymousAuthentication(session); status = doAnonymousAuthentication(session);
} }
else if (mechanism.equalsIgnoreCase("EXTERNAL")) { else if (mechanism.equalsIgnoreCase("EXTERNAL")) {
status = doExternalAuthentication(session, doc); status = doExternalAuthentication(session, doc);
} }
else if (getSupportedMechanisms().contains(mechanism)) { else if (mechanisms.contains(mechanism)) {
// The selected SASL mechanism requires the server to send a challenge // The selected SASL mechanism requires the server to send a challenge
// to the client // to the client
try { try {
...@@ -226,13 +226,13 @@ public class SASLAuthentication { ...@@ -226,13 +226,13 @@ public class SASLAuthentication {
// Store the requested SASL mechanism by the client // Store the requested SASL mechanism by the client
mechanism = (String) session.getSessionData("SaslMechanism"); mechanism = (String) session.getSessionData("SaslMechanism");
if (mechanism.equalsIgnoreCase("PLAIN") && if (mechanism.equalsIgnoreCase("PLAIN") &&
getSupportedMechanisms().contains("PLAIN")) { mechanisms.contains("PLAIN")) {
status = doPlainAuthentication(session, doc); status = doPlainAuthentication(session, doc);
} }
else if (mechanism.equalsIgnoreCase("EXTERNAL")) { else if (mechanism.equalsIgnoreCase("EXTERNAL")) {
status = doExternalAuthentication(session, doc); status = doExternalAuthentication(session, doc);
} }
else if (getSupportedMechanisms().contains(mechanism)) { else if (mechanisms.contains(mechanism)) {
SaslServer ss = (SaslServer) session.getSessionData("SaslServer"); SaslServer ss = (SaslServer) session.getSessionData("SaslServer");
if (ss != null) { if (ss != null) {
boolean ssComplete = ss.isComplete(); boolean ssComplete = ss.isComplete();
...@@ -478,7 +478,7 @@ public class SASLAuthentication { ...@@ -478,7 +478,7 @@ public class SASLAuthentication {
* @return the list of supported SASL mechanisms by the server. * @return the list of supported SASL mechanisms by the server.
*/ */
public static Set<String> getSupportedMechanisms() { public static Set<String> getSupportedMechanisms() {
return mechanisms; return Collections.unmodifiableSet(mechanisms);
} }
private static void initMechanisms() { private static void initMechanisms() {
...@@ -504,7 +504,7 @@ public class SASLAuthentication { ...@@ -504,7 +504,7 @@ public class SASLAuthentication {
} }
} }
if (getSupportedMechanisms().contains("GSSAPI")) { if (mechanisms.contains("GSSAPI")) {
if (JiveGlobals.getXMLProperty("sasl.gssapi.config") != null) { if (JiveGlobals.getXMLProperty("sasl.gssapi.config") != null) {
System.setProperty("java.security.krb5.debug", System.setProperty("java.security.krb5.debug",
JiveGlobals.getXMLProperty("sasl.gssapi.debug", "false")); JiveGlobals.getXMLProperty("sasl.gssapi.debug", "false"));
......
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