From 3873aaf01ed04977e66463ba61a7309e1f6e24de Mon Sep 17 00:00:00 2001 From: Adam Winberg Date: Mon, 11 Apr 2016 08:32:13 +0200 Subject: [PATCH] Extend if statement to support hostnames in rancid with or without domain suffix --- html/pages/device.inc.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/html/pages/device.inc.php b/html/pages/device.inc.php index 9517dd96c..8f42abff8 100644 --- a/html/pages/device.inc.php +++ b/html/pages/device.inc.php @@ -327,6 +327,16 @@ if (device_permitted($vars['device']) || $check_device == $vars['device']) { if (is_file($configs.$device['hostname'])) { $device_config_file = $configs.$device['hostname']; } + elseif (is_file($configs.strtok($device['hostname'], '.'))) { // Strip domain + $device_config_file = $configs.strtok($device['hostname'], '.'); + } + else { + if (!empty($config['mydomain'])) { // Try with domain name if set + if (is_file($configs.$device['hostname'].'.'.$config['mydomain'])) { + $device_config_file = $configs.$device['hostname'].'.'.$config['mydomain']; + } + } + } // end if } if ($config['oxidized']['enabled'] === true && isset($config['oxidized']['url'])) {