[asterisk-bugs] [JIRA] (ASTERISK-26226) pbx: Asterisk crash on AMI action "ShowDialplan" when there's a circular dependency between contexts

Etienne Lessard (JIRA) noreply at issues.asterisk.org
Mon Aug 29 07:27:01 CDT 2016


    [ https://issues.asterisk.org/jira/browse/ASTERISK-26226?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=232076#comment-232076 ] 

Etienne Lessard edited comment on ASTERISK-26226 at 8/29/16 7:25 AM:
---------------------------------------------------------------------

Hi Joshua,

I've finally took some time to push the patch on gerrit (and it's the first time I do so, so I had to go through a bit of documentation).

Reviewboard Link: https://gerrit.asterisk.org/3751 https://gerrit.asterisk.org/3752 https://gerrit.asterisk.org/3753 https://gerrit.asterisk.org/3754


was (Author: hexanol):
Hi Joshua,

I've finally took some time to push the patch on gerrit (and it's the first time I do so, so I had to go through a bit of documentation).

Reviewboard Link: https://gerrit.asterisk.org/3751 https://gerrit.asterisk.org/3752 https://gerrit.asterisk.org/3753 https://gerrit.asterisk.org/3754

I also wanted to left a comment on gerrit but since I don't seem to be able/have the necessary right/don't know how to do, I'll write it here:

Note that although the code does fix the crash, it doesn't produce the totally right result in the following scenario:

* Given context A includes context B, and defines an extension 100
* Given context B includes context A
* Then the output of "ShowDialplan" for extension 100 in context A shows the extension 100 at A 2 times (expected: 1 time)

The problem is that the context A is visited twice in this scenario, because it is not added to the array the first time it is visited. The same bug exist in the show_dialplan_helper function (of course). And there's similar issue if, for example, you have A -> B -> D and A -> C -> D: if extension 100 is defined in context D, it will be shown twice (and note that in this case there's no circular dependencies). The solution would be to make sure each context is visited at most 1 time. If there's interest, I guess I could propose a fix for this problem in another change.

> pbx: Asterisk crash on AMI action "ShowDialplan" when there's a circular dependency between contexts
> ----------------------------------------------------------------------------------------------------
>
>                 Key: ASTERISK-26226
>                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-26226
>             Project: Asterisk
>          Issue Type: Bug
>      Security Level: None
>          Components: Core/PBX
>    Affects Versions: 13.9.1, 13.10.0
>            Reporter: Etienne Lessard
>            Severity: Minor
>         Attachments: AST-26226.patch, backtrace.txt
>
>
> Given I have the following extensions.conf:
> {noformat}
> [C1]
> include = C2
> exten = 100,1,Hangup()
> [C2]
> include = C1
> exten = 101,1,Hangup()
> {noformat}
> Given I have the following manager.conf:
> {noformat}
> [general]
> enabled = yes
> port = 5038
> [foo]
> secret = foo
> write = all
> deny = 0.0.0.0/0.0.0.0
> permit = 127.0.0.1/255.255.255.0
> {noformat}
> When the AMI action "ShowDialplan" is requested with a Context and Extension argument, e.g.:
> {noformat}
> $ netcat 127.0.0.1 5038
> Action: Login
> Username: foo
> Secret: foo
> Action: ShowDialplan
> Context: C1
> Extension: 100
> {noformat}
> Then asterisk crash (it segfaults, caused by an "infinite" recursion)
> I know circular dependencies between contexts are far from being recommended, but sometimes they exist, and I feel like asterisk should handle the case more gracefully than just crashing.
> Note that the problem doesn't show up when doing a similar action via the CLI "dialplan show" command: instead, a warning "pbx.c:5442 show_dialplan_helper: Avoiding circular include of C2 within C1" is displayed



--
This message was sent by Atlassian JIRA
(v6.2#6252)



More information about the asterisk-bugs mailing list