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

Unified 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, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « remoting/host/win/security_descriptor.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/host/win/security_descriptor.cc
diff --git a/remoting/host/win/security_descriptor.cc b/remoting/host/win/security_descriptor.cc
index 60e10124f7c77567b646fc272eddee476c1b044b..1f535053d93df3679ac707d72c371174a0f5fd45 100644
--- a/remoting/host/win/security_descriptor.cc
+++ b/remoting/host/win/security_descriptor.cc
@@ -65,4 +65,61 @@ ScopedSid GetLogonSid(HANDLE token) {
return ScopedSid();
}
+bool MakeScopedAbsoluteSd(const ScopedSd& relative_sd,
+ ScopedSd* absolute_sd,
+ ScopedAcl* dacl,
+ ScopedSid* group,
+ ScopedSid* owner,
+ ScopedAcl* sacl) {
+ // Get buffer sizes.
+ DWORD absolute_sd_size = 0;
+ DWORD dacl_size = 0;
+ DWORD group_size = 0;
+ DWORD owner_size = 0;
+ DWORD sacl_size = 0;
+ if (MakeAbsoluteSD(relative_sd.get(),
+ NULL,
+ &absolute_sd_size,
+ NULL,
+ &dacl_size,
+ NULL,
+ &sacl_size,
+ NULL,
+ &owner_size,
+ NULL,
+ &group_size) ||
+ GetLastError() != ERROR_INSUFFICIENT_BUFFER) {
+ return false;
+ }
+
+ // Allocate buffers.
+ ScopedSd local_absolute_sd(absolute_sd_size);
+ ScopedAcl local_dacl(dacl_size);
+ ScopedSid local_group(group_size);
+ ScopedSid local_owner(owner_size);
+ ScopedAcl local_sacl(sacl_size);
+
+ // Do the conversion.
+ if (!MakeAbsoluteSD(relative_sd.get(),
+ local_absolute_sd.get(),
+ &absolute_sd_size,
+ local_dacl.get(),
+ &dacl_size,
+ local_sacl.get(),
+ &sacl_size,
+ local_owner.get(),
+ &owner_size,
+ local_group.get(),
+ &group_size)) {
+ return false;
+ }
+
+ absolute_sd->Swap(local_absolute_sd);
+ dacl->Swap(local_dacl);
+ group->Swap(local_group);
+ owner->Swap(local_owner);
+ sacl->Swap(local_sacl);
+ return true;
+}
+
} // namespace remoting
« 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