From 5eb890e4f5c85379d16de3939ddae35851341847 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Wed, 27 Jul 2016 13:26:25 -0700 Subject: [PATCH] add a simple IP address sanitizer for DS settings save --- domain-server/src/DomainServerSettingsManager.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/domain-server/src/DomainServerSettingsManager.cpp b/domain-server/src/DomainServerSettingsManager.cpp index c47c786efa..dc49bc6126 100644 --- a/domain-server/src/DomainServerSettingsManager.cpp +++ b/domain-server/src/DomainServerSettingsManager.cpp @@ -495,7 +495,17 @@ void DomainServerSettingsManager::unpackPermissions() { needPack |= unpackPermissionsForKeypath(AGENT_PERMISSIONS_KEYPATH, &_agentPermissions); - needPack |= unpackPermissionsForKeypath(IP_PERMISSIONS_KEYPATH, &_ipPermissions); + needPack |= unpackPermissionsForKeypath(IP_PERMISSIONS_KEYPATH, &_ipPermissions, + [&](NodePermissionsPointer perms){ + // make sure that this permission row is for a valid IP address + if (QHostAddress(perms->getKey().first).isNull()) { + _ipPermissions.remove(perms->getKey()); + + // we removed a row from the IP permissions, we'll need a re-pack + needPack = true; + } + }); + needPack |= unpackPermissionsForKeypath(GROUP_PERMISSIONS_KEYPATH, &_groupPermissions, [&](NodePermissionsPointer perms){