From 909ace152b55c22937973cd3cf45380375e8eb4c Mon Sep 17 00:00:00 2001 From: "mnissler@chromium.org" Date: Wed, 27 Jun 2012 09:39:39 +0000 Subject: Merge 144195 - Fix crash to bad authenticator profile on policy token fetch. See the bug for the full story. BUG=chromium:134488 TEST=See bug comment #6. Review URL: https://chromiumcodereview.appspot.com/10662050 TBR=mnissler@chromium.org Review URL: https://chromiumcodereview.appspot.com/10699004 git-svn-id: svn://svn.chromium.org/chrome/branches/1180/src@144427 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/chromeos/login/login_utils.cc | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'chrome/browser/chromeos') diff --git a/chrome/browser/chromeos/login/login_utils.cc b/chrome/browser/chromeos/login/login_utils.cc index 95c1a6c..59c76a9c 100644 --- a/chrome/browser/chromeos/login/login_utils.cc +++ b/chrome/browser/chromeos/login/login_utils.cc @@ -1023,10 +1023,13 @@ void LoginUtilsImpl::FetchPolicyToken(Profile* offrecord_profile, // Fetch dm service token now, if it hasn't been fetched yet. if (!policy_oauth_fetcher_.get() || policy_oauth_fetcher_->failed()) { // Get the default system profile to use with the policy fetching. If there - // is no |authenticator_|, manually load default system profile. Otherwise, - // just use |authenticator_|'s profile. + // is no |authenticator_| profile, manually load default system profile. + // Otherwise, just use |authenticator_|'s profile. Profile* profile = NULL; - if (!authenticator_) { + if (authenticator_) + profile = authenticator_->authentication_profile(); + + if (!profile) { FilePath user_data_dir; PathService::Get(chrome::DIR_USER_DATA, &user_data_dir); ProfileManager* profile_manager = g_browser_process->profile_manager(); @@ -1034,9 +1037,8 @@ void LoginUtilsImpl::FetchPolicyToken(Profile* offrecord_profile, base::ThreadRestrictions::ScopedAllowIO allow_io; profile = profile_manager->GetProfile(user_data_dir)-> GetOffTheRecordProfile(); - } else { - profile = authenticator_->authentication_profile(); } + // Trigger oauth token fetch for user policy. policy_oauth_fetcher_.reset(new PolicyOAuthFetcher(profile, token, secret)); policy_oauth_fetcher_->Start(); -- cgit v1.1