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

Side by Side Diff: child_job.cc

Issue 6882055: Revert "Add support for removing and adding --dom-login from arguments" (Closed) Base URL: http://git.chromium.org/git/login_manager.git@master
Patch Set: Created 9 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 | « child_job.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) 2009-2010 The Chromium OS Authors. All rights reserved. 1 // Copyright (c) 2009-2010 The Chromium OS 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 class is most definitely NOT re-entrant. 5 // This class is most definitely NOT re-entrant.
6 6
7 #include "login_manager/child_job.h" 7 #include "login_manager/child_job.h"
8 8
9 #include <errno.h> 9 #include <errno.h>
10 #include <glib.h> 10 #include <glib.h>
(...skipping 21 matching lines...) Expand all
32 const int ChildJobInterface::kCantSetGid = 128; 32 const int ChildJobInterface::kCantSetGid = 128;
33 const int ChildJobInterface::kCantSetGroups = 129; 33 const int ChildJobInterface::kCantSetGroups = 129;
34 const int ChildJobInterface::kCantExec = 255; 34 const int ChildJobInterface::kCantExec = 255;
35 const int ChildJobInterface::kBWSI = 1; 35 const int ChildJobInterface::kBWSI = 1;
36 36
37 // static 37 // static
38 const char ChildJob::kLoginManagerFlag[] = "--login-manager"; 38 const char ChildJob::kLoginManagerFlag[] = "--login-manager";
39 // static 39 // static
40 const char ChildJob::kLoginUserFlag[] = "--login-user="; 40 const char ChildJob::kLoginUserFlag[] = "--login-user=";
41 // static 41 // static
42 const char ChildJob::kDOMLoginFlag[] = "--dom-login";
43 // static
44 const char ChildJob::kBWSIFlag[] = "--bwsi"; 42 const char ChildJob::kBWSIFlag[] = "--bwsi";
45 // static 43 // static
46 const char ChildJob::kWindowManagerSuffix[] = "window-manager-session.sh"; 44 const char ChildJob::kWindowManagerSuffix[] = "window-manager-session.sh";
47 45
48 // static 46 // static
49 const int ChildJob::kRestartWindow = 1; 47 const int ChildJob::kRestartWindow = 1;
50 48
51 ChildJob::ChildJob(const std::vector<std::string>& arguments) 49 ChildJob::ChildJob(const std::vector<std::string>& arguments)
52 : arguments_(arguments), 50 : arguments_(arguments),
53 desired_uid_(0), 51 desired_uid_(0),
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 void ChildJob::StartSession(const std::string& email) { 98 void ChildJob::StartSession(const std::string& email) {
101 std::vector<std::string>::iterator to_erase = 99 std::vector<std::string>::iterator to_erase =
102 std::remove(arguments_.begin(), 100 std::remove(arguments_.begin(),
103 arguments_.end(), 101 arguments_.end(),
104 kLoginManagerFlag); 102 kLoginManagerFlag);
105 if (to_erase != arguments_.end()) { 103 if (to_erase != arguments_.end()) {
106 arguments_.erase(to_erase, arguments_.end()); 104 arguments_.erase(to_erase, arguments_.end());
107 removed_login_manager_flag_ = true; 105 removed_login_manager_flag_ = true;
108 } 106 }
109 107
110 to_erase = std::remove(arguments_.begin(),
111 arguments_.end(),
112 kDOMLoginFlag);
113 if (to_erase != arguments_.end()) {
114 arguments_.erase(to_erase, arguments_.end());
115 removed_dom_login_flag_ = true;
116 }
117
118 arguments_.push_back(kLoginUserFlag); 108 arguments_.push_back(kLoginUserFlag);
119 arguments_.back().append(email); 109 arguments_.back().append(email);
120 } 110 }
121 111
122 void ChildJob::StopSession() { 112 void ChildJob::StopSession() {
123 // The last element for started session is always login user flag. 113 // The last element for started session is always login user flag.
124 arguments_.pop_back(); 114 arguments_.pop_back();
125 if (removed_login_manager_flag_) { 115 if (removed_login_manager_flag_) {
126 arguments_.push_back(kLoginManagerFlag); 116 arguments_.push_back(kLoginManagerFlag);
127 removed_login_manager_flag_ = false; 117 removed_login_manager_flag_ = false;
128 } 118 }
129
130 if (removed_dom_login_flag_) {
131 arguments_.push_back(kDOMLoginFlag);
132 removed_dom_login_flag_ = false;
133 }
134
135 } 119 }
136 120
137 uid_t ChildJob::GetDesiredUid() const { 121 uid_t ChildJob::GetDesiredUid() const {
138 DCHECK(IsDesiredUidSet()); 122 DCHECK(IsDesiredUidSet());
139 return desired_uid_; 123 return desired_uid_;
140 } 124 }
141 125
142 void ChildJob::SetDesiredUid(uid_t uid) { 126 void ChildJob::SetDesiredUid(uid_t uid) {
143 is_desired_uid_set_ = true; 127 is_desired_uid_set_ = true;
144 desired_uid_ = uid; 128 desired_uid_ = uid;
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 to_return = kCantSetGid; 203 to_return = kCantSetGid;
220 if (setuid(desired_uid_) == -1) 204 if (setuid(desired_uid_) == -1)
221 to_return = kCantSetUid; 205 to_return = kCantSetUid;
222 } 206 }
223 if (setsid() == -1) 207 if (setsid() == -1)
224 LOG(ERROR) << "can't setsid: " << strerror(errno); 208 LOG(ERROR) << "can't setsid: " << strerror(errno);
225 return to_return; 209 return to_return;
226 } 210 }
227 211
228 } // namespace login_manager 212 } // namespace login_manager
OLDNEW
« no previous file with comments | « child_job.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698