diff --git a/html/pages/device/edit/device.inc.php b/html/pages/device/edit/device.inc.php index 4a716d214b..acb9ad889b 100644 --- a/html/pages/device/edit/device.inc.php +++ b/html/pages/device/edit/device.inc.php @@ -78,6 +78,24 @@ if ($_POST['editing']) { print_error('Only administrative users may update the device hostname'); } } + if (isset($_POST['sysName']) && $_POST['sysName'] !== '' && $_POST['sysName'] !== $device['sysName']) { + if (is_admin()) { + $result = dbUpdate(array('sysName' => $_POST['sysName']), 'devices', '`device_id` = ?', array($device['device_id'])); + if ($result !== false) { + print_message("sysName updated from {$device['sysName']} to {$_POST['sysName']}"); + echo ' + + '; + } else { + print_error("Failed to update sysName"); + } + } else { + print_error('Only administrative users may update the device hostname'); + } + } } else { include 'includes/error-no-perm.inc.php'; } @@ -124,7 +142,16 @@ if ($updated && $update_message) { -