[svn-commits] russell: branch 1.2 r58164 - /branches/1.2/manager.c

svn-commits at lists.digium.com svn-commits at lists.digium.com
Tue Mar 6 17:20:14 MST 2007


Author: russell
Date: Tue Mar  6 18:20:13 2007
New Revision: 58164

URL: http://svn.digium.com/view/asterisk?view=rev&rev=58164
Log:
If the channels acquired using the manager Redirect action are not up, then
don't attempt to do anything with them.  It could lead to weird behavior,
including crashes.  (issue #8977)

Modified:
    branches/1.2/manager.c

Modified: branches/1.2/manager.c
URL: http://svn.digium.com/view/asterisk/branches/1.2/manager.c?view=diff&rev=58164&r1=58163&r2=58164
==============================================================================
--- branches/1.2/manager.c (original)
+++ branches/1.2/manager.c Tue Mar  6 18:20:13 2007
@@ -879,6 +879,11 @@
 		return 0;
 	}
 	chan = ast_get_channel_by_name_locked(name);
+	if (chan->_state != AST_STATE_UP) {
+		astman_send_error(s, m, "Redirect failed, channel not up.\n");
+		ast_mutex_unlock(&chan->lock);
+		return 0;
+	}
 	if (!chan) {
 		char buf[BUFSIZ];
 		snprintf(buf, sizeof(buf), "Channel does not exist: %s", name);
@@ -887,6 +892,12 @@
 	}
 	if (!ast_strlen_zero(name2))
 		chan2 = ast_get_channel_by_name_locked(name2);
+	if (chan2 && chan2->_state != AST_STATE_UP) {
+		astman_send_error(s, m, "Redirect failed, extra channel not up.\n");
+		ast_mutex_unlock(&chan->lock);
+		ast_mutex_unlock(&chan2->lock);
+		return 0;
+	}
 	res = ast_async_goto(chan, context, exten, pi);
 	if (!res) {
 		if (!ast_strlen_zero(name2)) {



More information about the svn-commits mailing list