Skip to content

Commit

Permalink
Revert "Use install_attributes.proto from system_api"
Browse files Browse the repository at this point in the history
This reverts commit b0afc52.

Reason for revert: Didn't realize that the Chrome OS protofiles ebuild and libbrillo still used components/policy/proto/install_attributes.proto. Pointing libbrillo to the system_api version caused build failures for Tael. Going for a different solution now: Make all of Chrome OS use the Chrome version of the file.

Original change's description:
> Use install_attributes.proto from system_api
>
> Gets rid of Chrome's own copy of install_attributes.proto and uses the
> one from system_api instead, which was recently moved there by
> CL:1402785.
>
> BUG=chromium:775087
> TEST=Tryjobs
>
> Change-Id: I5e9166eaee380d9f0e47c3312f4f19cb4ef62d72
> Reviewed-on: https://chromium-review.googlesource.com/c/1402876
> Commit-Queue: Lutz Justen <ljusten@chromium.org>
> Reviewed-by: Sergey Poromov <poromov@chromium.org>
> Reviewed-by: Steven Bennetts <stevenjb@chromium.org>
> Reviewed-by: Roman Sorokin [CET] <rsorokin@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#624055}

TBR=stevenjb@chromium.org,rsorokin@chromium.org,ljusten@chromium.org,poromov@chromium.org

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

Bug: chromium:775087
Change-Id: Ic56cfecdf94fd9d2dfe0c41c46158120e7149cd2
Reviewed-on: https://chromium-review.googlesource.com/c/1436048
Reviewed-by: Lutz Justen <ljusten@chromium.org>
Commit-Queue: Lutz Justen <ljusten@chromium.org>
Auto-Submit: Lutz Justen <ljusten@chromium.org>
Cr-Commit-Position: refs/heads/master@{#626071}
  • Loading branch information
Lutz Justen authored and Commit Bot committed Jan 25, 2019
1 parent ade849f commit af59cc8
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 18 deletions.
1 change: 0 additions & 1 deletion chromeos/dbus/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,6 @@ proto_library("concierge_proto") {

proto_library("cryptohome_proto") {
sources = [
"//third_party/cros_system_api/dbus/cryptohome/install_attributes.proto",
"//third_party/cros_system_api/dbus/cryptohome/key.proto",
"//third_party/cros_system_api/dbus/cryptohome/rpc.proto",
]
Expand Down
8 changes: 3 additions & 5 deletions chromeos/dbus/fake_cryptohome_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@
#include "base/threading/thread_task_runner_handle.h"
#include "chromeos/dbus/attestation/attestation.pb.h"
#include "chromeos/dbus/constants/dbus_paths.h"
#include "chromeos/dbus/cryptohome/install_attributes.pb.h"
#include "chromeos/dbus/cryptohome/key.pb.h"
#include "chromeos/dbus/cryptohome/rpc.pb.h"
#include "chromeos/dbus/util/account_identifier_operators.h"
#include "components/policy/proto/install_attributes.pb.h"
#include "third_party/cros_system_api/dbus/service_constants.h"

namespace chromeos {
Expand Down Expand Up @@ -280,10 +280,8 @@ bool FakeCryptohomeClient::InstallAttributesFinalize(bool* successful) {
value.data() + value.size());
}

// Set default version (note that version is required).
install_attrs_proto.set_version(install_attrs_proto.version());
std::string result = install_attrs_proto.SerializeAsString();
DCHECK(!result.empty());
std::string result;
install_attrs_proto.SerializeToString(&result);

// The real implementation does a blocking wait on the dbus call; the fake
// implementation must have this file written before returning.
Expand Down
8 changes: 2 additions & 6 deletions chromeos/tpm/install_attributes.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@
#include "base/threading/thread_task_runner_handle.h"
#include "base/time/time.h"
#include "chromeos/dbus/constants/dbus_paths.h"
#include "chromeos/dbus/cryptohome/install_attributes.pb.h"
#include "chromeos/dbus/cryptohome/rpc.pb.h"
#include "chromeos/dbus/dbus_thread_manager.h"
#include "chromeos/dbus/util/tpm_util.h"
#include "components/policy/proto/install_attributes.pb.h"
#include "google_apis/gaia/gaia_auth_util.h"
#include "third_party/cros_system_api/dbus/service_constants.h"

Expand Down Expand Up @@ -138,11 +138,7 @@ InstallAttributes::GetEnterpriseOwnedInstallAttributesBlobForTesting(
attribute->set_name(InstallAttributes::kAttrEnterpriseUser);
attribute->set_value(user_name);

// Set default version (note that version is required).
install_attrs_proto.set_version(install_attrs_proto.version());
std::string result = install_attrs_proto.SerializeAsString();
DCHECK(!result.empty());
return result;
return install_attrs_proto.SerializeAsString();
}

InstallAttributes::InstallAttributes(CryptohomeClient* cryptohome_client)
Expand Down
6 changes: 1 addition & 5 deletions chromeos/tpm/install_attributes_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
#include "base/test/metrics/histogram_tester.h"
#include "base/test/scoped_task_environment.h"
#include "chromeos/dbus/constants/dbus_paths.h"
#include "chromeos/dbus/cryptohome/install_attributes.pb.h"
#include "chromeos/dbus/cryptohome/rpc.pb.h"
#include "chromeos/dbus/cryptohome_client.h"
#include "chromeos/dbus/dbus_thread_manager.h"
#include "chromeos/dbus/util/tpm_util.h"
#include "components/policy/proto/install_attributes.pb.h"
#include "google_apis/gaia/gaia_auth_util.h"
#include "testing/gtest/include/gtest/gtest.h"

Expand Down Expand Up @@ -288,8 +288,6 @@ TEST_F(InstallAttributesTest, Init) {
"true");
SetAttribute(&install_attrs_proto, InstallAttributes::kAttrEnterpriseUser,
kTestUserDeprecated);
// Set default version (note that version is required).
install_attrs_proto.set_version(install_attrs_proto.version());
const std::string blob(install_attrs_proto.SerializeAsString());
ASSERT_EQ(static_cast<int>(blob.size()),
base::WriteFile(GetTempPath(), blob.c_str(), blob.size()));
Expand All @@ -304,8 +302,6 @@ TEST_F(InstallAttributesTest, InitForConsumerKiosk) {
cryptohome::SerializedInstallAttributes install_attrs_proto;
SetAttribute(&install_attrs_proto,
InstallAttributes::kAttrConsumerKioskEnabled, "true");
// Set default version (note that version is required).
install_attrs_proto.set_version(install_attrs_proto.version());
const std::string blob(install_attrs_proto.SerializeAsString());
ASSERT_EQ(static_cast<int>(blob.size()),
base::WriteFile(GetTempPath(), blob.c_str(), blob.size()));
Expand Down
5 changes: 4 additions & 1 deletion components/policy/proto/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@ proto_library("proto_internal") {
]

if (is_chromeos) {
sources += [ "chrome_device_policy.proto" ]
sources += [
"chrome_device_policy.proto",
"install_attributes.proto",
]
}

if (!is_android && !is_ios) {
Expand Down
20 changes: 20 additions & 0 deletions components/policy/proto/install_attributes.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

syntax = "proto2";

option optimize_for = LITE_RUNTIME;

package cryptohome;

// This must match install_attributes.proto in the Chromium OS cryptohome
// repository. Only the fields that are relevant to the browser are present
// here.
message SerializedInstallAttributes {
message Attribute {
required string name = 1;
required bytes value = 2;
}
repeated Attribute attributes = 2;
}

0 comments on commit af59cc8

Please sign in to comment.