OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #include "remoting/host/win/com_security.h" | 5 #include "remoting/host/win/com_security.h" |
6 | 6 |
7 #include <objidl.h> | 7 #include <objidl.h> |
8 | 8 |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "base/win/windows_version.h" | |
12 #include "remoting/host/win/security_descriptor.h" | 11 #include "remoting/host/win/security_descriptor.h" |
13 | 12 |
14 namespace remoting { | 13 namespace remoting { |
15 | 14 |
16 bool InitializeComSecurity(const std::string& security_descriptor, | 15 bool InitializeComSecurity(const std::string& security_descriptor, |
17 const std::string& mandatory_label, | 16 const std::string& mandatory_label, |
18 bool activate_as_activator) { | 17 bool activate_as_activator) { |
19 std::string sddl = security_descriptor; | 18 std::string sddl = security_descriptor + mandatory_label; |
20 if (base::win::GetVersion() >= base::win::VERSION_VISTA) { | |
21 sddl += mandatory_label; | |
22 } | |
23 | 19 |
24 // Convert the SDDL description into a security descriptor in absolute format. | 20 // Convert the SDDL description into a security descriptor in absolute format. |
25 ScopedSd relative_sd = ConvertSddlToSd(sddl); | 21 ScopedSd relative_sd = ConvertSddlToSd(sddl); |
26 if (!relative_sd) { | 22 if (!relative_sd) { |
27 PLOG(ERROR) << "Failed to create a security descriptor"; | 23 PLOG(ERROR) << "Failed to create a security descriptor"; |
28 return false; | 24 return false; |
29 } | 25 } |
30 ScopedSd absolute_sd; | 26 ScopedSd absolute_sd; |
31 ScopedAcl dacl; | 27 ScopedAcl dacl; |
32 ScopedSid group; | 28 ScopedSid group; |
(...skipping 24 matching lines...) Expand all Loading... |
57 if (FAILED(result)) { | 53 if (FAILED(result)) { |
58 LOG(ERROR) << "CoInitializeSecurity() failed, result=0x" | 54 LOG(ERROR) << "CoInitializeSecurity() failed, result=0x" |
59 << std::hex << result << std::dec << "."; | 55 << std::hex << result << std::dec << "."; |
60 return false; | 56 return false; |
61 } | 57 } |
62 | 58 |
63 return true; | 59 return true; |
64 } | 60 } |
65 | 61 |
66 } // namespace remoting | 62 } // namespace remoting |
OLD | NEW |