security/sandbox/win/src/sandbox.cc

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
     2 // Use of this source code is governed by a BSD-style license that can be
     3 // found in the LICENSE file.
     5 #include <stdio.h>
     6 #include <windows.h>
     7 #include "sandbox/win/src/sandbox.h"
     8 #include "sandbox/win/src/sandbox_factory.h"
     9 #include "sandbox/win/src/broker_services.h"
    10 #include "sandbox/win/src/target_services.h"
    12 namespace sandbox {
    13 // The section for IPC and policy.
    14 SANDBOX_INTERCEPT HANDLE  g_shared_section = NULL;
    16 static bool               s_is_broker =  false;
    18 // GetBrokerServices: the current implementation relies on a shared section
    19 // that is created by the broker and opened by the target.
    20 BrokerServices* SandboxFactory::GetBrokerServices() {
    21   // Can't be the broker if the shared section is open.
    22   if (NULL != g_shared_section) {
    23     return NULL;
    24   }
    25   // If the shared section does not exist we are the broker, then create
    26   // the broker object.
    27   s_is_broker = true;
    28   return BrokerServicesBase::GetInstance();
    29 }
    31 // GetTargetServices implementation must follow the same technique as the
    32 // GetBrokerServices, but in this case the logic is the opposite.
    33 TargetServices* SandboxFactory::GetTargetServices() {
    34   // Can't be the target if the section handle is not valid.
    35   if (NULL == g_shared_section) {
    36     return NULL;
    37   }
    38   // We are the target
    39   s_is_broker = false;
    40   // Creates and returns the target services implementation.
    41   return TargetServicesBase::GetInstance();
    42 }
    44 }  // namespace sandbox

mercurial