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

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

Issue 1549493004: Use std::move() instead of .Pass() in remoting/host (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@move_not_pass
Patch Set: include <utility> Created 4 years, 12 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
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 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include "base/strings/string16.h" 10 #include "base/strings/string16.h"
11 #include "base/strings/utf_string_conversions.h" 11 #include "base/strings/utf_string_conversions.h"
12 12
13 namespace remoting { 13 namespace remoting {
14 14
15 ScopedSd ConvertSddlToSd(const std::string& sddl) { 15 ScopedSd ConvertSddlToSd(const std::string& sddl) {
16 PSECURITY_DESCRIPTOR raw_sd = nullptr; 16 PSECURITY_DESCRIPTOR raw_sd = nullptr;
17 ULONG length = 0; 17 ULONG length = 0;
18 if (!ConvertStringSecurityDescriptorToSecurityDescriptor( 18 if (!ConvertStringSecurityDescriptorToSecurityDescriptor(
19 base::UTF8ToUTF16(sddl).c_str(), SDDL_REVISION_1, &raw_sd, &length)) { 19 base::UTF8ToUTF16(sddl).c_str(), SDDL_REVISION_1, &raw_sd, &length)) {
20 return ScopedSd(); 20 return ScopedSd();
21 } 21 }
22 22
23 ScopedSd sd(length); 23 ScopedSd sd(length);
24 memcpy(sd.get(), raw_sd, length); 24 memcpy(sd.get(), raw_sd, length);
25 25
26 LocalFree(raw_sd); 26 LocalFree(raw_sd);
27 return sd.Pass(); 27 return sd;
28 } 28 }
29 29
30 // Converts a SID into a text string. 30 // Converts a SID into a text string.
31 std::string ConvertSidToString(SID* sid) { 31 std::string ConvertSidToString(SID* sid) {
32 base::char16* c_sid_string = nullptr; 32 base::char16* c_sid_string = nullptr;
33 if (!ConvertSidToStringSid(sid, &c_sid_string)) 33 if (!ConvertSidToStringSid(sid, &c_sid_string))
34 return std::string(); 34 return std::string();
35 35
36 base::string16 sid_string(c_sid_string); 36 base::string16 sid_string(c_sid_string);
37 LocalFree(c_sid_string); 37 LocalFree(c_sid_string);
(...skipping 14 matching lines...) Expand all
52 return ScopedSid(); 52 return ScopedSid();
53 53
54 for (uint32_t i = 0; i < groups->GroupCount; ++i) { 54 for (uint32_t i = 0; i < groups->GroupCount; ++i) {
55 if ((groups->Groups[i].Attributes & SE_GROUP_LOGON_ID) == 55 if ((groups->Groups[i].Attributes & SE_GROUP_LOGON_ID) ==
56 SE_GROUP_LOGON_ID) { 56 SE_GROUP_LOGON_ID) {
57 length = GetLengthSid(groups->Groups[i].Sid); 57 length = GetLengthSid(groups->Groups[i].Sid);
58 ScopedSid logon_sid(length); 58 ScopedSid logon_sid(length);
59 if (!CopySid(length, logon_sid.get(), groups->Groups[i].Sid)) 59 if (!CopySid(length, logon_sid.get(), groups->Groups[i].Sid))
60 return ScopedSid(); 60 return ScopedSid();
61 61
62 return logon_sid.Pass(); 62 return logon_sid;
63 } 63 }
64 } 64 }
65 65
66 return ScopedSid(); 66 return ScopedSid();
67 } 67 }
68 68
69 bool MakeScopedAbsoluteSd(const ScopedSd& relative_sd, 69 bool MakeScopedAbsoluteSd(const ScopedSd& relative_sd,
70 ScopedSd* absolute_sd, 70 ScopedSd* absolute_sd,
71 ScopedAcl* dacl, 71 ScopedAcl* dacl,
72 ScopedSid* group, 72 ScopedSid* group,
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 117
118 absolute_sd->Swap(local_absolute_sd); 118 absolute_sd->Swap(local_absolute_sd);
119 dacl->Swap(local_dacl); 119 dacl->Swap(local_dacl);
120 group->Swap(local_group); 120 group->Swap(local_group);
121 owner->Swap(local_owner); 121 owner->Swap(local_owner);
122 sacl->Swap(local_sacl); 122 sacl->Swap(local_sacl);
123 return true; 123 return true;
124 } 124 }
125 125
126 } // namespace remoting 126 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/win/launch_process_with_token.cc ('k') | remoting/host/win/session_desktop_environment.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698