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

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

Issue 12378078: Initialize COM and configure security settings in the daemon. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: CR feedback Created 7 years, 9 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 | « remoting/host/win/security_descriptor.h ('k') | 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 #include "remoting/host/win/security_descriptor.h" 5 #include "remoting/host/win/security_descriptor.h"
6 6
7 #include <sddl.h> 7 #include <sddl.h>
8 8
9 #include "base/string16.h" 9 #include "base/string16.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 if (!CopySid(length, logon_sid.get(), groups->Groups[i].Sid)) 58 if (!CopySid(length, logon_sid.get(), groups->Groups[i].Sid))
59 return ScopedSid(); 59 return ScopedSid();
60 60
61 return logon_sid.Pass(); 61 return logon_sid.Pass();
62 } 62 }
63 } 63 }
64 64
65 return ScopedSid(); 65 return ScopedSid();
66 } 66 }
67 67
68 bool MakeScopedAbsoluteSd(const ScopedSd& relative_sd,
69 ScopedSd* absolute_sd,
70 ScopedAcl* dacl,
71 ScopedSid* group,
72 ScopedSid* owner,
73 ScopedAcl* sacl) {
74 // Get buffer sizes.
75 DWORD absolute_sd_size = 0;
76 DWORD dacl_size = 0;
77 DWORD group_size = 0;
78 DWORD owner_size = 0;
79 DWORD sacl_size = 0;
80 if (MakeAbsoluteSD(relative_sd.get(),
81 NULL,
82 &absolute_sd_size,
83 NULL,
84 &dacl_size,
85 NULL,
86 &sacl_size,
87 NULL,
88 &owner_size,
89 NULL,
90 &group_size) ||
91 GetLastError() != ERROR_INSUFFICIENT_BUFFER) {
92 return false;
93 }
94
95 // Allocate buffers.
96 ScopedSd local_absolute_sd(absolute_sd_size);
97 ScopedAcl local_dacl(dacl_size);
98 ScopedSid local_group(group_size);
99 ScopedSid local_owner(owner_size);
100 ScopedAcl local_sacl(sacl_size);
101
102 // Do the conversion.
103 if (!MakeAbsoluteSD(relative_sd.get(),
104 local_absolute_sd.get(),
105 &absolute_sd_size,
106 local_dacl.get(),
107 &dacl_size,
108 local_sacl.get(),
109 &sacl_size,
110 local_owner.get(),
111 &owner_size,
112 local_group.get(),
113 &group_size)) {
114 return false;
115 }
116
117 absolute_sd->Swap(local_absolute_sd);
118 dacl->Swap(local_dacl);
119 group->Swap(local_group);
120 owner->Swap(local_owner);
121 sacl->Swap(local_sacl);
122 return true;
123 }
124
68 } // namespace remoting 125 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/win/security_descriptor.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698