Commit 719b5841 authored by wez@chromium.org's avatar wez@chromium.org

Don't read Linux host configuration if binary is not on path.

BUG=125217


Review URL: http://codereview.chromium.org/10237012

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@134450 0039d316-1c4b-4281-b951-d872f2087c98
parent e0ffc6f8
...@@ -65,12 +65,10 @@ class DaemonController { ...@@ -65,12 +65,10 @@ class DaemonController {
// them in the webapp. // them in the webapp.
}; };
// The callback for GetConfig(). |config| is set to NULL in case of // Callback type for GetConfig(). If the host is configured then a dictionary
// an error. Otherwise it is a dictionary that contains only the // is returned containing host_id and xmpp_login, with security-sensitive
// following values: host_id and xmpp_login, which may be empty if // fields filtered out. An empty dictionary is returned if the host is not
// the host is not initialized yet. All other values are filtered out of the // configured, and NULL if the configuration is corrupt or cannot be read.
// config before this callback is invoked: they may contain security
// sensitive information, such as authentication tokens and private keys.
typedef base::Callback<void (scoped_ptr<base::DictionaryValue> config)> typedef base::Callback<void (scoped_ptr<base::DictionaryValue> config)>
GetConfigCallback; GetConfigCallback;
......
...@@ -192,17 +192,23 @@ FilePath DaemonControllerLinux::GetConfigPath() { ...@@ -192,17 +192,23 @@ FilePath DaemonControllerLinux::GetConfigPath() {
} }
void DaemonControllerLinux::DoGetConfig(const GetConfigCallback& callback) { void DaemonControllerLinux::DoGetConfig(const GetConfigCallback& callback) {
JsonHostConfig config(GetConfigPath()); scoped_ptr<base::DictionaryValue> result(new base::DictionaryValue());
scoped_ptr<base::DictionaryValue> result;
if (config.Read()) { if (GetState() != remoting::DaemonController::STATE_NOT_IMPLEMENTED) {
result.reset(new base::DictionaryValue()); JsonHostConfig config(GetConfigPath());
if (config.Read()) {
std::string value; std::string value;
if (config.GetString(kHostIdConfigPath, &value)) if (config.GetString(kHostIdConfigPath, &value)) {
result->SetString(kHostIdConfigPath, value); result->SetString(kHostIdConfigPath, value);
if (config.GetString(kXmppLoginConfigPath, &value)) }
result->SetString(kXmppLoginConfigPath, value); if (config.GetString(kXmppLoginConfigPath, &value)) {
result->SetString(kXmppLoginConfigPath, value);
}
} else {
result.reset(); // Return NULL in case of error.
}
} }
callback.Run(result.Pass()); callback.Run(result.Pass());
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment