From 58e19b0fb26ef1959ca950c129cf0478100f0c53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrien=20B=C3=A9raud?= <adrien.beraud@savoirfairelinux.com> Date: Tue, 24 Mar 2015 16:03:10 -0400 Subject: [PATCH] ringdht: generate identity when setting account details Not during account creation Refs #69038 Change-Id: I29e395bb0c4cf951623169a557746cf58193e0a5 --- src/ringdht/ringaccount.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/ringdht/ringaccount.cpp b/src/ringdht/ringaccount.cpp index ff3386ea86..415bc5c6ce 100644 --- a/src/ringdht/ringaccount.cpp +++ b/src/ringdht/ringaccount.cpp @@ -98,7 +98,6 @@ RingAccount::RingAccount(const std::string& accountID, bool /* presenceEnabled * fileutils::check_dir(idPath_.c_str()); caPath_ = idPath_ + DIR_SEPARATOR_STR "certs"; caListPath_ = idPath_ + DIR_SEPARATOR_STR "ca_list.pem"; - checkIdentityPath(); } RingAccount::~RingAccount() @@ -413,8 +412,10 @@ void RingAccount::unserialize(const YAML::Node &node) void RingAccount::checkIdentityPath() { - if (not tlsPrivateKeyFile_.empty() and not tlsCertificateFile_.empty()) + if (not tlsPrivateKeyFile_.empty() and not tlsCertificateFile_.empty()) { + loadIdentity(); return; + } const auto idPath = fileutils::get_data_dir()+DIR_SEPARATOR_STR+getAccountID(); tlsPrivateKeyFile_ = idPath + DIR_SEPARATOR_STR "dht.key"; @@ -456,9 +457,11 @@ RingAccount::loadIdentity() tlsCertificateFile_ = idPath_ + DIR_SEPARATOR_STR "dht.crt"; tlsPrivateKeyFile_ = idPath_ + DIR_SEPARATOR_STR "dht.key"; + username_ = id.second->getId().toString(); return {ca.second, id}; } + username_ = dht_cert.getId().toString(); return { std::make_shared<dht::crypto::Certificate>(std::move(ca_cert)), { -- GitLab