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

Unified Diff: chrome/browser/chromeos/login/multi_profile_user_controller.cc

Issue 117263002: Prevent ONC-pushed certificates from being used with multiprofiles. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: addressed comments, more tests Created 7 years 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/login/multi_profile_user_controller.cc
diff --git a/chrome/browser/chromeos/login/multi_profile_user_controller.cc b/chrome/browser/chromeos/login/multi_profile_user_controller.cc
index 1290663a44741135dd5057b4b4deb77c8507cf2b..043a0f0bfdfccd27c69b98758719d3a747151b08 100644
--- a/chrome/browser/chromeos/login/multi_profile_user_controller.cc
+++ b/chrome/browser/chromeos/login/multi_profile_user_controller.cc
@@ -11,7 +11,10 @@
#include "base/prefs/pref_service.h"
#include "base/prefs/scoped_user_pref_update.h"
#include "chrome/browser/chromeos/login/multi_profile_user_controller_delegate.h"
+#include "chrome/browser/chromeos/login/user.h"
#include "chrome/browser/chromeos/login/user_manager.h"
+#include "chrome/browser/chromeos/policy/policy_cert_service.h"
+#include "chrome/browser/chromeos/policy/policy_cert_service_factory.h"
#include "chrome/browser/prefs/pref_service_syncable.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/common/pref_names.h"
@@ -80,6 +83,23 @@ bool MultiProfileUserController::IsUserAllowedInSession(
if (user_manager->GetOwnerEmail() == user_email)
return false;
+ // Don't allow profiles potentially tainted by data fetched with policy-pushed
+ // certificates to join a multiprofile session.
+ if (policy::PolicyCertServiceFactory::UsedPolicyCertificates(user_email))
+ return false;
+
+ // Don't allow any secondary profiles if the primary profile is potentially
+ // tainted.
+ const User* primary_user = user_manager->GetPrimaryUser();
+ Profile* profile =
+ primary_user ? user_manager->GetProfileByUser(primary_user) : NULL;
+ policy::PolicyCertService* service =
+ profile ? policy::PolicyCertServiceFactory::GetForProfile(profile) : NULL;
+ if (service && (service->UsedPolicyCertificates() ||
+ service->has_policy_certificates())) {
+ return false;
+ }
+
// No user is allowed if the primary user policy forbids it.
const std::string primary_user_behavior = GetCachedValue(primary_user_email);
if (primary_user_behavior == kBehaviorNotAllowed)
@@ -107,11 +127,12 @@ void MultiProfileUserController::StartObserving(Profile* user_profile) {
OnUserPrefChanged(user_profile);
}
-void MultiProfileUserController::RemoveCachedValue(
+void MultiProfileUserController::RemoveCachedValues(
const std::string& user_email) {
DictionaryPrefUpdate update(local_state_,
prefs::kCachedMultiProfileUserBehavior);
update->RemoveWithoutPathExpansion(user_email, NULL);
+ policy::PolicyCertServiceFactory::ClearUsedPolicyCertificates(user_email);
pneubeck (no reviews) 2013/12/18 09:11:07 i think the old place was better for this as the t
Joao da Silva 2013/12/18 09:40:13 I'd prefer to have this next to the code that call
}
std::string MultiProfileUserController::GetCachedValue(

Powered by Google App Engine
This is Rietveld 408576698