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

Unified Diff: chrome/browser/chromeos/login/managed/supervised_user_authentication.cc

Issue 221813006: Various supervised user password fixes - 2 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix comments Created 6 years, 9 months 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/managed/supervised_user_authentication.cc
diff --git a/chrome/browser/chromeos/login/managed/supervised_user_authentication.cc b/chrome/browser/chromeos/login/managed/supervised_user_authentication.cc
index a9b92cbd1a4e935f71ec850ad88c62432e12a55f..cbfba6f2be35f157a4366564ae367755711846b5 100644
--- a/chrome/browser/chromeos/login/managed/supervised_user_authentication.cc
+++ b/chrome/browser/chromeos/login/managed/supervised_user_authentication.cc
@@ -7,6 +7,7 @@
#include "base/base64.h"
#include "base/command_line.h"
#include "base/json/json_file_value_serializer.h"
+#include "base/macros.h"
#include "base/metrics/histogram.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
@@ -102,17 +103,20 @@ std::string BuildPasswordSignature(const std::string& password,
base::DictionaryValue* LoadPasswordData(base::FilePath profile_dir) {
JSONFileValueSerializer serializer(profile_dir.Append(kPasswordUpdateFile));
std::string error_message;
- int error_code;
+ int error_code = JSONFileValueSerializer::JSON_NO_ERROR;
scoped_ptr<base::Value> value(
serializer.Deserialize(&error_code, &error_message));
if (JSONFileValueSerializer::JSON_NO_ERROR != error_code) {
+ LOG(ERROR) << "Could not deserialize password data, error = " << error_code
+ << " / " << error_message;
return NULL;
}
base::DictionaryValue* result;
if (!value->GetAsDictionary(&result)) {
+ LOG(ERROR) << "Stored password data is not a dictionary";
return NULL;
}
- value.Pass();
+ ignore_result(value.release());
return result;
}
@@ -213,6 +217,8 @@ bool SupervisedUserAuthentication::FillDataForNewUser(
BuildPasswordSignature(salted_password, revision, base64_signature_key);
password_data->SetStringWithoutPathExpansion(kEncryptedPassword,
salted_password);
+ password_data->SetStringWithoutPathExpansion(kPasswordSignature,
+ base64_signature);
extra_data->SetStringWithoutPathExpansion(kPasswordEncryptionKey,
BuildRawHMACKey());
@@ -266,7 +272,6 @@ SupervisedUserAuthentication::GetPasswordSchema(
bool SupervisedUserAuthentication::NeedPasswordChange(
const std::string& user_id,
const base::DictionaryValue* password_data) {
-
base::DictionaryValue local;
owner_->GetPasswordInformation(user_id, &local);
int local_schema = SCHEMA_PLAIN;
@@ -333,11 +338,11 @@ bool SupervisedUserAuthentication::HasIncompleteKey(
return incomplete_key;
}
-void SupervisedUserAuthentication::MarkKeyIncomplete(
- const std::string& user_id) {
+void SupervisedUserAuthentication::MarkKeyIncomplete(const std::string& user_id,
+ bool incomplete) {
base::DictionaryValue holder;
owner_->GetPasswordInformation(user_id, &holder);
- holder.SetBoolean(kHasIncompleteKey, true);
+ holder.SetBoolean(kHasIncompleteKey, incomplete);
owner_->SetPasswordInformation(user_id, &holder);
}

Powered by Google App Engine
This is Rietveld 408576698