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

Side by Side Diff: chrome/browser/policy/cloud_policy_cache.cc

Issue 6727027: Update protobuf definitions for ChromeOS device policy support (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address comments Created 9 years, 9 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/policy/cloud_policy_cache.h" 5 #include "chrome/browser/policy/cloud_policy_cache.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 } 304 }
305 305
306 // static 306 // static
307 bool CloudPolicyCache::DecodePolicyResponse( 307 bool CloudPolicyCache::DecodePolicyResponse(
308 const em::PolicyFetchResponse& policy_response, 308 const em::PolicyFetchResponse& policy_response,
309 PolicyMap* mandatory, 309 PolicyMap* mandatory,
310 PolicyMap* recommended, 310 PolicyMap* recommended,
311 base::Time* timestamp) { 311 base::Time* timestamp) {
312 std::string data = policy_response.policy_data(); 312 std::string data = policy_response.policy_data();
313 313
314 if (!VerifySignature(policy_response.policy_data_signature(), data,
315 policy_response.certificate_chain())) {
316 LOG(WARNING) << "Failed to verify signature.";
317 return false;
318 }
319
320 em::PolicyData policy_data; 314 em::PolicyData policy_data;
321 if (!policy_data.ParseFromString(data)) { 315 if (!policy_data.ParseFromString(data)) {
322 LOG(WARNING) << "Failed to parse PolicyData protobuf."; 316 LOG(WARNING) << "Failed to parse PolicyData protobuf.";
323 return false; 317 return false;
324 } 318 }
325 319
326 // TODO(jkummerow): Verify policy_data.device_token(). Needs final 320 // TODO(jkummerow): Verify policy_data.device_token(). Needs final
327 // specification which token we're actually sending / expecting to get back. 321 // specification which token we're actually sending / expecting to get back.
328 322
329 // TODO(jkummerow): Store policy_data.device_name(), if we decide to transfer 323 // TODO(jkummerow): Store policy_data.device_name(), if we decide to transfer
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
459 CloudPolicyCache::DecodeValue(named_value->value()); 453 CloudPolicyCache::DecodeValue(named_value->value());
460 if (decoded_value) 454 if (decoded_value)
461 result->Set(named_value->name(), decoded_value); 455 result->Set(named_value->name(), decoded_value);
462 } 456 }
463 } 457 }
464 } 458 }
465 return result; 459 return result;
466 } 460 }
467 461
468 } // namespace policy 462 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698