diff options
author | lipalani@chromium.org <lipalani@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-07-19 19:37:48 +0000 |
---|---|---|
committer | lipalani@chromium.org <lipalani@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-07-19 19:37:48 +0000 |
commit | 4c4d4085ca49d09a1fc6aee59161f3baa9e348fa (patch) | |
tree | 60c25be2d4fb84967744708d180ed88df0a6a272 /chrome/browser/sync | |
parent | 727db1fe4c8cb4f0b1714c1a6256f7eb87c153ce (diff) | |
download | chromium_src-4c4d4085ca49d09a1fc6aee59161f3baa9e348fa.zip chromium_src-4c4d4085ca49d09a1fc6aee59161f3baa9e348fa.tar.gz chromium_src-4c4d4085ca49d09a1fc6aee59161f3baa9e348fa.tar.bz2 |
If the user sets the gaia passphrase as the explicit passphrase then currently we wont prompt him to enter an explicit passphrase when he sets up a new client. We would simply try the gaia passphrase and since that suceeds no prompt would appear.
this changes that by always prompting for a passphrase if the explicit flag is set on the nigori node.
BUG=60827
TEST=
Review URL: http://codereview.chromium.org/7347009
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@93078 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/sync')
-rw-r--r-- | chrome/browser/sync/engine/syncapi.cc | 34 |
1 files changed, 26 insertions, 8 deletions
diff --git a/chrome/browser/sync/engine/syncapi.cc b/chrome/browser/sync/engine/syncapi.cc index e49d93f..fe54eac 100644 --- a/chrome/browser/sync/engine/syncapi.cc +++ b/chrome/browser/sync/engine/syncapi.cc @@ -1979,9 +1979,33 @@ void SyncManager::SyncInternal::SetPassphrase( Cryptographer* cryptographer = trans.GetCryptographer(); KeyParams params = {"localhost", "dummy", passphrase}; + WriteNode node(&trans); + if (!node.InitByTagLookup(kNigoriTag)) { + // TODO(albertb): Plumb an UnrecoverableError all the way back to the PSS. + NOTREACHED(); + return; + } + if (cryptographer->has_pending_keys()) { - if (!cryptographer->DecryptPendingKeys(params)) { - VLOG(1) << "Passphrase failed to decrypt pending keys."; + bool suceeded = false; + + // See if the explicit flag matches what is set in nigori. If not we dont + // even try the passphrase. Note: This could mean that we wont try setting + // the gaia password as passphrase if custom is elected by the user. Which + // is fine because nigori node has all the old passwords in it. + if (node.GetNigoriSpecifics().using_explicit_passphrase() == is_explicit) { + if (cryptographer->DecryptPendingKeys(params)) { + suceeded = true; + } else { + VLOG(1) << "Passphrase failed to decrypt pending keys."; + } + } else { + VLOG(1) << "Not trying the passphrase because the explicit flags dont " + << "match. Nigori node's explicit flag is " + << node.GetNigoriSpecifics().using_explicit_passphrase(); + } + + if (!suceeded) { ObserverList<SyncManager::Observer> temp_obs_list; CopyObservers(&temp_obs_list); FOR_EACH_OBSERVER(SyncManager::Observer, temp_obs_list, @@ -1994,12 +2018,6 @@ void SyncManager::SyncInternal::SetPassphrase( RequestNudge(FROM_HERE); } else { VLOG(1) << "No pending keys, adding provided passphrase."; - WriteNode node(&trans); - if (!node.InitByTagLookup(kNigoriTag)) { - // TODO(albertb): Plumb an UnrecoverableError all the way back to the PSS. - NOTREACHED(); - return; - } // Prevent an implicit SetPassphrase request from changing an explicitly // set passphrase. |