diff --git a/src/packets.cpp b/src/packets.cpp index a0ba7e1..b584bba 100644 --- a/src/packets.cpp +++ b/src/packets.cpp @@ -329,12 +329,13 @@ AOPacket AOClient::validateIcPacket(AOPacket packet) args.append(incoming_args[1].toString()); // char name - if (!server->characters.contains(incoming_args[2].toString())) - return invalid; if (current_char != incoming_args[2].toString()) { // Selected char is different from supplied folder name // This means the user is INI-swapped // TODO: ini swap locking + // if no iniswap allowed then + // if (!server->characters.contains(incoming_args[2].toString())) + // return invalid; qDebug() << "INI swap detected from " << getIpid(); } args.append(incoming_args[2].toString()); diff --git a/src/server.cpp b/src/server.cpp index d60230d..b307398 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -32,7 +32,18 @@ Server::Server(int p_port, int p_ws_port, QObject* parent) : QObject(parent) void Server::start() { - if (!server->listen(QHostAddress::Any, port)) { + QSettings config("config/config.ini", QSettings::IniFormat); + config.beginGroup("Options"); + QString bind_ip = config.value("ip", "all").toString(); + QHostAddress bind_addr; + if (bind_ip == "all") + bind_addr = QHostAddress::Any; + else + bind_addr = QHostAddress(bind_ip); + if (bind_addr.protocol() != QAbstractSocket::IPv4Protocol && bind_addr.protocol() != QAbstractSocket::IPv6Protocol && bind_addr != QHostAddress::Any) { + qDebug() << bind_ip << "is an invalid IP address to listen on! Server not starting, check your config."; + } + if (!server->listen(bind_addr, port)) { qDebug() << "Server error:" << server->errorString(); } else {