From 47cb2370002c4b5be41193e0301e1afd2cf8c7d7 Mon Sep 17 00:00:00 2001
From: Stepan Salenikovich <stepan.salenikovich@savoirfairelinux.com>
Date: Fri, 15 May 2015 14:20:17 -0400
Subject: [PATCH] daemon: add missing ring account params

Read-only params which can be read by RingAccount::getAccountDetails():
SRTP.endable
SRTP.keyExchange
SRTP.rtpFallback
TLS.method
TLS.serverName
TLS.negotiationTimeoutSec
TLS.ciphers
TLS.verifyServer
TLS.verifyClient
TLS.requireCilentCertificate

Refs #72819

Change-Id: Ic375cfb95ad4caa8c67e63a728fe57cfd573b44b
---
 src/ringdht/ringaccount.cpp | 16 ++++++++++++++++
 src/ringdht/ringaccount.h   |  4 ++++
 2 files changed, 20 insertions(+)

diff --git a/src/ringdht/ringaccount.cpp b/src/ringdht/ringaccount.cpp
index cbd16d7f64..52d78fe687 100644
--- a/src/ringdht/ringaccount.cpp
+++ b/src/ringdht/ringaccount.cpp
@@ -509,6 +509,22 @@ std::map<std::string, std::string> RingAccount::getAccountDetails() const
 {
     std::map<std::string, std::string> a = SIPAccountBase::getAccountDetails();
     a.emplace(Conf::CONFIG_DHT_PORT, ring::to_string(dhtPort_));
+
+    /* these settings cannot be changed (read only), but clients should still be
+     * able to read what they are */
+    a.emplace(Conf::CONFIG_SRTP_KEY_EXCHANGE, sip_utils::getKeyExchangeName(getSrtpKeyExchange()));
+    a.emplace(Conf::CONFIG_SRTP_ENABLE,       isSrtpEnabled() ? TRUE_STR : FALSE_STR);
+    a.emplace(Conf::CONFIG_SRTP_RTP_FALLBACK, getSrtpFallback() ? TRUE_STR : FALSE_STR);
+
+    a.emplace(Conf::CONFIG_TLS_METHOD,                     "Automatic");
+    a.emplace(Conf::CONFIG_TLS_CIPHERS,                    "");
+    a.emplace(Conf::CONFIG_TLS_SERVER_NAME,                "");
+    a.emplace(Conf::CONFIG_TLS_VERIFY_SERVER,              TRUE_STR);
+    a.emplace(Conf::CONFIG_TLS_VERIFY_CLIENT,              TRUE_STR);
+    a.emplace(Conf::CONFIG_TLS_REQUIRE_CLIENT_CERTIFICATE, TRUE_STR);
+    /* GNUTLS_DEFAULT_HANDSHAKE_TIMEOUT is defined as -1 */
+    a.emplace(Conf::CONFIG_TLS_NEGOTIATION_TIMEOUT_SEC,    "-1");
+
     return a;
 }
 
diff --git a/src/ringdht/ringaccount.h b/src/ringdht/ringaccount.h
index 91f6cae598..9f853fce63 100644
--- a/src/ringdht/ringaccount.h
+++ b/src/ringdht/ringaccount.h
@@ -237,6 +237,10 @@ class RingAccount : public SIPAccountBase {
             return true;
         }
 
+        virtual bool isSrtpEnabled() const {
+            return true;
+        }
+
         virtual sip_utils::KeyExchangeProtocol getSrtpKeyExchange() const {
             return sip_utils::KeyExchangeProtocol::SDES;
         }
-- 
GitLab