From a16b491f249de01d84114889f2ea3a8aea966413 Mon Sep 17 00:00:00 2001 From: ben Date: Tue, 23 Feb 2016 23:50:19 -0800 Subject: Add a user id parameter to connections. This is simply a uint32 that identifies the user running a particular instance. Note that the shell cares nothing about higher level semantic meaning/mapping of this identifier. That's for a user service to perform. An application that connects to another specifies the user id they wish the target to be run as. This can either be a specific user, the root user, or "inherit" which means either their own identity or root, whichever is available in that order. The application manager resolves "inherit" to the source identity or the root identity, and initializes & completes the connection. When a target application is initialized, the shell tells it (via Initialize()) the identity it is run as. When a target application receives an inbound connection, the shell tells it (via AcceptConnection) the identity of the caller. This allows a service run as root to service connections from other users, and create facades scoped to that user. Long term, only specific applications will be able to pass anything other than "inherit" as the user id. (e.g. the login app and the profile creator app). This isn't done in this CL. I need to add some tests for this, along with the rest of the shell stuff. TBD. R=sky@chromium.org CQ_INCLUDE_TRYBOTS=tryserver.chromium.linux:linux_site_isolation Review URL: https://codereview.chromium.org/1719193003 Cr-Commit-Position: refs/heads/master@{#377239} --- media/mojo/services/mojo_media_application.cc | 3 ++- media/mojo/services/mojo_media_application.h | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'media/mojo') diff --git a/media/mojo/services/mojo_media_application.cc b/media/mojo/services/mojo_media_application.cc index e343efd..d954bdd 100644 --- a/media/mojo/services/mojo_media_application.cc +++ b/media/mojo/services/mojo_media_application.cc @@ -27,7 +27,8 @@ MojoMediaApplication::~MojoMediaApplication() {} void MojoMediaApplication::Initialize(mojo::Shell* shell, const std::string& /* url */, - uint32_t /* id */) { + uint32_t /* id */, + uint32_t user_id) { shell_ = shell; mojo_media_client_->Initialize(); } diff --git a/media/mojo/services/mojo_media_application.h b/media/mojo/services/mojo_media_application.h index 6cf98c9..ece3264 100644 --- a/media/mojo/services/mojo_media_application.h +++ b/media/mojo/services/mojo_media_application.h @@ -28,7 +28,8 @@ class MojoMediaApplication // mojo::ShellClient implementation. void Initialize(mojo::Shell* shell, const std::string& url, - uint32_t id) final; + uint32_t id, + uint32_t user_id) final; bool AcceptConnection(mojo::Connection* connection) final; // mojo::InterfaceFactory implementation. -- cgit v1.1