From 1acdc8840b8171ae963b833762b7b7b99d041f92 Mon Sep 17 00:00:00 2001
From: Alexandre Savard <alexandre.savard@savoirfairelinux.com>
Date: Wed, 25 Aug 2010 11:42:23 -0400
Subject: [PATCH] [#3934] Fix security for IP2IP

---
 .../src/config/accountconfigdialog.c          | 39 ++++++++++---------
 .../src/audio/audiortp/AudioRtpFactory.cpp    |  2 +-
 2 files changed, 21 insertions(+), 20 deletions(-)

diff --git a/sflphone-client-gnome/src/config/accountconfigdialog.c b/sflphone-client-gnome/src/config/accountconfigdialog.c
index 9deb3ebea4..5a87bbfa68 100644
--- a/sflphone-client-gnome/src/config/accountconfigdialog.c
+++ b/sflphone-client-gnome/src/config/accountconfigdialog.c
@@ -1470,32 +1470,33 @@ void show_account_window (account_t * a)
                                       published_address);
             }
 
-            if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (overrtp))) {
-                g_hash_table_replace (currentAccount->properties, g_strdup (ACCOUNT_DTMF_TYPE), g_strdup (OVERRTP));
-            } else {
-                g_hash_table_replace (currentAccount->properties, g_strdup (ACCOUNT_DTMF_TYPE), g_strdup (SIPINFO));
-            }
+        }
 
-            gchar* keyExchange = (gchar *) gtk_combo_box_get_active_text (GTK_COMBO_BOX (keyExchangeCombo));
+        if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (overrtp))) {
+            g_hash_table_replace (currentAccount->properties, g_strdup (ACCOUNT_DTMF_TYPE), g_strdup (OVERRTP));
+        } else {
+            g_hash_table_replace (currentAccount->properties, g_strdup (ACCOUNT_DTMF_TYPE), g_strdup (SIPINFO));
+        }
 
-            if (g_strcasecmp (keyExchange, "ZRTP") == 0) {
-                g_hash_table_replace (currentAccount->properties, g_strdup (ACCOUNT_SRTP_ENABLED), g_strdup ("true"));
-                g_hash_table_replace (currentAccount->properties, g_strdup (ACCOUNT_KEY_EXCHANGE), g_strdup (ZRTP));
-            }
+        gchar* keyExchange = (gchar *) gtk_combo_box_get_active_text (GTK_COMBO_BOX (keyExchangeCombo));
 
-            else if (g_strcasecmp (keyExchange, "SDES") == 0) {
-                g_hash_table_replace (currentAccount->properties, g_strdup (ACCOUNT_SRTP_ENABLED), g_strdup ("true"));
-                g_hash_table_replace (currentAccount->properties, g_strdup (ACCOUNT_KEY_EXCHANGE), g_strdup (SDES));
-            }
+        if (g_strcasecmp (keyExchange, "ZRTP") == 0) {
+            g_hash_table_replace (currentAccount->properties, g_strdup (ACCOUNT_SRTP_ENABLED), g_strdup ("true"));
+            g_hash_table_replace (currentAccount->properties, g_strdup (ACCOUNT_KEY_EXCHANGE), g_strdup (ZRTP));
+        }
 
-            else {
-                g_hash_table_replace (currentAccount->properties, g_strdup (ACCOUNT_SRTP_ENABLED), g_strdup ("false"));
-            }
+        else if (g_strcasecmp (keyExchange, "SDES") == 0) {
+            g_hash_table_replace (currentAccount->properties, g_strdup (ACCOUNT_SRTP_ENABLED), g_strdup ("true"));
+            g_hash_table_replace (currentAccount->properties, g_strdup (ACCOUNT_KEY_EXCHANGE), g_strdup (SDES));
+        }
 
-            g_hash_table_replace (currentAccount->properties, g_strdup (TLS_ENABLE),
-                                  g_strdup (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (useSipTlsCheckBox)) ? "true":"false"));
+        else {
+            g_hash_table_replace (currentAccount->properties, g_strdup (ACCOUNT_SRTP_ENABLED), g_strdup ("false"));
         }
 
+        g_hash_table_replace (currentAccount->properties, g_strdup (TLS_ENABLE),
+                              g_strdup (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (useSipTlsCheckBox)) ? "true":"false"));
+
         gboolean toneEnabled = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (enableTone));
         g_hash_table_replace (currentAccount->properties,
                               g_strdup (CONFIG_RINGTONE_ENABLED),
diff --git a/sflphone-common/src/audio/audiortp/AudioRtpFactory.cpp b/sflphone-common/src/audio/audiortp/AudioRtpFactory.cpp
index 7dcf1776f3..eabf054b16 100644
--- a/sflphone-common/src/audio/audiortp/AudioRtpFactory.cpp
+++ b/sflphone-common/src/audio/audiortp/AudioRtpFactory.cpp
@@ -114,7 +114,7 @@ void AudioRtpFactory::initAudioRtpSession (SIPCall * ca)
     _debug ("AudioRtpFactory: Srtp enable: %d ", _srtpEnabled);
 
     if (_srtpEnabled) {
-        std::string zidFilename (Manager::instance().getConfigString (SIGNALISATION, ZRTP_ZIDFILE));
+        std::string zidFilename (Manager::instance().voipPreferences.getZidFile());
 
         switch (_keyExchangeProtocol) {
 
-- 
GitLab