From 0b044b3cc650f0c3b78567f41db725b40a1bef08 Mon Sep 17 00:00:00 2001 From: Dane Everitt Date: Sun, 23 Oct 2016 18:59:13 -0400 Subject: [PATCH] fixes bug that would allow deleting the default allocation for a server. --- app/Repositories/ServerRepository.php | 8 ++++---- resources/views/admin/servers/view.blade.php | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/Repositories/ServerRepository.php b/app/Repositories/ServerRepository.php index ae98649d9..353e13195 100644 --- a/app/Repositories/ServerRepository.php +++ b/app/Repositories/ServerRepository.php @@ -537,12 +537,12 @@ class ServerRepository list($ip, $port) = explode(':', $combo); // Invalid, not worth killing the whole thing, we'll just skip over it. if (!filter_var($ip, FILTER_VALIDATE_IP) || !preg_match('/^(\d{1,5})$/', $port)) { - continue; + break; } // Can't remove the assigned IP/Port combo if ($ip === $allocation->ip && $port === $allocation->port) { - continue; + break; } Models\Allocation::where('ip', $ip)->where('port', $port)->where('assigned_to', $server->id)->update([ @@ -558,12 +558,12 @@ class ServerRepository list($ip, $port) = explode(':', $combo); // Invalid, not worth killing the whole thing, we'll just skip over it. if (!filter_var($ip, FILTER_VALIDATE_IP) || !preg_match('/^(\d{1,5})$/', $port)) { - continue; + break; } // Don't allow double port assignments if (Models\Allocation::where('port', $port)->where('assigned_to', $server->id)->count() !== 0) { - continue; + break; } Models\Allocation::where('ip', $ip)->where('port', $port)->whereNull('assigned_to')->update([ diff --git a/resources/views/admin/servers/view.blade.php b/resources/views/admin/servers/view.blade.php index c698839e5..db86bc28d 100644 --- a/resources/views/admin/servers/view.blade.php +++ b/resources/views/admin/servers/view.blade.php @@ -285,7 +285,7 @@