Commit f7924a6e authored by Christos Froussios's avatar Christos Froussios Committed by Commit Bot

[Password Manager] Improve logging for the initialisation of OSCrypt

The current logging doesn't distinguish between a failed initialisation
of the preferred backend and a system where there is no expected backend.

Bug: 1018911
Change-Id: Id67a53261e16afa133409312745a6b97f82c9e4a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1897929
Commit-Queue: Christos Froussios <cfroussios@chromium.org>
Reviewed-by: default avatarMohamed Amir Yosef <mamir@chromium.org>
Cr-Commit-Position: refs/heads/master@{#712566}
parent dad07beb
......@@ -34,6 +34,32 @@ const char KeyStorageLinux::kFolderName[] = "Chromium Keys";
const char KeyStorageLinux::kKey[] = "Chromium Safe Storage";
#endif
namespace {
const char* SelectedLinuxBackendToString(
os_crypt::SelectedLinuxBackend selection) {
switch (selection) {
case os_crypt::SelectedLinuxBackend::DEFER:
return "DEFER";
case os_crypt::SelectedLinuxBackend::BASIC_TEXT:
return "BASIC_TEXT";
case os_crypt::SelectedLinuxBackend::GNOME_ANY:
return "GNOME_ANY";
case os_crypt::SelectedLinuxBackend::GNOME_KEYRING:
return "GNOME_KEYRING";
case os_crypt::SelectedLinuxBackend::GNOME_LIBSECRET:
return "GNOME_LIBSECRET";
case os_crypt::SelectedLinuxBackend::KWALLET:
return "KWALLET";
case os_crypt::SelectedLinuxBackend::KWALLET5:
return "KWALLET5";
}
NOTREACHED();
return nullptr;
}
} // namespace
// static
std::unique_ptr<KeyStorageLinux> KeyStorageLinux::CreateService(
const os_crypt::Config& config) {
......@@ -46,6 +72,8 @@ std::unique_ptr<KeyStorageLinux> KeyStorageLinux::CreateService(
base::nix::GetDesktopEnvironment(env.get());
os_crypt::SelectedLinuxBackend selected_backend =
os_crypt::SelectBackend(config.store, use_backend, desktop_env);
VLOG(1) << "Selected backend for OSCrypt: "
<< SelectedLinuxBackendToString(selected_backend);
// TODO(crbug.com/782851) Schedule the initialisation on each backend's
// favourite thread.
......@@ -62,6 +90,7 @@ std::unique_ptr<KeyStorageLinux> KeyStorageLinux::CreateService(
VLOG(1) << "OSCrypt using Libsecret as backend.";
return key_storage;
}
LOG(WARNING) << "OSCrypt tried Libsecret but couldn't initialise.";
}
#endif // defined(USE_LIBSECRET)
......@@ -73,6 +102,7 @@ std::unique_ptr<KeyStorageLinux> KeyStorageLinux::CreateService(
VLOG(1) << "OSCrypt using Keyring as backend.";
return key_storage;
}
LOG(WARNING) << "OSCrypt tried Keyring but couldn't initialise.";
}
#endif // defined(USE_KEYRING)
......@@ -90,12 +120,14 @@ std::unique_ptr<KeyStorageLinux> KeyStorageLinux::CreateService(
VLOG(1) << "OSCrypt using KWallet as backend.";
return key_storage;
}
LOG(WARNING) << "OSCrypt tried KWallet but couldn't initialise.";
}
#endif // defined(USE_KWALLET)
#endif // defined(USE_LIBSECRET) || defined(USE_KEYRING) ||
// defined(USE_KWALLET)
// The appropriate store was not available.
// Either there are no supported backends on this platform, or we chose to
// use no backend, or the chosen backend failed to initialise.
VLOG(1) << "OSCrypt did not initialize a backend.";
return nullptr;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment