summaryrefslogtreecommitdiff
path: root/server/NetworkController.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'server/NetworkController.cpp')
-rw-r--r--server/NetworkController.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/server/NetworkController.cpp b/server/NetworkController.cpp
index 20ef9ebb..4bb4ff1e 100644
--- a/server/NetworkController.cpp
+++ b/server/NetworkController.cpp
@@ -751,11 +751,10 @@ Network* NetworkController::getNetworkLocked(unsigned netId) const {
}
VirtualNetwork* NetworkController::getVirtualNetworkForUserLocked(uid_t uid) const {
- for (const auto& entry : mNetworks) {
- if (entry.second->getType() == Network::VIRTUAL) {
- VirtualNetwork* virtualNetwork = static_cast<VirtualNetwork*>(entry.second);
- if (virtualNetwork->appliesToUser(uid)) {
- return virtualNetwork;
+ for (const auto& [_, network] : mNetworks) {
+ if (network->getType() == Network::VIRTUAL) {
+ if (network->appliesToUser(uid)) {
+ return static_cast<VirtualNetwork*>(network);
}
}
}
@@ -788,7 +787,7 @@ int NetworkController::checkUserNetworkAccessLocked(uid_t uid, unsigned netId) c
}
// If the UID wants to use a VPN, it can do so if and only if the VPN applies to the UID.
if (network->getType() == Network::VIRTUAL) {
- return static_cast<VirtualNetwork*>(network)->appliesToUser(uid) ? 0 : -EPERM;
+ return network->appliesToUser(uid) ? 0 : -EPERM;
}
// If a VPN applies to the UID, and the VPN is secure (i.e., not bypassable), then the UID can
// only select a different network if it has the ability to protect its sockets.