OLD | NEW |
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/setup/start_host_main.h" | 5 #include "remoting/host/setup/start_host_main.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdio.h> | 8 #include <stdio.h> |
9 | 9 |
10 #include "base/at_exit.h" | 10 #include "base/at_exit.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 #include "remoting/base/url_request_context_getter.h" | 24 #include "remoting/base/url_request_context_getter.h" |
25 #include "remoting/host/setup/host_starter.h" | 25 #include "remoting/host/setup/host_starter.h" |
26 #include "remoting/host/setup/pin_validator.h" | 26 #include "remoting/host/setup/pin_validator.h" |
27 | 27 |
28 #if defined(OS_POSIX) | 28 #if defined(OS_POSIX) |
29 #include <termios.h> | 29 #include <termios.h> |
30 #include <unistd.h> | 30 #include <unistd.h> |
31 #endif // defined(OS_POSIX) | 31 #endif // defined(OS_POSIX) |
32 | 32 |
33 #if defined(OS_WIN) | 33 #if defined(OS_WIN) |
34 #include "remoting/host/win/elevation_helpers.h" | 34 #include "base/process/process_info.h" |
35 #endif // defined(OS_WIN) | 35 #endif // defined(OS_WIN) |
36 | 36 |
37 namespace remoting { | 37 namespace remoting { |
38 | 38 |
39 namespace { | 39 namespace { |
40 | 40 |
41 // True if the host was started successfully. | 41 // True if the host was started successfully. |
42 bool g_started = false; | 42 bool g_started = false; |
43 | 43 |
44 // The main message loop. | 44 // The main message loop. |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 // This is because start_host should be run in user mode. | 144 // This is because start_host should be run in user mode. |
145 if (geteuid() == 0) { | 145 if (geteuid() == 0) { |
146 fprintf(stderr, "Refusing to run %s as root.", argv[0]); | 146 fprintf(stderr, "Refusing to run %s as root.", argv[0]); |
147 return 1; | 147 return 1; |
148 } | 148 } |
149 #endif // defined(OS_POSIX) | 149 #endif // defined(OS_POSIX) |
150 | 150 |
151 #if defined(OS_WIN) | 151 #if defined(OS_WIN) |
152 // The tool must be run elevated on Windows so the host has access to the | 152 // The tool must be run elevated on Windows so the host has access to the |
153 // directories used to store the configuration JSON files. | 153 // directories used to store the configuration JSON files. |
154 if (!remoting::IsProcessElevated()) { | 154 if (!base::IsCurrentProcessElevated()) { |
155 fprintf(stderr, "Error: %s must be run as an elevated process.", argv[0]); | 155 fprintf(stderr, "Error: %s must be run as an elevated process.", argv[0]); |
156 return 1; | 156 return 1; |
157 } | 157 } |
158 #endif // defined(OS_WIN) | 158 #endif // defined(OS_WIN) |
159 | 159 |
160 if (command_line->HasSwitch("help") || command_line->HasSwitch("h") || | 160 if (command_line->HasSwitch("help") || command_line->HasSwitch("h") || |
161 command_line->HasSwitch("?") || !command_line->GetArgs().empty()) { | 161 command_line->HasSwitch("?") || !command_line->GetArgs().empty()) { |
162 fprintf(stderr, | 162 fprintf(stderr, |
163 "Usage: %s [--name=<hostname>] [--code=<auth-code>] [--pin=<PIN>] " | 163 "Usage: %s [--name=<hostname>] [--code=<auth-code>] [--pin=<PIN>] " |
164 "[--redirect-url=<redirectURL>]\n", | 164 "[--redirect-url=<redirectURL>]\n", |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 // IO thread. | 245 // IO thread. |
246 host_starter.reset(); | 246 host_starter.reset(); |
247 url_request_context_getter = nullptr; | 247 url_request_context_getter = nullptr; |
248 | 248 |
249 io_thread.Stop(); | 249 io_thread.Stop(); |
250 | 250 |
251 return g_started ? 0 : 1; | 251 return g_started ? 0 : 1; |
252 } | 252 } |
253 | 253 |
254 } // namespace remoting | 254 } // namespace remoting |
OLD | NEW |