]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Merged revisions 288500 via svnmerge from
authorTerry Wilson <twilson@digium.com>
Wed, 22 Sep 2010 23:18:27 +0000 (23:18 +0000)
committerTerry Wilson <twilson@digium.com>
Wed, 22 Sep 2010 23:18:27 +0000 (23:18 +0000)
https://origsvn.digium.com/svn/asterisk/branches/1.6.2

................
  r288500 | twilson | 2010-09-22 16:10:09 -0700 (Wed, 22 Sep 2010) | 15 lines

  Merged revisions 288499 via svnmerge from
  https://origsvn.digium.com/svn/asterisk/branches/1.4

  ........
    r288499 | twilson | 2010-09-22 16:00:30 -0700 (Wed, 22 Sep 2010) | 8 lines

    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: https://origsvn.digium.com/svn/asterisk/branches/1.8@288507 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/chan_local.c

index 8d309f5a78414731f829571024cde313f16a5d4f..343e41f90774d72d71e1e640a28bbaef2b6ff55e 100644 (file)
@@ -568,6 +568,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;
 }