From e61ed47efa06e57e5b8d656c05179c2e8504761c Mon Sep 17 00:00:00 2001
From: Adrien Beraud <adrien.beraud@savoirfairelinux.com>
Date: Sat, 16 Sep 2017 12:23:31 +0200
Subject: [PATCH] ringaccount: don't export DHT port to archive

Multiple accounts won't be able to register if
they use the same DHT port.
Prevent multiple accounts to use the same DHT port
by avoiding to include the DHT port configuration
in the account archive.
This will force Ring to use a new random port on device creation
from the archive.

Change-Id: If5b2143b731aba38d7ee0f921510c55d8289bdd3
Reviewed-by: Andreas Traczyk <andreas.traczyk@savoirfairelinux.com>
---
 src/ringdht/ringaccount.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/ringdht/ringaccount.cpp b/src/ringdht/ringaccount.cpp
index 2286b50e3e..4c1815745c 100644
--- a/src/ringdht/ringaccount.cpp
+++ b/src/ringdht/ringaccount.cpp
@@ -898,7 +898,8 @@ RingAccount::updateArchive(AccountArchive& archive) const
     auto details = getAccountDetails();
     for (auto it : details) {
         if (it.first.compare(DRing::Account::ConfProperties::Ringtone::PATH) == 0 ||
-            it.first.compare(DRing::Account::ConfProperties::ARCHIVE_PATH) == 0) {
+            it.first.compare(DRing::Account::ConfProperties::ARCHIVE_PATH) == 0 ||
+            it.first.compare(Conf::CONFIG_DHT_PORT) == 0) {
             // Keys to not be exported to archive
         } else if (it.first.compare(DRing::Account::ConfProperties::TLS::CA_LIST_FILE) == 0 ||
                 it.first.compare(DRing::Account::ConfProperties::TLS::CERTIFICATE_FILE) == 0 ||
-- 
GitLab