[asterisk-commits] jrose: branch 11 r375575 - in /branches/11: channels/ configs/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Nov 1 09:52:31 CDT 2012


Author: jrose
Date: Thu Nov  1 09:52:23 2012
New Revision: 375575

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=375575
Log:
chan_sip: Fix a bug causing SIP reloads to remove all entries from the registry

(closes issue ASTERISK-20611)
Reported by: Alisher

Modified:
    branches/11/channels/chan_sip.c
    branches/11/configs/sip.conf.sample

Modified: branches/11/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/branches/11/channels/chan_sip.c?view=diff&rev=375575&r1=375574&r2=375575
==============================================================================
--- branches/11/channels/chan_sip.c (original)
+++ branches/11/channels/chan_sip.c Thu Nov  1 09:52:23 2012
@@ -30766,7 +30766,16 @@
 static int peer_markall_func(void *device, void *arg, int flags)
 {
 	struct sip_peer *peer = device;
-	if (!peer->selfdestruct || sip_cfg.autocreatepeer != AUTOPEERS_PERSIST) {
+	if (!peer->selfdestruct) {
+		peer->the_mark = 1;
+	}
+	return 0;
+}
+
+static int peer_markall_autopeers_func(void *device, void *arg, int flags)
+{
+	struct sip_peer *peer = device;
+	if (peer->selfdestruct) {
 		peer->the_mark = 1;
 	}
 	return 0;
@@ -30908,6 +30917,11 @@
 		ast_mutex_unlock(&authl_lock);
 
 		cleanup_all_regs();
+
+		/* Then, actually destroy users and registry */
+		ASTOBJ_CONTAINER_DESTROYALL(&regl, sip_registry_destroy);
+		ast_debug(4, "--------------- Done destroying registry list\n");
+		ao2_t_callback(peers, OBJ_NODATA, peer_markall_func, NULL, "callback to mark all peers");
 	}
 
 	/* Reset certificate handling for TLS sessions */
@@ -31634,11 +31648,8 @@
 		max_subexpiry = max_expiry;
 	}
 
-	if (reason != CHANNEL_MODULE_LOAD) {
-		/* Then, actually destroy users and registry */
-		ASTOBJ_CONTAINER_DESTROYALL(&regl, sip_registry_destroy);
-		ast_debug(4, "--------------- Done destroying registry list\n");
-		ao2_t_callback(peers, OBJ_NODATA, peer_markall_func, NULL, "callback to mark all peers");
+	if (reason != CHANNEL_MODULE_LOAD && sip_cfg.autocreatepeer != AUTOPEERS_PERSIST) {
+		ao2_t_callback(peers, OBJ_NODATA, peer_markall_autopeers_func, NULL, "callback to mark autopeers for destruction");
 	}
 
 	if (subscribe_network_change) {

Modified: branches/11/configs/sip.conf.sample
URL: http://svnview.digium.com/svn/asterisk/branches/11/configs/sip.conf.sample?view=diff&rev=375575&r1=375574&r2=375575
==============================================================================
--- branches/11/configs/sip.conf.sample (original)
+++ branches/11/configs/sip.conf.sample Thu Nov  1 09:52:23 2012
@@ -510,14 +510,14 @@
 ;
 ;refer_addheaders=yes	; on by default
 
-;autocreatepeers=no             ; Allow any not exsplicitly defined here UAC to register
-                                ; WITHOUT AUTHENTICATION. Enabling this options poses a high
-                                ; potential security risk and should be avoided unless the 
-                                ; server is behind a trusted firewall. 
-                                ; When enabled by setting to "yes", the autocreated peers are
-                                ; pruned immediately when the "sip reload" command is issued
-                                ; through CLI. When enabled by setting to "persist", the auto-
-                                ; created peers survive the "sip reload" command.
+;autocreatepeer=no             ; Allow any UAC not explicitly defined to register
+                               ; WITHOUT AUTHENTICATION. Enabling this options poses a high
+                               ; potential security risk and should be avoided unless the
+                               ; server is behind a trusted firewall.
+                               ; If set to "yes", then peers created in this fashion
+                               ; are purged during SIP reloads.
+                               ; When set to "persist", the peers created in this fashion
+                               ; are not purged during SIP reloads.
 
 ;
 ;------------------------ TLS settings ------------------------------------------------------------




More information about the asterisk-commits mailing list