From 0cd3020bcf3dfeae9b4b4fa0ed3c0faf3027ea80 Mon Sep 17 00:00:00 2001
From: Tristan Matthews <tristan.matthews@savoirfairelinux.com>
Date: Tue, 26 Feb 2013 11:19:20 -0500
Subject: [PATCH] * #20793: accounts: enforce stricter rules for account
 loading

---
 daemon/src/managerimpl.cpp | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/daemon/src/managerimpl.cpp b/daemon/src/managerimpl.cpp
index 52807e5bb4..41caaa7c5f 100644
--- a/daemon/src/managerimpl.cpp
+++ b/daemon/src/managerimpl.cpp
@@ -2580,21 +2580,21 @@ namespace {
         item->getValue("alias", &accountAlias);
 
         if (!accountid.empty() and !accountAlias.empty() and accountid != SIPAccount::IP2IP_PROFILE) {
-            Account *a;
+            if (accountType == "SIP") {
+                Account *a = new SIPAccount(accountid);
+                sipAccountMap[accountid] = a;
+                a->unserialize(*item);
+            } else if (accountType == "IAX") {
 #if HAVE_IAX
-            if (accountType == "IAX") {
-                a = new IAXAccount(accountid);
+                Account *a = new IAXAccount(accountid);
                 iaxAccountMap[accountid] = a;
-            }
-            else { // assume SIP
+                a->unserialize(*item);
+#else
+                WARN("Ignoring IAX account");
 #endif
-                a = new SIPAccount(accountid);
-                sipAccountMap[accountid] = a;
-#if HAVE_IAX
+            } else {
+                ERROR("Ignoring unknown account type \"%s\"", accountType.c_str());
             }
-#endif
-
-            a->unserialize(*item);
         }
     }
 
-- 
GitLab