#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "components/os_crypt/sync/kwallet_dbus.h"
#include <algorithm>
#include <memory>
#include "base/logging.h"
#include "dbus/bus.h"
#include "dbus/message.h"
#include "dbus/object_proxy.h"
namespace {
const char kKWalletDName[] = …;
const char kKWalletD5Name[] = …;
const char kKWalletD6Name[] = …;
const char kKWalletServiceName[] = …;
const char kKWallet5ServiceName[] = …;
const char kKWallet6ServiceName[] = …;
const char kKWalletPath[] = …;
const char kKWallet5Path[] = …;
const char kKWallet6Path[] = …;
const char kKWalletInterface[] = …;
const char kKLauncherServiceName[] = …;
const char kKLauncherPath[] = …;
const char kKLauncherInterface[] = …;
}
KWalletDBus::KWalletDBus(base::nix::DesktopEnvironment desktop_env) { … }
KWalletDBus::~KWalletDBus() = default;
dbus::Bus* KWalletDBus::GetSessionBus() { … }
void KWalletDBus::SetSessionBus(scoped_refptr<dbus::Bus> session_bus) { … }
bool KWalletDBus::StartKWalletd() { … }
KWalletDBus::Error KWalletDBus::IsEnabled(bool* enabled) { … }
KWalletDBus::Error KWalletDBus::NetworkWallet(std::string* wallet_name) { … }
KWalletDBus::Error KWalletDBus::Open(const std::string& wallet_name,
const std::string& app_name,
int* handle_ptr) { … }
KWalletDBus::Error KWalletDBus::HasEntry(const int wallet_handle,
const std::string& folder_name,
const std::string& key,
const std::string& app_name,
bool* has_entry) { … }
KWalletDBus::Error KWalletDBus::EntryType(const int wallet_handle,
const std::string& folder_name,
const std::string& key,
const std::string& app_name,
Type* entry_type) { … }
KWalletDBus::Error KWalletDBus::ReadEntry(const int wallet_handle,
const std::string& folder_name,
const std::string& key,
const std::string& app_name,
std::vector<uint8_t>* bytes_ptr) { … }
KWalletDBus::Error KWalletDBus::EntryList(
const int wallet_handle,
const std::string& folder_name,
const std::string& app_name,
std::vector<std::string>* entry_list_ptr) { … }
KWalletDBus::Error KWalletDBus::RemoveEntry(const int wallet_handle,
const std::string& folder_name,
const std::string& key,
const std::string& app_name,
int* return_code_ptr) { … }
KWalletDBus::Error KWalletDBus::WriteEntry(const int wallet_handle,
const std::string& folder_name,
const std::string& key,
const std::string& app_name,
base::span<const uint8_t> data,
int* return_code_ptr) { … }
KWalletDBus::Error KWalletDBus::HasFolder(const int handle,
const std::string& folder_name,
const std::string& app_name,
bool* has_folder_ptr) { … }
KWalletDBus::Error KWalletDBus::CreateFolder(const int handle,
const std::string& folder_name,
const std::string& app_name,
bool* success_ptr) { … }
KWalletDBus::Error KWalletDBus::WritePassword(const int handle,
const std::string& folder_name,
const std::string& key,
const std::string& password,
const std::string& app_name,
bool* const write_success_ptr) { … }
KWalletDBus::Error KWalletDBus::ReadPassword(
const int handle,
const std::string& folder_name,
const std::string& key,
const std::string& app_name,
std::optional<std::string>* const password_ptr) { … }
KWalletDBus::Error KWalletDBus::Close(const int handle,
const bool force,
const std::string& app_name,
bool* success_ptr) { … }