diff options
author | solb@chromium.org <solb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-26 14:51:14 +0000 |
---|---|---|
committer | solb@chromium.org <solb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-26 14:51:14 +0000 |
commit | 581ec2af841f60e4a36fdee26013c2ada2933c70 (patch) | |
tree | 87ed9e95070d760f7292d58ab6df520bebb08012 /remoting/client/jni | |
parent | ac4061828862ab11f9bba9016c5559cefa9fb8fa (diff) | |
download | chromium_src-581ec2af841f60e4a36fdee26013c2ada2933c70.zip chromium_src-581ec2af841f60e4a36fdee26013c2ada2933c70.tar.gz chromium_src-581ec2af841f60e4a36fdee26013c2ada2933c70.tar.bz2 |
Restructure Android app's ChromotingJniInstance::ProvideSecret()
This was done to make the timeframe for construction of the std::string wrapping the user's PIN clearer. It should fix a threading issue where the underlying const char* containing the PIN was being destroyed before being wrapped, resulting in the transmission of a bogus PIN to the host and a subsequent authentication rejection.
Review URL: https://chromiumcodereview.appspot.com/20226002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@213913 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting/client/jni')
-rw-r--r-- | remoting/client/jni/chromoting_jni_instance.cc | 4 | ||||
-rw-r--r-- | remoting/client/jni/chromoting_jni_instance.h | 2 |
2 files changed, 2 insertions, 4 deletions
diff --git a/remoting/client/jni/chromoting_jni_instance.cc b/remoting/client/jni/chromoting_jni_instance.cc index 8dc3b17..f284672 100644 --- a/remoting/client/jni/chromoting_jni_instance.cc +++ b/remoting/client/jni/chromoting_jni_instance.cc @@ -59,12 +59,10 @@ void ChromotingJniInstance::Cleanup() { this)); } -void ChromotingJniInstance::ProvideSecret(const char* pin) { +void ChromotingJniInstance::ProvideSecret(const std::string& pin) { DCHECK(jni_runtime_->ui_task_runner()->BelongsToCurrentThread()); DCHECK(!pin_callback_.is_null()); - // We invoke the string constructor to ensure |pin| gets copied *before* the - // asynchronous run, since Java might want it back as soon as we return. jni_runtime_->network_task_runner()->PostTask(FROM_HERE, base::Bind(pin_callback_, pin)); } diff --git a/remoting/client/jni/chromoting_jni_instance.h b/remoting/client/jni/chromoting_jni_instance.h index 6b332e4..5a26cf4 100644 --- a/remoting/client/jni/chromoting_jni_instance.h +++ b/remoting/client/jni/chromoting_jni_instance.h @@ -52,7 +52,7 @@ class ChromotingJniInstance // Provides the user's PIN and resumes the host authentication attempt. Call // on the UI thread once the user has finished entering this PIN into the UI, // but only after the UI has been asked to provide a PIN (via FetchSecret()). - void ProvideSecret(const char* pin); + void ProvideSecret(const std::string& pin); // Schedules a redraw on the display thread. May be called from any thread. void RedrawDesktop(); |