summaryrefslogtreecommitdiffstats
path: root/modules-available/locations
diff options
context:
space:
mode:
authorSimon Rettberg2017-07-13 15:55:50 +0200
committerSimon Rettberg2017-07-13 15:55:50 +0200
commit163036edf65830f51a0b33bd9b3694d928f7c875 (patch)
tree362545b053d6dd80513b4b46438986d7c755ad7e /modules-available/locations
parent[runmode] Tweaks, support NO_CONFIG and systemd target (diff)
downloadslx-admin-163036edf65830f51a0b33bd9b3694d928f7c875.tar.gz
slx-admin-163036edf65830f51a0b33bd9b3694d928f7c875.tar.xz
slx-admin-163036edf65830f51a0b33bd9b3694d928f7c875.zip
[locations] Add/improve comments
Diffstat (limited to 'modules-available/locations')
-rw-r--r--modules-available/locations/inc/location.inc.php12
1 files changed, 6 insertions, 6 deletions
diff --git a/modules-available/locations/inc/location.inc.php b/modules-available/locations/inc/location.inc.php
index 85b7e47f..8b2ef262 100644
--- a/modules-available/locations/inc/location.inc.php
+++ b/modules-available/locations/inc/location.inc.php
@@ -236,7 +236,7 @@ class Location
/**
* Get location id for given machine (by uuid)
- * @param $uuid machine uuid
+ * @param string $uuid machine uuid
* @return bool|int locationid, false if no match
*/
public static function getFromMachineUuid($uuid)
@@ -277,8 +277,8 @@ class Location
* client. We can't trust the UUID too much as it is provided by the
* client, so if it seems too fishy, the UUID will be ignored.
*
- * @param $ip IP address of client
- * @param $uuid System-UUID of client
+ * @param string $ip IP address of client
+ * @param string $uuid System-UUID of client
* @return int|bool location id, or false if none matches
*/
public static function getFromIpAndUuid($ip, $uuid)
@@ -295,8 +295,8 @@ class Location
// location determined by the uuid
$uuidLocations = self::getLocationRootChain($uuidLoc);
$ipLocations = self::getLocationRootChain($ipLoc);
- if (in_array($uuidLoc, $ipLocations)
- || (in_array($ipLoc, $uuidLocations) && count($ipLocations) + 1 >= count($uuidLocations))
+ if (in_array($uuidLoc, $ipLocations) // UUID loc is further up, OK
+ || (in_array($ipLoc, $uuidLocations) && count($ipLocations) + 1 >= count($uuidLocations)) // UUID is max one level deeper than IP loc, accept as well
) {
// Close enough, allow
$locationId = $uuidLoc;
@@ -453,7 +453,7 @@ class Location
* If two+ subnets match and have the same depth and size, a
* random one will be returned.
*
- * @param $ip IP to look up
+ * @param string $ip IP to look up
* @return bool|int locationid ip matches, false = no match
*/
public static function mapIpToLocation($ip)