1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/security/sandbox/win/src/sync_policy.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,51 @@ 1.4 +// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1.5 +// Use of this source code is governed by a BSD-style license that can be 1.6 +// found in the LICENSE file. 1.7 + 1.8 +#ifndef SANDBOX_SRC_SYNC_POLICY_H__ 1.9 +#define SANDBOX_SRC_SYNC_POLICY_H__ 1.10 + 1.11 +#include <string> 1.12 + 1.13 +#include "base/basictypes.h" 1.14 +#include "sandbox/win/src/crosscall_server.h" 1.15 +#include "sandbox/win/src/nt_internals.h" 1.16 +#include "sandbox/win/src/policy_low_level.h" 1.17 +#include "sandbox/win/src/sandbox_policy.h" 1.18 + 1.19 +namespace sandbox { 1.20 + 1.21 +enum EvalResult; 1.22 + 1.23 +// This class centralizes most of the knowledge related to sync policy 1.24 +class SyncPolicy { 1.25 + public: 1.26 + // Creates the required low-level policy rules to evaluate a high-level 1.27 + // policy rule for sync calls, in particular open or create actions. 1.28 + // name is the sync object name, semantics is the desired semantics for the 1.29 + // open or create and policy is the policy generator to which the rules are 1.30 + // going to be added. 1.31 + static bool GenerateRules(const wchar_t* name, 1.32 + TargetPolicy::Semantics semantics, 1.33 + LowLevelPolicy* policy); 1.34 + 1.35 + // Performs the desired policy action on a request. 1.36 + // client_info is the target process that is making the request and 1.37 + // eval_result is the desired policy action to accomplish. 1.38 + static DWORD CreateEventAction(EvalResult eval_result, 1.39 + const ClientInfo& client_info, 1.40 + const std::wstring &event_name, 1.41 + uint32 manual_reset, 1.42 + uint32 initial_state, 1.43 + HANDLE *handle); 1.44 + static DWORD OpenEventAction(EvalResult eval_result, 1.45 + const ClientInfo& client_info, 1.46 + const std::wstring &event_name, 1.47 + uint32 desired_access, 1.48 + uint32 inherit_handle, 1.49 + HANDLE *handle); 1.50 +}; 1.51 + 1.52 +} // namespace sandbox 1.53 + 1.54 +#endif // SANDBOX_SRC_SYNC_POLICY_H__