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

Unified Diff: components/os_crypt/libsecret_util_linux.cc

Issue 2465083002: Add a dummy entry with libsecret when initializing OSCrypt. (Closed)
Patch Set: Created 4 years, 1 month 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
« no previous file with comments | « components/os_crypt/libsecret_util_linux.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/os_crypt/libsecret_util_linux.cc
diff --git a/components/os_crypt/libsecret_util_linux.cc b/components/os_crypt/libsecret_util_linux.cc
index 358bc1b57afffb2792d81ba15927d8867490939e..890b68262da1dfc53bfe4ff18b52b8e25c2e319d 100644
--- a/components/os_crypt/libsecret_util_linux.cc
+++ b/components/os_crypt/libsecret_util_linux.cc
@@ -13,6 +13,17 @@
// LibsecretLoader
//
+namespace {
+
+// TODO(crbug.com/660005) A message that is attached to useless entries that we
+// create, to explain its existence.
+const char kExplanationMessage[] =
+ "Because of quirks in the gnome libsecret API, Chrome needs to store a "
+ "dummy entry to quarantee that this keyring was properly unlocked. More "
+ "details at http://crbug.com/660005.";
+
+} // namespace
+
decltype(
&::secret_password_store_sync) LibsecretLoader::secret_password_store_sync;
decltype(
@@ -113,6 +124,31 @@ bool LibsecretLoader::LibsecretIsAvailable() {
return success;
}
+// TODO(crbug.com/660005) This is needed to properly unlock the default keyring.
+// We don't need to ever read it.
+void LibsecretLoader::EnsureKeyringUnlocked() {
+ const SecretSchema kDummySchema = {
+ "_chrome_dummy_schema_for_unlocking",
+ SECRET_SCHEMA_NONE,
+ {{"explanation", SECRET_SCHEMA_ATTRIBUTE_STRING},
+ {nullptr, SECRET_SCHEMA_ATTRIBUTE_STRING}}};
+
+ GError* error = nullptr;
+ bool success = LibsecretLoader::secret_password_store_sync(
+ &kDummySchema, nullptr /* default keyring */,
+ "Chrome Safe Storage Control" /* entry title */,
+ "The meaning of life" /* password */, nullptr, &error, "explanation",
+ kExplanationMessage,
+ nullptr /* null-terminated variable argument list */);
+ if (error) {
+ VLOG(1) << "Dummy store to unlock the default keyring failed: "
+ << error->message;
+ g_error_free(error);
+ } else if (!success) {
+ VLOG(1) << "Dummy store to unlock the default keyring failed.";
+ }
+}
+
//
// LibsecretAttributesBuilder
//
« no previous file with comments | « components/os_crypt/libsecret_util_linux.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698