Commit bed2a3f6 authored by Oksana Zhuravlova's avatar Oksana Zhuravlova Committed by Commit Bot

Convert "instance_name" to "can_connect_to_other_services_with_any_instance_name"

This change updates the service_manager::Instance code to reference its
options_.can_connect_to_other_services_with_any_instance_name value
instead of "service_manager:instance_name" in the "required" section
of its interface provider specs.
Tests and existing manifests were updated accordingly.

Bug: 866967
Cq-Include-Trybots: luci.chromium.try:ios-simulator-cronet;luci.chromium.try:ios-simulator-full-configs
Change-Id: I7811919f86470cb098d588710e9aa3f2dd497e32
Reviewed-on: https://chromium-review.googlesource.com/1208710Reviewed-by: default avatarTom Sepez <tsepez@chromium.org>
Reviewed-by: default avatarKen Rockot <rockot@chromium.org>
Commit-Queue: Oksana Zhuravlova <oksamyt@chromium.org>
Cr-Commit-Position: refs/heads/master@{#589428}
parent 3e67ba41
......@@ -2,7 +2,8 @@
"name": "chrome",
"display_name": "Chrome",
"options" : {
"instance_sharing" : "shared_instance_across_users"
"instance_sharing": "shared_instance_across_users",
"can_connect_to_other_services_with_any_instance_name": true
},
"interface_provider_specs": {
"service_manager:connector": {
......@@ -24,8 +25,7 @@
"requires": {
"chrome_renderer": [ "browser" ],
"service_manager": [
"service_manager:client_process",
"service_manager:instance_name"
"service_manager:client_process"
]
}
}
......
{
"name": "content_browser",
"display_name": "Content (browser process)",
"options": { "can_connect_to_other_services_as_any_user": true },
"options": {
"can_connect_to_other_services_as_any_user": true,
"can_connect_to_other_services_with_any_instance_name": true
},
"interface_provider_specs": {
"service_manager:connector": {
"provides": {
......@@ -126,7 +129,6 @@
],
"service_manager": [
"service_manager:client_process",
"service_manager:instance_name",
"service_manager:service_manager"
],
"shape_detection": [
......
{
"name": "web_browser",
"display_name": "Web",
"options": { "can_connect_to_other_services_as_any_user": true },
"options": {
"can_connect_to_other_services_as_any_user": true,
"can_connect_to_other_services_with_any_instance_name": true
},
"interface_provider_specs": {
"service_manager:connector": {
"provides": {
......@@ -13,7 +16,6 @@
"*": [ "app" ],
"service_manager": [
"service_manager:client_process",
"service_manager:instance_name",
"service_manager:service_manager"
]
}
......
......@@ -189,10 +189,12 @@ std::unique_ptr<Entry> Entry::Deserialize(const base::Value& manifest_root) {
options_struct.can_connect_to_other_services_as_any_user =
can_connect_to_other_services_as_any_user_value->GetBool();
if (const base::Value* allow_other_instance_names_value =
options->FindKey("allow_other_instance_names"))
options_struct.allow_other_instance_names =
allow_other_instance_names_value->GetBool();
if (const base::Value*
can_connect_to_other_services_with_any_instance_name_value =
options->FindKey(
"can_connect_to_other_services_with_any_instance_name"))
options_struct.can_connect_to_other_services_with_any_instance_name =
can_connect_to_other_services_with_any_instance_name_value->GetBool();
if (const base::Value* instance_for_client_process_value =
options->FindKey("instance_for_client_process"))
......
......@@ -76,7 +76,8 @@ TEST_F(EntryTest, Options) {
EXPECT_EQ(ServiceOptions::InstanceSharingType::SINGLETON,
entry->options().instance_sharing);
EXPECT_TRUE(entry->options().can_connect_to_other_services_as_any_user);
EXPECT_TRUE(entry->options().allow_other_instance_names);
EXPECT_TRUE(
entry->options().can_connect_to_other_services_with_any_instance_name);
EXPECT_TRUE(entry->options().instance_for_client_process);
EXPECT_EQ("", entry->sandbox_type());
......
......@@ -16,7 +16,7 @@ struct ServiceOptions {
InstanceSharingType instance_sharing = InstanceSharingType::NONE;
bool can_connect_to_other_services_as_any_user = false;
bool allow_other_instance_names = false;
bool can_connect_to_other_services_with_any_instance_name = false;
bool instance_for_client_process = false;
};
......
......@@ -4,7 +4,7 @@
"options": {
"instance_sharing": "singleton",
"can_connect_to_other_services_as_any_user": true,
"allow_other_instance_names": true,
"can_connect_to_other_services_with_any_instance_name": true,
"instance_for_client_process": true
},
"interface_provider_specs": { }
......
......@@ -13,9 +13,6 @@
// Clients requesting this class are allowed to register clients for
// processes they launch themselves.
"service_manager:client_process": [ ],
// Clients requesting this class are allowed to connect to other clients
// in specific process instance groups.
"service_manager:instance_name": [ ],
"service_manager:block_wildcard": [ ],
"service_manager:service_manager": [
......
......@@ -48,7 +48,6 @@ namespace service_manager {
namespace {
const char kCapability_ClientProcess[] = "service_manager:client_process";
const char kCapability_InstanceName[] = "service_manager:instance_name";
const char kCapability_ServiceManager[] = "service_manager:service_manager";
bool Succeeded(mojom::ConnectResult result) {
......@@ -621,17 +620,16 @@ class ServiceManager::Instance
<< " running as: " << identity_.user_id()
<< " attempting to connect to: " << target.name()
<< " as: " << target.user_id() << " without "
<< " the service:service_manager{user_id} capability.";
<< " the 'can_connect_to_other_services_as_any_user' option.";
return mojom::ConnectResult::ACCESS_DENIED;
}
if (!target.instance().empty() &&
target.instance() != target.name() &&
!HasCapability(connection_spec, kCapability_InstanceName)) {
LOG(ERROR) << "Instance: " << identity_.name() << " attempting to "
if (!target.instance().empty() && target.instance() != target.name() &&
!options_.can_connect_to_other_services_with_any_instance_name) {
LOG(ERROR)
<< "Instance: " << identity_.name() << " attempting to "
<< "connect to " << target.name()
<< " using Instance name: " << target.instance()
<< " without the "
<< "service_manager{instance_name} capability.";
<< " using Instance name: " << target.instance() << " without the "
<< " 'can_connect_to_other_services_with_any_instance_name' option.";
return mojom::ConnectResult::ACCESS_DENIED;
}
......
{
"name": "connect_unittests",
"display_name": "Connect Unittests",
"options": { "can_connect_to_other_services_as_any_user": true },
"options": {
"can_connect_to_other_services_as_any_user": true,
"can_connect_to_other_services_with_any_instance_name": true
},
"interface_provider_specs": {
"service_manager:connector": {
"provides": {
......@@ -26,10 +29,7 @@
"connect_unittests:standalone_app",
"connect_unittests:user_id_test"
],
"connect_test_singleton_app": [],
"service_manager": [
"service_manager:instance_name"
]
"connect_test_singleton_app": []
}
}
}
......
......@@ -8,7 +8,6 @@
"lifecycle_unittest_parent": [ "lifecycle_unittest:parent" ],
"service_manager": [
"service_manager:service_manager",
"service_manager:instance_name",
"service_manager:client_process"
]
}
......
......@@ -2,7 +2,8 @@
"name": "service_manager_unittest",
"display_name": "Service Manager Unittest",
"options": {
"instance_sharing" : "singleton"
"instance_sharing": "singleton",
"can_connect_to_other_services_with_any_instance_name": true
},
"interface_provider_specs": {
"service_manager:connector": {
......@@ -14,8 +15,7 @@
"requires": {
"service_manager": [
"service_manager:service_manager",
"service_manager:client_process",
"service_manager:instance_name"
"service_manager:client_process"
],
"service_manager_unittest_embedder": [
"service_manager_unittest:embedder"
......
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