[Home]

Summary:ASTERISK-16660: [patch] res_agi.c:handle_getvariablefull() failes to unlock channel if given channel name of the channel that AGI is running on
Reporter:mdu113 (mdu113)Labels:
Date Opened:2010-09-08 12:26:17Date Closed:2010-09-30 12:09:50
Priority:MajorRegression?No
Status:Closed/CompleteComponents:Resources/res_agi
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) res_agi.c.diff
( 1) res_agi.c.diff2
( 2) res_agi.c.diff3
Description:AGI command GET FULL VARIABLE supports operating on a channel given as a channel name and it is perfectly OK to supply channel name of the channel it's running on, i.e. perl example would be:


my $channel=$agi->get_variable("CHANNEL");
my $res=$agi->get_full_variable("somevar",$channel)

In this case handle_getvariablefull() fails to unlock channel resulting in deadlocked asterisk. It fails to unlock it because condition at line 1254 of res_agi.c in this case evaluates to false (chan2 is actually == chan)
I've attached a simple patch to fix it
Comments:By: Leif Madsen (lmadsen) 2010-09-09 12:51:47

Thanks for the patch! This will be handled as soon as a developer is able to review it.

By: mdu113 (mdu113) 2010-09-13 15:54:23

I've uploaded another patch. I guess this one is better

By: mdu113 (mdu113) 2010-09-17 09:31:11

Hm, don't know what I was thinking. Negation in res_agi.c.diff2 is incorrect. Should be strncasecmp(chan->name,argv[4],strlen(chan->name)), not !strncasecmp(chan->name,argv[4],strlen(chan->name)).
Apologies...

By: Digium Subversion (svnbot) 2010-09-30 12:08:21

Repository: asterisk
Revision: 289500

U   branches/1.4/res/res_agi.c

------------------------------------------------------------------------
r289500 | bbryant | 2010-09-30 12:08:20 -0500 (Thu, 30 Sep 2010) | 11 lines

res_agi.c:handle_getvariablefull() could recursively lock a channel and not
release it if an argument is the current channel's name.

(closes issue ASTERISK-16660)
Reported by: mdu113
Patches:
     res_agi.c.diff3 uploaded by mdu113 (license 582)
     Tested by: mdu113

     Review: https://reviewboard.asterisk.org/r/947/

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=289500

By: Digium Subversion (svnbot) 2010-09-30 12:09:49

Repository: asterisk
Revision: 289501

_U  branches/1.6.2/
U   branches/1.6.2/res/res_agi.c

------------------------------------------------------------------------
r289501 | bbryant | 2010-09-30 12:09:49 -0500 (Thu, 30 Sep 2010) | 18 lines

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

........
 r289500 | bbryant | 2010-09-30 13:08:20 -0400 (Thu, 30 Sep 2010) | 11 lines
 
 res_agi.c:handle_getvariablefull() could recursively lock a channel and not
 release it if an argument is the current channel's name.
 
 (closes issue ASTERISK-16660)
 Reported by: mdu113
 Patches:
       res_agi.c.diff3 uploaded by mdu113 (license 582)
       Tested by: mdu113
 
       Review: https://reviewboard.asterisk.org/r/947/
........

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=289501