| 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 <syslog.h> | 6 #include <syslog.h> |
| 7 | 7 |
| 8 // syslog.h and base/logging.h both try to #define LOG_INFO and LOG_WARNING. | 8 // syslog.h and base/logging.h both try to #define LOG_INFO and LOG_WARNING. |
| 9 // We need to #undef at least these two before including base/logging.h. The | 9 // We need to #undef at least these two before including base/logging.h. The |
| 10 // others are included to be consistent. | 10 // others are included to be consistent. |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 // User Name | 39 // User Name |
| 40 static const char *kUsername = "username"; | 40 static const char *kUsername = "username"; |
| 41 | 41 |
| 42 // Policy files | 42 // Policy files |
| 43 static const char *kManifest = "manifest"; | 43 static const char *kManifest = "manifest"; |
| 44 static const char *kPolicy = "policy"; | 44 static const char *kPolicy = "policy"; |
| 45 static const char *kUtility = "utility"; | 45 static const char *kUtility = "utility"; |
| 46 | 46 |
| 47 // Specify how to setup the pkcs11 interface | 47 // Specify how to setup the pkcs11 interface |
| 48 static const char *kPkcs11 = "pkcs11"; | 48 static const char *kPkcs11 = "pkcs11"; |
| 49 static const char *kOpenSSLConf = "openssl-conf"; | |
| 50 | 49 |
| 51 // Root CA for HTTPS requests. | 50 // Root CA for HTTPS requests. |
| 52 static const char *kRootCAFile = "root-ca-file"; | 51 static const char *kRootCAFile = "root-ca-file"; |
| 53 | 52 |
| 54 // If specified, then self-signed server certs are ok for HTTPS | 53 // If specified, then self-signed server certs are ok for HTTPS |
| 55 static const char *kAllowSelfSigned = "allow-self-signed"; | 54 static const char *kAllowSelfSigned = "allow-self-signed"; |
| 56 | 55 |
| 57 // If specified, then file operations are allowed (e.g. for testing) | 56 // If specified, then file operations are allowed (e.g. for testing) |
| 58 static const char *kAllowFileIO = "allow-file-io"; | 57 static const char *kAllowFileIO = "allow-file-io"; |
| 59 | 58 |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 logging::SetLogMessageHandler(handle_message); | 123 logging::SetLogMessageHandler(handle_message); |
| 125 } | 124 } |
| 126 | 125 |
| 127 LOG(INFO) << "Starting entd"; | 126 LOG(INFO) << "Starting entd"; |
| 128 | 127 |
| 129 std::string base_extension_path = | 128 std::string base_extension_path = |
| 130 cl->GetSwitchValueASCII(switches::kExtensionPath); | 129 cl->GetSwitchValueASCII(switches::kExtensionPath); |
| 131 std::string username = cl->GetSwitchValueASCII(switches::kUsername); | 130 std::string username = cl->GetSwitchValueASCII(switches::kUsername); |
| 132 std::string root_ca_file = cl->GetSwitchValueASCII(switches::kRootCAFile); | 131 std::string root_ca_file = cl->GetSwitchValueASCII(switches::kRootCAFile); |
| 133 std::string pkcs11_mode = cl->GetSwitchValueASCII(switches::kPkcs11); | 132 std::string pkcs11_mode = cl->GetSwitchValueASCII(switches::kPkcs11); |
| 134 std::string openssl_conf = cl->GetSwitchValueASCII(switches::kOpenSSLConf); | |
| 135 | 133 |
| 136 // Get file paths from a valid policy extension if it exists | 134 // Get file paths from a valid policy extension if it exists |
| 137 std::string extension_path; | 135 std::string extension_path; |
| 138 bool valid_policy = false; | 136 bool valid_policy = false; |
| 139 if (!base_extension_path.empty()) { | 137 if (!base_extension_path.empty()) { |
| 140 valid_policy = entd::extensions::FindValidPolicy(base_extension_path, | 138 valid_policy = entd::extensions::FindValidPolicy(base_extension_path, |
| 141 &extension_path); | 139 &extension_path); |
| 142 } | 140 } |
| 143 | 141 |
| 144 if (valid_policy) { | 142 if (valid_policy) { |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 | 184 |
| 187 if (!manifest.empty()) | 185 if (!manifest.empty()) |
| 188 d.SetManifestFile(manifest); | 186 d.SetManifestFile(manifest); |
| 189 | 187 |
| 190 if (!policy.empty()) | 188 if (!policy.empty()) |
| 191 d.SetPolicyFile(policy); | 189 d.SetPolicyFile(policy); |
| 192 | 190 |
| 193 if (!pkcs11_mode.empty()) | 191 if (!pkcs11_mode.empty()) |
| 194 d.SetPkcs11Mode(pkcs11_mode); | 192 d.SetPkcs11Mode(pkcs11_mode); |
| 195 | 193 |
| 196 if (!openssl_conf.empty()) | |
| 197 d.SetPkcs11OpenSSLConfig(openssl_conf); | |
| 198 | |
| 199 uint32_t rv = d.Run(); | 194 uint32_t rv = d.Run(); |
| 200 LOG(INFO) << "Exiting entd with code: " << rv; | 195 LOG(INFO) << "Exiting entd with code: " << rv; |
| 201 return rv; | 196 return rv; |
| 202 } | 197 } |
| OLD | NEW |