mirror of
https://github.com/google/sandboxed-api.git
synced 2024-03-22 13:11:30 +08:00
Use new sandbox2::Comms ctor for default connection params
This change allows Sandbox2 to change how the default FD for comms is chosen. PiperOrigin-RevId: 479526309 Change-Id: I69add85a244bc0385eaa164ab0ea3b036503c6d3
This commit is contained in:
parent
859e282d3b
commit
b9c2830ebc
|
@ -48,7 +48,7 @@ int main(int argc, char* argv[]) {
|
|||
gflags::ParseCommandLineFlags(&argc, &argv, false);
|
||||
|
||||
// Set-up the sandbox2::Client object, using a file descriptor (1023).
|
||||
sandbox2::Comms comms(sandbox2::Comms::kSandbox2ClientCommsFD);
|
||||
sandbox2::Comms comms(sandbox2::Comms::kDefaultConnection);
|
||||
sandbox2::Client sandbox2_client(&comms);
|
||||
// Enable sandboxing from here.
|
||||
sandbox2_client.SandboxMeHere();
|
||||
|
|
|
@ -44,7 +44,7 @@ int main(int argc, char* argv[]) {
|
|||
gflags::ParseCommandLineFlags(&argc, &argv, false);
|
||||
|
||||
// Instantiate Comms channel with the parent Executor
|
||||
sandbox2::Comms comms(sandbox2::Comms::kSandbox2ClientCommsFD);
|
||||
sandbox2::Comms comms(sandbox2::Comms::kDefaultConnection);
|
||||
sandbox2::ForkingClient s2client(&comms);
|
||||
|
||||
for (;;) {
|
||||
|
|
|
@ -62,7 +62,7 @@ static bool CommunicationTest(int sock) {
|
|||
|
||||
int main(int argc, char* argv[]) {
|
||||
// Set-up the sandbox2::Client object, using a file descriptor (1023).
|
||||
sandbox2::Comms comms(sandbox2::Comms::kSandbox2ClientCommsFD);
|
||||
sandbox2::Comms comms(sandbox2::Comms::kDefaultConnection);
|
||||
sandbox2::Client sandbox2_client(&comms);
|
||||
// Enable sandboxing from here.
|
||||
sandbox2_client.SandboxMeHere();
|
||||
|
|
|
@ -108,7 +108,7 @@ int main(int argc, char* argv[]) {
|
|||
gflags::ParseCommandLineFlags(&argc, &argv, false);
|
||||
|
||||
// Set-up the sandbox2::Client object, using a file descriptor (1023).
|
||||
sandbox2::Comms comms(sandbox2::Comms::kSandbox2ClientCommsFD);
|
||||
sandbox2::Comms comms(sandbox2::Comms::kDefaultConnection);
|
||||
sandbox2::Client sandbox2_client(&comms);
|
||||
|
||||
// Enable sandboxing from here.
|
||||
|
|
|
@ -346,7 +346,7 @@ void ForkServer::LaunchChild(const ForkRequest& request, int execve_fd,
|
|||
// Create a Comms object here and not above, as we know we will execve and
|
||||
// therefore not call the Comms destructor, which would otherwise close the
|
||||
// comms file descriptor, which we do not want for the general case.
|
||||
Comms client_comms(Comms::kSandbox2ClientCommsFD);
|
||||
Comms client_comms(Comms::kDefaultConnection);
|
||||
Client c(&client_comms);
|
||||
|
||||
// The following client calls are basically SandboxMeHere. We split it so
|
||||
|
|
|
@ -59,7 +59,7 @@ int main() {
|
|||
SAPI_RAW_PLOG(WARNING, "sigaction(SIGTERM, sa_handler=SIG_IGN)");
|
||||
}
|
||||
|
||||
sandbox2::Comms comms(sandbox2::Comms::kSandbox2ClientCommsFD);
|
||||
sandbox2::Comms comms(sandbox2::Comms::kDefaultConnection);
|
||||
sandbox2::ForkServer fork_server(&comms);
|
||||
|
||||
while (true) {
|
||||
|
|
|
@ -46,7 +46,7 @@ int main(int argc, char* argv[]) {
|
|||
}
|
||||
|
||||
case 2: { // Send and receive FD
|
||||
sandbox2::Comms comms(sandbox2::Comms::kSandbox2ClientCommsFD);
|
||||
sandbox2::Comms comms(sandbox2::Comms::kDefaultConnection);
|
||||
int fd;
|
||||
if (!comms.RecvFD(&fd)) {
|
||||
return EXIT_FAILURE;
|
||||
|
|
|
@ -30,8 +30,8 @@ int main(int argc, char* argv[]) {
|
|||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
sandbox2::Comms sb_comms(sandbox2::Comms::kSandbox2ClientCommsFD);
|
||||
sandbox2::Client client(&sb_comms);
|
||||
sandbox2::Comms default_comms(sandbox2::Comms::kDefaultConnection);
|
||||
sandbox2::Client client(&default_comms);
|
||||
|
||||
int testno;
|
||||
SAPI_RAW_CHECK(absl::SimpleAtoi(argv[1], &testno), "testno is not a number");
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#include "sandboxed_api/util/raw_logging.h"
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
sandbox2::Comms comms(sandbox2::Comms::kSandbox2ClientCommsFD);
|
||||
sandbox2::Comms comms(sandbox2::Comms::kDefaultConnection);
|
||||
|
||||
// Exchange data with sandbox sandbox (parent) before sandboxing is enabled.
|
||||
SAPI_RAW_CHECK(comms.SendBool(true), "Sending data to the executor");
|
||||
|
|
|
@ -51,7 +51,7 @@ int main(int argc, char* argv[]) {
|
|||
// Wait to make sure that the sleepy-thread is up and running.
|
||||
pthread_barrier_wait(&g_barrier);
|
||||
|
||||
sandbox2::Comms comms(sandbox2::Comms::kSandbox2ClientCommsFD);
|
||||
sandbox2::Comms comms(sandbox2::Comms::kDefaultConnection);
|
||||
sandbox2::Client sandbox2_client(&comms);
|
||||
sandbox2_client.SandboxMeHere();
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user