Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(475)

Unified Diff: chrome/browser/policy/device_policy_identity_strategy.cc

Issue 7493063: Get the proper serial number for device enrollment. (Closed) Base URL: svn://svn.chromium.org/chrome/branches/782/src/
Patch Set: Created 9 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/policy/device_policy_identity_strategy.cc
===================================================================
--- chrome/browser/policy/device_policy_identity_strategy.cc (revision 94533)
+++ chrome/browser/policy/device_policy_identity_strategy.cc (working copy)
@@ -20,8 +20,21 @@
// MachineInfo key names.
static const char kMachineInfoSystemHwqual[] = "hardware_class";
-static const char kMachineInfoSerialNumber[] = "serial_number";
+// These are the machine serial number keys that we check in order until we
+// find a non-empty serial number. The VPD spec says the serial number should be
+// in the "serial_number" key for v2+ VPDs. However, we cannot check this first,
+// since we'd get the "serial_number" value from the SMBIOS (yes, there's a name
+// clash here!), which is different from the serial number we want and not
+// actually per-device. So, we check the the legacy keys first. If we find a
+// serial number for these, we use it, otherwise we must be on a newer device
+// that provides the correct data in "serial_number".
+static const char* kMachineInfoSerialNumberKeys[] = {
+ "sn", // ZGB
+ "Product_S/N", // Alex
+ "serial_number" // VPD v2+ devices
Louis 2011/07/29 02:52:05 I'd like to suggest to re-order the list. Try "ser
Mattias Nissler (ping if slow) 2011/07/29 09:19:52 That's unfortunately not possible due to the name
Louis 2011/08/01 08:18:11 What argument do you use for mosys? Does its seria
Mattias Nissler (ping if slow) 2011/08/01 08:31:17 /sbin/chromeos_startup does this: mosys -k smbios
+};
+
namespace policy {
DevicePolicyIdentityStrategy::DevicePolicyIdentityStrategy() {
@@ -31,10 +44,16 @@
&machine_model_)) {
LOG(ERROR) << "Failed to get machine model.";
}
- if (!sys_lib->GetMachineStatistic(kMachineInfoSerialNumber,
- &machine_id_)) {
+ for (unsigned int i = 0; i < arraysize(kMachineInfoSerialNumberKeys); i++) {
+ if (sys_lib->GetMachineStatistic(kMachineInfoSerialNumberKeys[i],
+ &machine_id_) &&
+ !machine_id_.empty()) {
+ break;
+ }
+ }
+
+ if (machine_id_.empty())
LOG(ERROR) << "Failed to get machine serial number.";
- }
}
DevicePolicyIdentityStrategy::~DevicePolicyIdentityStrategy() {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698