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

Side by Side Diff: session_manager_main.cc

Issue 553016: port to use centralized constants files, and add input validation (Closed)
Patch Set: address shell injection, otehr comments (per wad) Created 10 years, 11 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 | « mock_system_utils.h ('k') | session_manager_service.h » ('j') | 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 #include <errno.h> 5 #include <errno.h>
6 #include <stdlib.h> 6 #include <stdlib.h>
7 #include <sys/types.h> 7 #include <sys/types.h>
8 #include <unistd.h> 8 #include <unistd.h>
9 9
10 #include <base/basictypes.h> 10 #include <base/basictypes.h>
11 #include <base/command_line.h> 11 #include <base/command_line.h>
12 #include <base/logging.h> 12 #include <base/logging.h>
13 #include <chromeos/dbus/dbus.h> 13 #include <chromeos/dbus/dbus.h>
14 #include <chromeos/glib/object.h> 14 #include <chromeos/glib/object.h>
15 15
16 #include "login_manager/child_job.h" 16 #include "login_manager/child_job.h"
17 #include "login_manager/file_checker.h" 17 #include "login_manager/file_checker.h"
18 #include "login_manager/session_manager_service.h" 18 #include "login_manager/session_manager_service.h"
19 #include "login_manager/system_utils.h"
19 20
20 // Watches a Chrome binary and restarts it when it crashes. 21 // Watches a Chrome binary and restarts it when it crashes.
21 // Can also create and watch a named pipe and respond to IPCs defined 22 // Can also create and watch a named pipe and respond to IPCs defined
22 // in ipc_messages.h 23 // in ipc_messages.h
23 // Usage: 24 // Usage:
24 // session_manager --uid=1000 --login --pipe=/path/to/pipe -- 25 // session_manager --uid=1000 --login --pipe=/path/to/pipe --
25 // /path/to/command [arg1 [arg2 [ . . . ] ] ] 26 // /path/to/command [arg1 [arg2 [ . . . ] ] ]
26 27
27 namespace switches { 28 namespace switches {
28 static const char kDisableChromeRestartFile[] = "disable-chrome-restart-file"; 29 static const char kDisableChromeRestartFile[] = "disable-chrome-restart-file";
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 81
81 login_manager::SetUidExecJob* child_job = 82 login_manager::SetUidExecJob* child_job =
82 new login_manager::SetUidExecJob(cl, 83 new login_manager::SetUidExecJob(cl,
83 new login_manager::FileChecker( 84 new login_manager::FileChecker(
84 magic_chrome_file.c_str()), 85 magic_chrome_file.c_str()),
85 add_login_flag); 86 add_login_flag);
86 if (set_uid) 87 if (set_uid)
87 child_job->set_uid(uid); 88 child_job->set_uid(uid);
88 89
89 ::g_type_init(); 90 ::g_type_init();
90 login_manager::SessionManagerService manager(child_job, 91 login_manager::SessionManagerService manager(child_job);
91 false); // FOR NOW.
92 92
93 LOG_IF(FATAL, !manager.Initialize()) << "Failed"; 93 LOG_IF(FATAL, !manager.Initialize()) << "Failed";
94 LOG_IF(FATAL, !manager.Register(chromeos::dbus::GetSystemBusConnection())) 94 LOG_IF(FATAL, !manager.Register(chromeos::dbus::GetSystemBusConnection()))
95 << "Failed"; 95 << "Failed";
96 LOG_IF(FATAL, !manager.Run()) << "Failed"; 96 LOG_IF(FATAL, !manager.Run()) << "Failed";
97 return 0; 97 return 0;
98 } 98 }
OLDNEW
« no previous file with comments | « mock_system_utils.h ('k') | session_manager_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698