OLD | NEW |
1 // Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 1 // Copyright (c) 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 <stdio.h> | 5 #include <stdio.h> |
6 #include <iostream> | 6 #include <iostream> |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include <base/command_line.h> | 9 #include <base/command_line.h> |
10 #include <base/file_util.h> | 10 #include <base/file_util.h> |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 | 49 |
50 // Syslogging is enabled by default if stdout is not a tty. These flags can | 50 // Syslogging is enabled by default if stdout is not a tty. These flags can |
51 // be used to override the default logic. | 51 // be used to override the default logic. |
52 static const char *kEnableSyslog = "enable-syslog"; | 52 static const char *kEnableSyslog = "enable-syslog"; |
53 static const char *kDisableSyslog = "disable-syslog"; | 53 static const char *kDisableSyslog = "disable-syslog"; |
54 | 54 |
55 static const char *kLibcrosLocation = "libcros-location"; | 55 static const char *kLibcrosLocation = "libcros-location"; |
56 | 56 |
57 static const char *kCallbackOrigin = "callback-origin"; | 57 static const char *kCallbackOrigin = "callback-origin"; |
58 | 58 |
| 59 static const char *kSessionId = "session-id"; |
| 60 |
59 } // namespace switches | 61 } // namespace switches |
60 | 62 |
61 // Return values: | 63 // Return values: |
62 // 0: Entd completed successfully and should not be restarted. | 64 // 0: Entd completed successfully and should not be restarted. |
63 // 1: Entd encountered a failure, but will probably fail again if restarted, | 65 // 1: Entd encountered a failure, but will probably fail again if restarted, |
64 // so please don't. | 66 // so please don't. |
65 // 2: Entd has NOT encountered a failure, but would like to be restarted. | 67 // 2: Entd has NOT encountered a failure, but would like to be restarted. |
66 // >2: Entd has encountered a failure, restarting may help. | 68 // >2: Entd has encountered a failure, restarting may help. |
67 // | 69 // |
68 // So, exit with a zero or one means leave it down, otherwise restart. | 70 // So, exit with a zero or one means leave it down, otherwise restart. |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 entd::Pkcs11::enable_opencryptoki = false; | 159 entd::Pkcs11::enable_opencryptoki = false; |
158 } | 160 } |
159 | 161 |
160 if (cl->HasSwitch(switches::kCallbackOrigin)) { | 162 if (cl->HasSwitch(switches::kCallbackOrigin)) { |
161 entd::CallbackServer::required_origin = cl->GetSwitchValueASCII( | 163 entd::CallbackServer::required_origin = cl->GetSwitchValueASCII( |
162 switches::kCallbackOrigin); | 164 switches::kCallbackOrigin); |
163 LOG(INFO) << "Setting callback origin: " << | 165 LOG(INFO) << "Setting callback origin: " << |
164 entd::CallbackServer::required_origin; | 166 entd::CallbackServer::required_origin; |
165 } | 167 } |
166 | 168 |
| 169 if (cl->HasSwitch(switches::kSessionId)) { |
| 170 entd::CallbackServer::set_session_id(cl->GetSwitchValueASCII( |
| 171 switches::kSessionId)); |
| 172 LOG(INFO) << "Setting session id: " << |
| 173 entd::CallbackServer::session_id(); |
| 174 } |
| 175 |
167 entd::Entd d; | 176 entd::Entd d; |
168 d.Initialize(); | 177 d.Initialize(); |
169 | 178 |
170 if (!username.empty()) | 179 if (!username.empty()) |
171 d.SetUsername(username); | 180 d.SetUsername(username); |
172 | 181 |
173 if (!utility.empty()) | 182 if (!utility.empty()) |
174 d.SetUtilityFile(utility); | 183 d.SetUtilityFile(utility); |
175 | 184 |
176 if (!manifest.empty()) | 185 if (!manifest.empty()) |
177 d.SetManifestFile(manifest); | 186 d.SetManifestFile(manifest); |
178 | 187 |
179 if (!policy.empty()) | 188 if (!policy.empty()) |
180 d.SetPolicyFile(policy); | 189 d.SetPolicyFile(policy); |
181 | 190 |
182 uint32_t rv = d.Run(); | 191 uint32_t rv = d.Run(); |
183 LOG(INFO) << "Exiting entd with code: " << rv; | 192 LOG(INFO) << "Exiting entd with code: " << rv; |
184 return rv; | 193 return rv; |
185 } | 194 } |
OLD | NEW |