mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-17 22:08:27 +02:00
Update naming for subnet whitelist in ds
This commit is contained in:
parent
e1466c0d47
commit
d691aa3302
2 changed files with 9 additions and 9 deletions
|
@ -158,9 +158,9 @@ DomainServer::DomainServer(int argc, char* argv[]) :
|
|||
|
||||
|
||||
qDebug() << "domain-server is running";
|
||||
static const SubnetMask LOCALHOST_MASK { QHostAddress("127.0.0.1"), 32 };
|
||||
static const Subnet LOCALHOST { QHostAddress("127.0.0.1"), 32 };
|
||||
|
||||
this->_acIPAddressWhitelist = { LOCALHOST_MASK };
|
||||
this->_acSubnetWhitelist = { LOCALHOST };
|
||||
|
||||
_settingsManager.getWhitelistAssignmentClientAddresses();
|
||||
auto whitelist = _settingsManager.valueOrDefaultValueForKeyPath("security.ac_address_whitelist").toStringList();
|
||||
|
@ -189,7 +189,7 @@ DomainServer::DomainServer(int argc, char* argv[]) :
|
|||
|
||||
if (!ip.isNull()) {
|
||||
qDebug() << "Adding AC whitelist IP: " << mask << " -> " << (ip.toString() + "/" + QString::number(netmask));
|
||||
_acIPAddressWhitelist.push_back({ ip , netmask });
|
||||
_acSubnetWhitelist.push_back({ ip , netmask });
|
||||
} else {
|
||||
qDebug() << "Ignoring ip in whitelist, invalid ip: " << mask;
|
||||
}
|
||||
|
@ -1039,12 +1039,12 @@ void DomainServer::processRequestAssignmentPacket(QSharedPointer<ReceivedMessage
|
|||
|
||||
auto senderAddr = message->getSenderSockAddr().getAddress();
|
||||
|
||||
auto isHostAddressInSubnet = [&senderAddr](const SubnetMask& mask) -> bool {
|
||||
auto isHostAddressInSubnet = [&senderAddr](const Subnet& mask) -> bool {
|
||||
return senderAddr.isInSubnet(mask);
|
||||
};
|
||||
|
||||
auto it = find_if(_acIPAddressWhitelist.begin(), _acIPAddressWhitelist.end(), isHostAddressInSubnet);
|
||||
if (it != _acIPAddressWhitelist.end()) {
|
||||
auto it = find_if(_acSubnetWhitelist.begin(), _acSubnetWhitelist.end(), isHostAddressInSubnet);
|
||||
if (it != _acSubnetWhitelist.end()) {
|
||||
auto maskString = it->first.toString() + "/" + QString::number(it->second);
|
||||
qDebug() << "Received connection from whitelisted ip: " << senderAddr.toString()
|
||||
<< ", matches subnet mask: " << maskString;
|
||||
|
|
|
@ -36,8 +36,8 @@
|
|||
typedef QSharedPointer<Assignment> SharedAssignmentPointer;
|
||||
typedef QMultiHash<QUuid, WalletTransaction*> TransactionHash;
|
||||
|
||||
using SubnetMask = QPair<QHostAddress, int>;
|
||||
using SubnetMaskList = std::vector<QPair<QHostAddress, int>>;
|
||||
using Subnet = QPair<QHostAddress, int>;
|
||||
using SubnetList = std::vector<Subnet>;
|
||||
|
||||
class DomainServer : public QCoreApplication, public HTTPSRequestHandler {
|
||||
Q_OBJECT
|
||||
|
@ -159,7 +159,7 @@ private:
|
|||
|
||||
void setupGroupCacheRefresh();
|
||||
|
||||
SubnetMaskList _acIPAddressWhitelist;
|
||||
SubnetList _acSubnetWhitelist;
|
||||
|
||||
DomainGatekeeper _gatekeeper;
|
||||
|
||||
|
|
Loading…
Reference in a new issue