[Home]

Summary:ASTERISK-20337: iax2 provisioning cache mismanaged
Reporter:John Covert (jcovert)Labels:
Date Opened:2012-08-29 10:16:36Date Closed:2012-09-21 14:07:27
Priority:MajorRegression?Yes
Status:Closed/CompleteComponents:Channels/chan_iax2
Versions:10.7.0 Frequency of
Occurrence
Constant
Related
Issues:
Environment:All. (running on Mac OSX 10.4.11 Power PC)Attachments:( 0) iax2-provision.c.patch
Description:On load, iax2-provision.c routine iax_provision_reload deletes the iax/provisioning/cache tree.  This is good.

Later, when routine iax_provision_version attempts to retrieve the cache entry, the call to ast_db_get is not handled correctly.  ast_db_get returns 0 on success and -1 on failure.  The existing code treats success as failure and vice versa.  As a result, the first call fails, and is treated as success.  The subsequent version check fails, and the cache entry is created.  From now on, each call to ast_db_get succeeds and returns 0 which is treated as a failure and reported.

With the attached patch, the test on the call to ast_db_get is properly handled.  However, since there will always be a failure after reload, the unlock and return must not be done.  Instead, we simply report the error the first time (a correct report, since the cache retrieval did not happen) and go on and build the entry.
Comments:By: Jonathan Rose (jrose) 2012-09-21 13:59:07.841-0500

Sorry about that one. This was my fault and it was introduced in a patch where we were trying to fix a multitude of reports by some static code analysis.

Thanks for fixing this bug, I'm going to go ahead and commit this now.