Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(36)

Side by Side Diff: remoting/host/win/host_service.cc

Issue 14188045: Do not use the mandatory label in when generating security descriptors on Windows XP. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 // 4 //
5 // This file implements the Windows service controlling Me2Me host processes 5 // This file implements the Windows service controlling Me2Me host processes
6 // running within user sessions. 6 // running within user sessions.
7 7
8 #include "remoting/host/win/host_service.h" 8 #include "remoting/host/win/host_service.h"
9 9
10 #include <sddl.h> 10 #include <sddl.h>
11 #include <windows.h> 11 #include <windows.h>
12 #include <wtsapi32.h> 12 #include <wtsapi32.h>
13 13
14 #include "base/base_paths.h" 14 #include "base/base_paths.h"
15 #include "base/base_switches.h" 15 #include "base/base_switches.h"
16 #include "base/bind.h" 16 #include "base/bind.h"
17 #include "base/command_line.h" 17 #include "base/command_line.h"
18 #include "base/files/file_path.h" 18 #include "base/files/file_path.h"
19 #include "base/message_loop.h" 19 #include "base/message_loop.h"
20 #include "base/run_loop.h" 20 #include "base/run_loop.h"
21 #include "base/single_thread_task_runner.h" 21 #include "base/single_thread_task_runner.h"
22 #include "base/threading/thread.h" 22 #include "base/threading/thread.h"
23 #include "base/utf_string_conversions.h" 23 #include "base/utf_string_conversions.h"
24 #include "base/win/scoped_com_initializer.h" 24 #include "base/win/scoped_com_initializer.h"
25 #include "base/win/windows_version.h"
25 #include "remoting/base/auto_thread.h" 26 #include "remoting/base/auto_thread.h"
26 #include "remoting/base/scoped_sc_handle_win.h" 27 #include "remoting/base/scoped_sc_handle_win.h"
27 #include "remoting/base/stoppable.h" 28 #include "remoting/base/stoppable.h"
28 #include "remoting/host/branding.h" 29 #include "remoting/host/branding.h"
29 #include "remoting/host/host_exit_codes.h" 30 #include "remoting/host/host_exit_codes.h"
30 #include "remoting/host/logging.h" 31 #include "remoting/host/logging.h"
31 #include "remoting/host/win/security_descriptor.h" 32 #include "remoting/host/win/security_descriptor.h"
32 33
33 #if defined(REMOTING_MULTI_PROCESS) 34 #if defined(REMOTING_MULTI_PROCESS)
34 #include "remoting/host/daemon_process.h" 35 #include "remoting/host/daemon_process.h"
(...skipping 19 matching lines...) Expand all
54 55
55 // Concatenates ACE type, permissions and sid given as SDDL strings into an ACE 56 // Concatenates ACE type, permissions and sid given as SDDL strings into an ACE
56 // definition in SDDL form. 57 // definition in SDDL form.
57 #define SDDL_ACE(type, permissions, sid) \ 58 #define SDDL_ACE(type, permissions, sid) \
58 L"(" type L";;" permissions L";;;" sid L")" 59 L"(" type L";;" permissions L";;;" sid L")"
59 60
60 // Text representation of COM_RIGHTS_EXECUTE and COM_RIGHTS_EXECUTE_LOCAL 61 // Text representation of COM_RIGHTS_EXECUTE and COM_RIGHTS_EXECUTE_LOCAL
61 // permission bits that is used in the SDDL definition below. 62 // permission bits that is used in the SDDL definition below.
62 #define SDDL_COM_EXECUTE_LOCAL L"0x3" 63 #define SDDL_COM_EXECUTE_LOCAL L"0x3"
63 64
64 // A security descriptor allowing local processes running under SYSTEM or 65 // Security descriptor allowing local processes running under SYSTEM or
65 // LocalService accounts at medium integrity level or higher to call COM 66 // LocalService accounts to call COM methods exposed by the daemon.
66 // methods exposed by the daemon.
67 const wchar_t kComProcessSd[] = 67 const wchar_t kComProcessSd[] =
68 SDDL_OWNER L":" SDDL_LOCAL_SYSTEM 68 SDDL_OWNER L":" SDDL_LOCAL_SYSTEM
69 SDDL_GROUP L":" SDDL_LOCAL_SYSTEM 69 SDDL_GROUP L":" SDDL_LOCAL_SYSTEM
70 SDDL_DACL L":" 70 SDDL_DACL L":"
71 SDDL_ACE(SDDL_ACCESS_ALLOWED, SDDL_COM_EXECUTE_LOCAL, SDDL_LOCAL_SYSTEM) 71 SDDL_ACE(SDDL_ACCESS_ALLOWED, SDDL_COM_EXECUTE_LOCAL, SDDL_LOCAL_SYSTEM)
72 SDDL_ACE(SDDL_ACCESS_ALLOWED, SDDL_COM_EXECUTE_LOCAL, SDDL_LOCAL_SERVICE) 72 SDDL_ACE(SDDL_ACCESS_ALLOWED, SDDL_COM_EXECUTE_LOCAL, SDDL_LOCAL_SERVICE);
73
74 // Appended to |kComProcessSd| to specify that only callers running at medium or
75 // higher integrity level are allowed to call COM methods exposed by the daemon.
76 const wchar_t kComProcessMandatoryLabel[] =
73 SDDL_SACL L":" 77 SDDL_SACL L":"
74 SDDL_ACE(SDDL_MANDATORY_LABEL, SDDL_NO_EXECUTE_UP, SDDL_ML_MEDIUM); 78 SDDL_ACE(SDDL_MANDATORY_LABEL, SDDL_NO_EXECUTE_UP, SDDL_ML_MEDIUM);
75 79
76 #undef SDDL_ACE 80 #undef SDDL_ACE
77 #undef SDDL_COM_EXECUTE_LOCAL 81 #undef SDDL_COM_EXECUTE_LOCAL
78 82
79 // Allows incoming calls from clients running under SYSTEM or LocalService at 83 // Allows incoming calls from clients running under SYSTEM or LocalService at
80 // medium integrity level. 84 // medium integrity level.
81 bool InitializeComSecurity() { 85 bool InitializeComSecurity() {
86 std::string sddl = WideToUTF8(kComProcessSd);
87 if (base::win::GetVersion() >= base::win::VERSION_VISTA) {
88 sddl += WideToUTF8(kComProcessMandatoryLabel);
89 }
90
82 // Convert the SDDL description into a security descriptor in absolute format. 91 // Convert the SDDL description into a security descriptor in absolute format.
83 ScopedSd relative_sd = ConvertSddlToSd(WideToUTF8(kComProcessSd)); 92 ScopedSd relative_sd = ConvertSddlToSd(sddl);
84 if (!relative_sd) { 93 if (!relative_sd) {
85 LOG_GETLASTERROR(ERROR) << "Failed to create a security descriptor"; 94 LOG_GETLASTERROR(ERROR) << "Failed to create a security descriptor";
86 return false; 95 return false;
87 } 96 }
88 ScopedSd absolute_sd; 97 ScopedSd absolute_sd;
89 ScopedAcl dacl; 98 ScopedAcl dacl;
90 ScopedSid group; 99 ScopedSid group;
91 ScopedSid owner; 100 ScopedSid owner;
92 ScopedAcl sacl; 101 ScopedAcl sacl;
93 if (!MakeScopedAbsoluteSd(relative_sd, &absolute_sd, &dacl, &group, &owner, 102 if (!MakeScopedAbsoluteSd(relative_sd, &absolute_sd, &dacl, &group, &owner,
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after
503 int DaemonProcessMain() { 512 int DaemonProcessMain() {
504 HostService* service = HostService::GetInstance(); 513 HostService* service = HostService::GetInstance();
505 if (!service->InitWithCommandLine(CommandLine::ForCurrentProcess())) { 514 if (!service->InitWithCommandLine(CommandLine::ForCurrentProcess())) {
506 return kUsageExitCode; 515 return kUsageExitCode;
507 } 516 }
508 517
509 return service->Run(); 518 return service->Run();
510 } 519 }
511 520
512 } // namespace remoting 521 } // namespace remoting
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698