diff options
author | lipalani@chromium.org <lipalani@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-17 02:11:55 +0000 |
---|---|---|
committer | lipalani@chromium.org <lipalani@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-17 02:11:55 +0000 |
commit | db7c94827065f033b580fc177a3c9a7153534638 (patch) | |
tree | fb058ad406d6078df0e4bdd3808b897881ce83cd | |
parent | 122d5ee2f76d8c689a3c211df11dc604d97bf2f8 (diff) | |
download | chromium_src-db7c94827065f033b580fc177a3c9a7153534638.zip chromium_src-db7c94827065f033b580fc177a3c9a7153534638.tar.gz chromium_src-db7c94827065f033b580fc177a3c9a7153534638.tar.bz2 |
Merge 85004 - Try GAIA password for the sync passphrase before trying the custom passphrase. Otherwise if the user has an account encrypted with gaia password and he sets up a different machine with a custom passphrase we will prompt him to reenter his gaia password. Now we will use the gaia password and if it suceeds and then re-encrypt everything using the user supplied password.
BUG=76128
TEST=
Review URL: http://codereview.chromium.org/6982015
TBR=lipalani@chromium.org
Review URL: http://codereview.chromium.org/7017003
git-svn-id: svn://svn.chromium.org/chrome/branches/742/src@85582 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/sync/profile_sync_service.cc | 15 | ||||
-rw-r--r-- | chrome/browser/sync/profile_sync_service.h | 3 | ||||
-rw-r--r-- | chrome/test/live_sync/two_client_live_sessions_sync_test.cc | 1 |
3 files changed, 18 insertions, 1 deletions
diff --git a/chrome/browser/sync/profile_sync_service.cc b/chrome/browser/sync/profile_sync_service.cc index bd6b995..6d56f1c 100644 --- a/chrome/browser/sync/profile_sync_service.cc +++ b/chrome/browser/sync/profile_sync_service.cc @@ -609,6 +609,15 @@ void ProfileSyncService::OnPassphraseRequired(bool for_decryption) { observed_passphrase_required_ = true; passphrase_required_for_decryption_ = for_decryption; + // First try supplying gaia password as the passphrase. + if (!gaia_password_.empty()) { + SetPassphrase(gaia_password_, false, true); + gaia_password_ = std::string(); + return; + } + + // If the above failed then try the custom passphrase the user might have + // entered in setup. if (!cached_passphrase_.value.empty()) { SetPassphrase(cached_passphrase_.value, cached_passphrase_.is_explicit, @@ -1140,9 +1149,13 @@ void ProfileSyncService::Observe(NotificationType type, std::string message = StringPrintf("Sync Configuration failed with %d", result); OnUnrecoverableError(*(result_with_location->location), message); + + gaia_password_ = std::string(); + cached_passphrase_ = CachedPassphrase(); return; } + // If the user had entered a custom passphrase use it now. if (!cached_passphrase_.value.empty()) { // Don't hold on to the passphrase in raw form longer than needed. SetPassphrase(cached_passphrase_.value, @@ -1196,7 +1209,7 @@ void ProfileSyncService::Observe(NotificationType type, // actually change), or the user has an explicit passphrase set so this // becomes a no-op. tried_implicit_gaia_remove_when_bug_62103_fixed_ = true; - SetPassphrase(successful->password, false, true); + gaia_password_ = successful->password; // If this signin was to initiate a passphrase migration (on the // first computer, thus not for decryption), continue the migration. diff --git a/chrome/browser/sync/profile_sync_service.h b/chrome/browser/sync/profile_sync_service.h index ecafd69..412d165 100644 --- a/chrome/browser/sync/profile_sync_service.h +++ b/chrome/browser/sync/profile_sync_service.h @@ -616,6 +616,9 @@ class ProfileSyncService : public browser_sync::SyncFrontend, }; CachedPassphrase cached_passphrase_; + // TODO(lipalani): Bug 82221 unify this with the CachedPassphrase struct. + std::string gaia_password_; + // TODO(tim): Remove this once new 'explicit passphrase' code flushes through // dev channel. See bug 62103. // To "migrate" early adopters of password sync on dev channel to the new diff --git a/chrome/test/live_sync/two_client_live_sessions_sync_test.cc b/chrome/test/live_sync/two_client_live_sessions_sync_test.cc index 86f97cf..96ca6e4 100644 --- a/chrome/test/live_sync/two_client_live_sessions_sync_test.cc +++ b/chrome/test/live_sync/two_client_live_sessions_sync_test.cc @@ -111,3 +111,4 @@ IN_PROC_BROWSER_TEST_F(TwoClientLiveSessionsSyncTest, BothChanged) { ASSERT_TRUE(WindowsMatch(sessions1[0]->windows, *client0_windows)); ASSERT_TRUE(WindowsMatch(sessions0[0]->windows, *client1_windows)); } + |