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

Side by Side Diff: sandbox/linux/suid/sandbox.cc

Issue 149667: Fix sandbox define (Closed)
Patch Set: Created 11 years, 5 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
« no previous file with comments | « no previous file | 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 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 // http://code.google.com/p/chromium/wiki/LinuxSUIDSandbox 5 // http://code.google.com/p/chromium/wiki/LinuxSUIDSandbox
6 6
7 #include <asm/unistd.h> 7 #include <asm/unistd.h>
8 #include <errno.h> 8 #include <errno.h>
9 #include <fcntl.h> 9 #include <fcntl.h>
10 #include <sched.h> 10 #include <sched.h>
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 217
218 return true; 218 return true;
219 } 219 }
220 220
221 int main(int argc, char **argv) { 221 int main(int argc, char **argv) {
222 if (argc == 1) { 222 if (argc == 1) {
223 fprintf(stderr, "Usage: %s <renderer process> <args...>\n", argv[0]); 223 fprintf(stderr, "Usage: %s <renderer process> <args...>\n", argv[0]);
224 return 1; 224 return 1;
225 } 225 }
226 226
227 #if defined(DEVELOPMENT_SANDBOX) 227 #if defined(CHROME_DEVEL_SANDBOX)
228 // On development machines, we need the sandbox to be able to run development 228 // On development machines, we need the sandbox to be able to run development
229 // builds of Chrome. Thus, we remove the condition that the path to the 229 // builds of Chrome. Thus, we remove the condition that the path to the
230 // binary has to be fixed. However, we still worry about running arbitary 230 // binary has to be fixed. However, we still worry about running arbitary
231 // executables like this so we require that the owner of the binary be the 231 // executables like this so we require that the owner of the binary be the
232 // same as the real UID. 232 // same as the real UID.
233 const int binary_fd = open(argv[1], O_RDONLY); 233 const int binary_fd = open(argv[1], O_RDONLY);
234 if (binary_fd < 0) { 234 if (binary_fd < 0) {
235 fprintf(stderr, "Failed to open %s: %s\n", argv[1], strerror(errno)); 235 fprintf(stderr, "Failed to open %s: %s\n", argv[1], strerror(errno));
236 return 1; 236 return 1;
237 } 237 }
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 if (!SpawnChrootHelper()) 280 if (!SpawnChrootHelper())
281 return 1; 281 return 1;
282 if (!DropRoot()) 282 if (!DropRoot())
283 return 1; 283 return 1;
284 284
285 execv(argv[1], &argv[1]); 285 execv(argv[1], &argv[1]);
286 FatalError("execv failed"); 286 FatalError("execv failed");
287 287
288 return 1; 288 return 1;
289 } 289 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698