diff options
author | sergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-09-14 04:18:03 +0000 |
---|---|---|
committer | sergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-09-14 04:18:03 +0000 |
commit | ad377ae01314e1b74db3e7810c151ddfc6daaa7c (patch) | |
tree | dea06aafff3440509e9e6884ba536c9a3d22020c /remoting/host/plugin | |
parent | 3f211b664f0b98dc15a413ae5fb6130fe5ab8496 (diff) | |
download | chromium_src-ad377ae01314e1b74db3e7810c151ddfc6daaa7c.zip chromium_src-ad377ae01314e1b74db3e7810c151ddfc6daaa7c.tar.gz chromium_src-ad377ae01314e1b74db3e7810c151ddfc6daaa7c.tar.bz2 |
Handle certificate generation errors in chromoting host.
Sometimes self-signed cert generation may fail. In that case it's better to shutdown
host instead of crashing.
BUG=146839
Review URL: https://chromiumcodereview.appspot.com/10919277
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@156736 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting/host/plugin')
-rw-r--r-- | remoting/host/plugin/host_script_object.cc | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/remoting/host/plugin/host_script_object.cc b/remoting/host/plugin/host_script_object.cc index c4989c6..043bc75 100644 --- a/remoting/host/plugin/host_script_object.cc +++ b/remoting/host/plugin/host_script_object.cc @@ -1002,10 +1002,18 @@ void HostNPScriptObject::OnReceivedSupportID( std::string host_secret = GenerateSupportHostSecret(); std::string access_code = support_id + host_secret; + + std::string local_certificate = host_key_pair_.GenerateCertificate(); + if (local_certificate.empty()) { + LOG(ERROR) << "Failed to generate host certificate."; + SetState(kError); + DisconnectInternal(); + return; + } + scoped_ptr<protocol::AuthenticatorFactory> factory( new protocol::It2MeHostAuthenticatorFactory( - host_key_pair_.GenerateCertificate(), *host_key_pair_.private_key(), - access_code)); + local_certificate, *host_key_pair_.private_key(), access_code)); host_->SetAuthenticatorFactory(factory.Pass()); { |