Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(350)

Side by Side Diff: remoting/host/remoting_me2me_host.cc

Issue 1838313002: Restart the host when the third party auth certificate changes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix small typo Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « remoting/host/linux/certificate_watcher_unittest.cc ('k') | remoting/remoting_host_srcs.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 // This file implements a standalone host process for Me2Me. 5 // This file implements a standalone host process for Me2Me.
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <string> 10 #include <string>
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 #if defined(OS_MACOSX) 108 #if defined(OS_MACOSX)
109 #include "base/mac/scoped_cftyperef.h" 109 #include "base/mac/scoped_cftyperef.h"
110 #endif // defined(OS_MACOSX) 110 #endif // defined(OS_MACOSX)
111 111
112 #if defined(OS_LINUX) 112 #if defined(OS_LINUX)
113 #include <gtk/gtk.h> 113 #include <gtk/gtk.h>
114 #include <X11/Xlib.h> 114 #include <X11/Xlib.h>
115 #undef Status // Xlib.h #defines this, which breaks protobuf headers. 115 #undef Status // Xlib.h #defines this, which breaks protobuf headers.
116 #include <base/linux_util.h> 116 #include <base/linux_util.h>
117 #include "remoting/host/audio_capturer_linux.h" 117 #include "remoting/host/audio_capturer_linux.h"
118 #include "remoting/host/linux/certificate_watcher.h"
118 #endif // defined(OS_LINUX) 119 #endif // defined(OS_LINUX)
119 120
120 #if defined(OS_WIN) 121 #if defined(OS_WIN)
121 #include <commctrl.h> 122 #include <commctrl.h>
122 #include "base/win/registry.h" 123 #include "base/win/registry.h"
123 #include "base/win/scoped_handle.h" 124 #include "base/win/scoped_handle.h"
124 #include "remoting/host/pairing_registry_delegate_win.h" 125 #include "remoting/host/pairing_registry_delegate_win.h"
125 #include "remoting/host/win/session_desktop_environment.h" 126 #include "remoting/host/win/session_desktop_environment.h"
126 #endif // defined(OS_WIN) 127 #endif // defined(OS_WIN)
127 128
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
383 384
384 // Crashes the process in response to a daemon's request. The daemon passes 385 // Crashes the process in response to a daemon's request. The daemon passes
385 // the location of the code that detected the fatal error resulted in this 386 // the location of the code that detected the fatal error resulted in this
386 // request. 387 // request.
387 void OnCrash(const std::string& function_name, 388 void OnCrash(const std::string& function_name,
388 const std::string& file_name, 389 const std::string& file_name,
389 const int& line_number); 390 const int& line_number);
390 391
391 scoped_ptr<ChromotingHostContext> context_; 392 scoped_ptr<ChromotingHostContext> context_;
392 393
394 #if defined(OS_LINUX)
395 // Watch for certificate changes and kill the host when changes occur
396 scoped_ptr<CertificateWatcher> cert_watcher_;
397 #endif
398
393 // XMPP server/remoting bot configuration (initialized from the command line). 399 // XMPP server/remoting bot configuration (initialized from the command line).
394 XmppSignalStrategy::XmppServerConfig xmpp_server_config_; 400 XmppSignalStrategy::XmppServerConfig xmpp_server_config_;
395 std::string directory_bot_jid_; 401 std::string directory_bot_jid_;
396 402
397 // Created on the UI thread but used from the network thread. 403 // Created on the UI thread but used from the network thread.
398 base::FilePath host_config_path_; 404 base::FilePath host_config_path_;
399 std::string host_config_; 405 std::string host_config_;
400 scoped_ptr<DesktopEnvironmentFactory> desktop_environment_factory_; 406 scoped_ptr<DesktopEnvironmentFactory> desktop_environment_factory_;
401 407
402 // Accessed on the network thread. 408 // Accessed on the network thread.
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after
800 use_service_account_, host_owner_, local_certificate, key_pair_, 806 use_service_account_, host_owner_, local_certificate, key_pair_,
801 client_domain_, pin_hash_, pairing_registry); 807 client_domain_, pin_hash_, pairing_registry);
802 808
803 host_->set_pairing_registry(pairing_registry); 809 host_->set_pairing_registry(pairing_registry);
804 } else { 810 } else {
805 // ThirdPartyAuthConfig::Parse() leaves the config in a valid state, so 811 // ThirdPartyAuthConfig::Parse() leaves the config in a valid state, so
806 // these URLs are both valid. 812 // these URLs are both valid.
807 DCHECK(third_party_auth_config_.token_url.is_valid()); 813 DCHECK(third_party_auth_config_.token_url.is_valid());
808 DCHECK(third_party_auth_config_.token_validation_url.is_valid()); 814 DCHECK(third_party_auth_config_.token_validation_url.is_valid());
809 815
816 #if defined(OS_LINUX)
817 if (!cert_watcher_) {
818 cert_watcher_.reset(new CertificateWatcher(
819 base::Bind(&HostProcess::ShutdownHost, this, kSuccessExitCode),
820 context_->file_task_runner()));
821 cert_watcher_->Start();
822 }
823 cert_watcher_->SetMonitor(host_->AsWeakPtr());
824 #endif
825
810 scoped_refptr<protocol::TokenValidatorFactory> token_validator_factory = 826 scoped_refptr<protocol::TokenValidatorFactory> token_validator_factory =
811 new TokenValidatorFactoryImpl(third_party_auth_config_, key_pair_, 827 new TokenValidatorFactoryImpl(third_party_auth_config_, key_pair_,
812 context_->url_request_context_getter()); 828 context_->url_request_context_getter());
813 factory = protocol::Me2MeHostAuthenticatorFactory::CreateWithThirdPartyAuth( 829 factory = protocol::Me2MeHostAuthenticatorFactory::CreateWithThirdPartyAuth(
814 use_service_account_, host_owner_, local_certificate, key_pair_, 830 use_service_account_, host_owner_, local_certificate, key_pair_,
815 client_domain_, token_validator_factory); 831 client_domain_, token_validator_factory);
816 } 832 }
817 833
818 #if defined(OS_POSIX) 834 #if defined(OS_POSIX)
819 // On Linux and Mac, perform a PAM authorization step after authentication. 835 // On Linux and Mac, perform a PAM authorization step after authentication.
(...skipping 926 matching lines...) Expand 10 before | Expand all | Expand 10 after
1746 base::TimeDelta::FromSeconds(kShutdownTimeoutSeconds)); 1762 base::TimeDelta::FromSeconds(kShutdownTimeoutSeconds));
1747 new HostProcess(std::move(context), &exit_code, &shutdown_watchdog); 1763 new HostProcess(std::move(context), &exit_code, &shutdown_watchdog);
1748 1764
1749 // Run the main (also UI) message loop until the host no longer needs it. 1765 // Run the main (also UI) message loop until the host no longer needs it.
1750 message_loop.Run(); 1766 message_loop.Run();
1751 1767
1752 return exit_code; 1768 return exit_code;
1753 } 1769 }
1754 1770
1755 } // namespace remoting 1771 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/linux/certificate_watcher_unittest.cc ('k') | remoting/remoting_host_srcs.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698