Commit 7adb1062 authored by Julian Pastarmov's avatar Julian Pastarmov Committed by Commit Bot

[SC] Change the computer name to be the FQDN instead of hostname

Aligning the various reporting paths to return the same type of identifiers.

BUG=b/165296736
TEST=unit_tests:EnterpriseReportingPrivateGetDeviceInfoTest.GetDeviceInfo

Change-Id: Id4789d368d99097cbdbe1f65be098902cb773183
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2380285Reviewed-by: default avatarOwen Min <zmin@chromium.org>
Commit-Queue: Julian Pastarmov <pastarmovj@chromium.org>
Cr-Commit-Position: refs/heads/master@{#803061}
parent 826db82c
...@@ -53,6 +53,19 @@ std::string GetSerialNumber() { ...@@ -53,6 +53,19 @@ std::string GetSerialNumber() {
return base::UTF16ToUTF8(sys_info.serial_number()); return base::UTF16ToUTF8(sys_info.serial_number());
} }
// Retrieves the FQDN of the comeputer and if this fails reverts to the hostname
// as known to the net subsystem.
std::string GetComputerName() {
DWORD size = 1024;
std::string result(size, '\0');
if (!::GetComputerNameExA(ComputerNameDnsFullyQualified, &result[0], &size))
return net::GetHostName();
result.resize(size);
return result;
}
// Retrieves the state of the screen locking feature from the screen saver // Retrieves the state of the screen locking feature from the screen saver
// settings. // settings.
base::Optional<bool> GetScreenLockStatus() { base::Optional<bool> GetScreenLockStatus() {
...@@ -259,7 +272,7 @@ DeviceInfo DeviceInfoFetcherWin::Fetch() { ...@@ -259,7 +272,7 @@ DeviceInfo DeviceInfoFetcherWin::Fetch() {
DeviceInfo device_info; DeviceInfo device_info;
device_info.os_name = "windows"; device_info.os_name = "windows";
device_info.os_version = base::SysInfo::OperatingSystemVersion(); device_info.os_version = base::SysInfo::OperatingSystemVersion();
device_info.device_host_name = net::GetHostName(); device_info.device_host_name = GetComputerName();
device_info.device_model = base::SysInfo::HardwareModelName(); device_info.device_model = base::SysInfo::HardwareModelName();
device_info.serial_number = GetSerialNumber(); device_info.serial_number = GetSerialNumber();
device_info.screen_lock_secured = GetScreenlockSecured(); device_info.screen_lock_secured = GetScreenlockSecured();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment