[asterisk-commits] rmudgett: branch 1.8 r288079 - /branches/1.8/main/channel.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Sep 21 15:29:54 CDT 2010


Author: rmudgett
Date: Tue Sep 21 15:29:51 2010
New Revision: 288079

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=288079
Log:
Protect channel access in CONNECTED_LINE and REDIRECTING interception macro launch code.

Modified:
    branches/1.8/main/channel.c

Modified: branches/1.8/main/channel.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/main/channel.c?view=diff&rev=288079&r1=288078&r2=288079
==============================================================================
--- branches/1.8/main/channel.c (original)
+++ branches/1.8/main/channel.c Tue Sep 21 15:29:51 2010
@@ -8775,9 +8775,9 @@
 	macro_args = pbx_builtin_getvar_helper(macro_chan, is_caller
 		? "CONNECTED_LINE_CALLER_SEND_MACRO_ARGS" : "CONNECTED_LINE_CALLEE_SEND_MACRO_ARGS");
 	macro_args = ast_strdupa(S_OR(macro_args, ""));
-	ast_channel_unlock(macro_chan);
 
 	if (ast_strlen_zero(macro)) {
+		ast_channel_unlock(macro_chan);
 		return -1;
 	}
 
@@ -8790,9 +8790,12 @@
 
 		ast_party_connected_line_copy(&macro_chan->connected, connected);
 	}
+	ast_channel_unlock(macro_chan);
 
 	if (!(retval = ast_app_run_macro(autoservice_chan, macro_chan, macro, macro_args))) {
+		ast_channel_lock(macro_chan);
 		ast_channel_update_connected_line(macro_chan, &macro_chan->connected, NULL);
+		ast_channel_unlock(macro_chan);
 	}
 
 	return retval;
@@ -8811,9 +8814,9 @@
 	macro_args = pbx_builtin_getvar_helper(macro_chan, is_caller
 		? "REDIRECTING_CALLER_SEND_MACRO_ARGS" : "REDIRECTING_CALLEE_SEND_MACRO_ARGS");
 	macro_args = ast_strdupa(S_OR(macro_args, ""));
-	ast_channel_unlock(macro_chan);
 
 	if (ast_strlen_zero(macro)) {
+		ast_channel_unlock(macro_chan);
 		return -1;
 	}
 
@@ -8826,10 +8829,13 @@
 
 		ast_party_redirecting_copy(&macro_chan->redirecting, redirecting);
 	}
+	ast_channel_unlock(macro_chan);
 
 	retval = ast_app_run_macro(autoservice_chan, macro_chan, macro, macro_args);
 	if (!retval) {
+		ast_channel_lock(macro_chan);
 		ast_channel_update_redirecting(macro_chan, &macro_chan->redirecting, NULL);
+		ast_channel_unlock(macro_chan);
 	}
 
 	return retval;




More information about the asterisk-commits mailing list