Commit c149d8bc authored by Gustavo Sacomoto's avatar Gustavo Sacomoto Committed by Commit Bot

Revert "Address missed CL comments for chrome.enterprisePrivate.getDeviceInfo() CL."

This reverts commit 4364277e.

Reason for revert: 

The base::mac::CFCastStrict<CFNumberRef>(ask_for_password) cast returns NULL in some cases, and causes a crash.

I'll re-land the original CL (which actually fixes a memory leak), with the proper guards to avoid the crash.

Original change's description:
> Address missed CL comments for chrome.enterprisePrivate.getDeviceInfo() CL.
> 
> Original CL was at:
> https://chromium-review.googlesource.com/c/chromium/src/+/1951561
> 
> Change-Id: I8784ec61cec5834b17afe04ea8b1d474178af15e
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1961211
> Reviewed-by: Julian Pastarmov <pastarmovj@chromium.org>
> Reviewed-by: Robert Sesek <rsesek@chromium.org>
> Commit-Queue: Tim Song <tengs@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#723985}

TBR=pastarmovj@chromium.org,tengs@chromium.org,rsesek@chromium.org

# Not skipping CQ checks because original CL landed > 1 day ago.

Change-Id: I38286e8d12aa82faff4fc798bc81857ac3576f4c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1978419Reviewed-by: default avatarGustavo Sacomoto <sacomoto@chromium.org>
Reviewed-by: default avatarJulian Pastarmov <pastarmovj@chromium.org>
Commit-Queue: Gustavo Sacomoto <sacomoto@chromium.org>
Cr-Commit-Position: refs/heads/master@{#726886}
parent f3faec98
......@@ -47,14 +47,13 @@ std::string GetSerialNumber() {
enterprise_reporting_private::SettingValue GetScreenlockSecured() {
CFStringRef screen_saver_application = CFSTR("com.apple.screensaver");
CFStringRef ask_for_password_key = CFSTR("askForPassword");
base::ScopedCFTypeRef<CFTypeRef> ask_for_password(CFPreferencesCopyAppValue(
ask_for_password_key, screen_saver_application));
base::ScopedCFTypeRef<CFNumberRef> ask_for_password(
base::mac::CFCastStrict<CFNumberRef>(CFPreferencesCopyAppValue(
ask_for_password_key, screen_saver_application)));
int screen_lock_enabled = 0;
if (!ask_for_password ||
!CFNumberGetValue(base::mac::CFCastStrict<CFNumberRef>(ask_for_password),
kCFNumberIntType, &screen_lock_enabled)) {
if (!ask_for_password || !CFNumberGetValue(ask_for_password, kCFNumberIntType,
&screen_lock_enabled)) {
return enterprise_reporting_private::SETTING_VALUE_UNKNOWN;
}
......
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