[svn-commits] alecdavis: branch 1.4 r287682 - /branches/1.4/main/channel.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Mon Sep 20 17:57:59 CDT 2010


Author: alecdavis
Date: Mon Sep 20 17:57:48 2010
New Revision: 287682

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=287682
Log:
ast_channel_masquerade: Avoid recursive masquerades.

Check all 4 combinations of (original/clonechan) * (masq/masqr).

Initially original->masq and clonechan->masqr were only checked.

It's possible with multiple masq's planned - and not yet executed, that
 the 'original' chan could already have another masq'd into it - thus original->masqr
would be set, that masqr would lost.
Likewise for the clonechan->masq.

(closes issue #16057;#17363)
Reported by: amorsen;davidw,alecdavis
Patches: 
      bug16057.diff4.txt uploaded by alecdavis (license 585)
Tested by: ramonpeek, davidw, alecdavis


Modified:
    branches/1.4/main/channel.c

Modified: branches/1.4/main/channel.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.4/main/channel.c?view=diff&rev=287682&r1=287681&r2=287682
==============================================================================
--- branches/1.4/main/channel.c (original)
+++ branches/1.4/main/channel.c Mon Sep 20 17:57:48 2010
@@ -3911,13 +3911,8 @@
 	if (option_debug)
 		ast_log(LOG_DEBUG, "Planning to masquerade channel %s into the structure of %s\n",
 			clone->name, original->name);
-	if (original->masq) {
-		ast_log(LOG_WARNING, "%s is already going to masquerade as %s\n",
-			original->masq->name, original->name);
-	} else if (clone->masqr) {
-		ast_log(LOG_WARNING, "%s is already going to masquerade as %s\n",
-			clone->name, clone->masqr->name);
-	} else {
+
+	if (!original->masqr && !original->masq && !clone->masq && !clone->masqr) {
 		original->masq = clone;
 		clone->masqr = original;
 		ast_queue_frame(original, &ast_null_frame);
@@ -3925,6 +3920,21 @@
 		if (option_debug)
 			ast_log(LOG_DEBUG, "Done planning to masquerade channel %s into the structure of %s\n", clone->name, original->name);
 		res = 0;
+
+	} else if (original->masq) {
+		ast_log(LOG_WARNING, "%s is already going to masquerade as %s\n",
+			original->masq->name, original->name);
+	} else if (original->masqr) {
+		/* not yet as a previously planned masq hasn't yet happened */
+		ast_log(LOG_WARNING, "%s is already going to masquerade as %s\n",
+			original->name, original->masqr->name);
+	} else if (clone->masq) {
+		ast_log(LOG_WARNING, "%s is already going to masquerade as %s\n",
+			clone->masq->name, clone->name);
+	} else if (clone->masqr) {
+		ast_log(LOG_WARNING, "%s is already going to masquerade as %s\n",
+			clone->name, clone->masqr->name);
+	} else {
 	}
 
 	ast_channel_unlock(clone);




More information about the svn-commits mailing list