mirror of
https://github.com/correl/mage.git
synced 2024-12-26 03:00:11 +00:00
Fixed admin pswd not always parsed correctly on server
This commit is contained in:
parent
e67620260c
commit
ef6d5e826e
2 changed files with 18 additions and 0 deletions
|
@ -40,6 +40,7 @@ import mage.server.tournament.TournamentFactory;
|
||||||
import mage.server.util.ConfigSettings;
|
import mage.server.util.ConfigSettings;
|
||||||
import mage.server.util.PluginClassLoader;
|
import mage.server.util.PluginClassLoader;
|
||||||
import mage.server.util.ServerMessagesUtil;
|
import mage.server.util.ServerMessagesUtil;
|
||||||
|
import mage.server.util.SystemUtil;
|
||||||
import mage.server.util.config.GamePlugin;
|
import mage.server.util.config.GamePlugin;
|
||||||
import mage.server.util.config.Plugin;
|
import mage.server.util.config.Plugin;
|
||||||
import mage.utils.MageVersion;
|
import mage.utils.MageVersion;
|
||||||
|
@ -106,6 +107,7 @@ public class Main {
|
||||||
}
|
}
|
||||||
else if (arg.startsWith(adminPasswordArg)) {
|
else if (arg.startsWith(adminPasswordArg)) {
|
||||||
adminPassword = arg.replace(adminPasswordArg, "");
|
adminPassword = arg.replace(adminPasswordArg, "");
|
||||||
|
adminPassword = SystemUtil.sanitize(adminPassword);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Connection connection = new Connection();
|
Connection connection = new Connection();
|
||||||
|
|
|
@ -148,4 +148,20 @@ public class SystemUtil {
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String sanitize(String input) {
|
||||||
|
//Pattern pattern = Pattern.compile("[^0-9a-zA-Z]");
|
||||||
|
//Matcher matcher = pattern.matcher(input);
|
||||||
|
//return matcher.replaceAll("");
|
||||||
|
return input.replaceAll("[^a-zA-Z0-9]", "");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String... args) {
|
||||||
|
System.out.println(sanitize("123"));
|
||||||
|
System.out.println(sanitize("AaAaD_123"));
|
||||||
|
System.out.println(sanitize("--sas-"));
|
||||||
|
System.out.println(sanitize("anPlsdf123_") + "|");
|
||||||
|
System.out.println(sanitize("anPlsdf123 ") + "|");
|
||||||
|
System.out.println(sanitize("anPlsdf123\r\n") + "|");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue