Commit d3e670fb authored by Guillaume Jenkins's avatar Guillaume Jenkins Committed by Chromium LUCI CQ

[iOS CBCM] Don't send machine name in DM requests

Stops setting the machine_name field in the DM API protos for iOS
browsers. The machine name will instead be set by the backend by using
the client ID, and fall back to the device model if needed.

Bug: 1150847
Change-Id: I00345b07bce3b5f99fce3e19cd753207da4e6113
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2617465Reviewed-by: default avatarFabio Tirelo <ftirelo@chromium.org>
Reviewed-by: default avatarOwen Min <zmin@chromium.org>
Commit-Queue: Guillaume Jenkins <gujen@google.com>
Cr-Commit-Position: refs/heads/master@{#843698}
parent f90c11b2
...@@ -277,7 +277,11 @@ void CloudPolicyClient::RegisterWithToken(const std::string& token, ...@@ -277,7 +277,11 @@ void CloudPolicyClient::RegisterWithToken(const std::string& token,
enterprise_management::RegisterBrowserRequest* request = enterprise_management::RegisterBrowserRequest* request =
config->request()->mutable_register_browser_request(); config->request()->mutable_register_browser_request();
#if !defined(OS_IOS)
// For iOS devices, the machine name is determined by server side logic using
// the client ID and / or the device model.
request->set_machine_name(GetMachineName()); request->set_machine_name(GetMachineName());
#endif // !defined(OS_IOS)
request->set_os_platform(GetOSPlatform()); request->set_os_platform(GetOSPlatform());
request->set_os_version(GetOSVersion()); request->set_os_version(GetOSVersion());
#if defined(OS_IOS) #if defined(OS_IOS)
......
...@@ -292,7 +292,9 @@ class CloudPolicyClientTest : public testing::Test { ...@@ -292,7 +292,9 @@ class CloudPolicyClientTest : public testing::Test {
(defined(OS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)) (defined(OS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS))
em::RegisterBrowserRequest* enrollment_request = em::RegisterBrowserRequest* enrollment_request =
enrollment_token_request_.mutable_register_browser_request(); enrollment_token_request_.mutable_register_browser_request();
#if !defined(OS_IOS)
enrollment_request->set_machine_name(policy::GetMachineName()); enrollment_request->set_machine_name(policy::GetMachineName());
#endif
enrollment_request->set_os_platform(policy::GetOSPlatform()); enrollment_request->set_os_platform(policy::GetOSPlatform());
enrollment_request->set_os_version(policy::GetOSVersion()); enrollment_request->set_os_version(policy::GetOSVersion());
#if defined(OS_IOS) #if defined(OS_IOS)
......
...@@ -900,8 +900,8 @@ class PolicyRequestHandler(BaseHTTPServer.BaseHTTPRequestHandler): ...@@ -900,8 +900,8 @@ class PolicyRequestHandler(BaseHTTPServer.BaseHTTPRequestHandler):
if not device_id: if not device_id:
return (400, 'Parameter deviceid is missing.') return (400, 'Parameter deviceid is missing.')
if not msg.machine_name: if not msg.machine_name and not msg.device_model:
return (400, 'Invalid machine name: ') return (400, 'Either machine name or device model must be non-empty.')
if enrollment_token == INVALID_ENROLLMENT_TOKEN: if enrollment_token == INVALID_ENROLLMENT_TOKEN:
return (401, 'Invalid enrollment token') return (401, 'Invalid enrollment token')
......
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