aboutsummaryrefslogtreecommitdiffstats
path: root/channels
diff options
context:
space:
mode:
authortwilson <twilson@f38db490-d61c-443f-a65b-d21fe96a405b>2010-09-22 23:00:30 +0000
committertwilson <twilson@f38db490-d61c-443f-a65b-d21fe96a405b>2010-09-22 23:00:30 +0000
commitd0e3394182de9145f418608e6a2da8c8da61251a (patch)
tree72131b1866d5132bb5cd88ac891379470f0721ab /channels
parent0622c488f91f8bd62902cf4a66972711fc86cb91 (diff)
Don't let a Local channel get bridged to itself
If a local channel gets bridged to itself, it becomes orphaned with no devices left to actually tell it to hang up. This patch modifies local_fixup() to detect this case and deny it. Review: https://reviewboard.asterisk.org/r/934 git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@288499 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels')
-rw-r--r--channels/chan_local.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/channels/chan_local.c b/channels/chan_local.c
index 5f17e1814..da133393c 100644
--- a/channels/chan_local.c
+++ b/channels/chan_local.c
@@ -442,6 +442,15 @@ static int local_fixup(struct ast_channel *oldchan, struct ast_channel *newchan)
p->owner = newchan;
else
p->chan = newchan;
+
+ /* Do not let a masquerade cause a Local channel to be bridged to itself! */
+ if (p->owner->_bridge == p->chan || p->chan->_bridge == p->owner) {
+ ast_log(LOG_WARNING, "You can not bridge a Local channel to itself!\n");
+ ast_mutex_unlock(&p->lock);
+ ast_queue_hangup(newchan);
+ return -1;
+ }
+
ast_mutex_unlock(&p->lock);
return 0;
}