-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/4132/#review13632
-----------------------------------------------------------


This new function could use some unit tests for nominal and edge cases given 
the off by one issue outlined below.


branches/13/main/utils.c
<https://reviewboard.asterisk.org/r/4132/#comment24144>

    Remove the extra space here.



branches/13/main/utils.c
<https://reviewboard.asterisk.org/r/4132/#comment24145>

    This should be > instead of >= due to the need to write out a null 
terminator along with the escaped semicolon.
    
    Look at the degenerate case of input string ";" with an input buffer of 
length 2 (1 byte usable).



branches/13/pbx/pbx_config.c
<https://reviewboard.asterisk.org/r/4132/#comment24143>

    Put an empty line after the declarations block.



branches/13/pbx/pbx_config.c
<https://reviewboard.asterisk.org/r/4132/#comment24142>

    escaped_len can be declared in the if block.


- opticron


On Oct. 30, 2014, 12:09 p.m., George Joseph wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/4132/
> -----------------------------------------------------------
> 
> (Updated Oct. 30, 2014, 12:09 p.m.)
> 
> 
> Review request for Asterisk Developers and Birger Harzenetter.
> 
> 
> Bugs: ASTERISK-20127
>     https://issues.asterisk.org/jira/browse/ASTERISK-20127
> 
> 
> Repository: Asterisk
> 
> 
> Description
> -------
> 
> I've been locally patching for this issue for 2 years but now someone else 
> (WIMPy) has run into the same problem.
> 
> When a config file is read, an unescaped semicolon signals comments which are 
> stripped from the value before it's stored.  Escaped semicolons are then 
> unescaped and become part of the value.  Both of these behaviors are normal 
> and expected.  When the config is serialized either by 'dialplan save' or 
> AMI/UpdateConfig however, the now unescaped semicolons are written as-is.  If 
> you actually reload the file just saved, the unescaped semicolons are now 
> treated as start of comments.
> 
> Example:
> 
> Lines such as 
> PAGING_HEADER = Call-Info: \;answer-after=0
> are being rewritten as 
> PAGING_HEADER = Call-Info: ;answer-after=0
> 
> On re-read, everything after the now-unescaped semicolon is read as a comment 
> with the result that the file is effectively corrupted.
> 
> So...   Since true comments are stripped on read, any semicolons in 
> ast_variable.value must have been escaped originally.  This patch re-escapes 
> semicolons in ast_variable.values before they're written to file either by 
> 'dialplan save' or config/ast_config_text_file_save which is called by 
> AMI/UpdateConfig. I also fixed a few pre-existing formatting issues nearby in 
> pbx_config.c
> 
> This patch is for 13 but it will be applied to 1.8 -> trunk.
> 
> 
> Diffs
> -----
> 
>   branches/13/pbx/pbx_config.c 426754 
>   branches/13/main/utils.c 426754 
>   branches/13/main/config.c 426754 
>   branches/13/include/asterisk/utils.h 426754 
> 
> Diff: https://reviewboard.asterisk.org/r/4132/diff/
> 
> 
> Testing
> -------
> 
> Testsuite results before and after match.
> tests/manager/config will be updated to test escaped semicolons.
> A new testsuite test will be written to test dialplan save.
> 
> 
> Thanks,
> 
> George Joseph
> 
>

-- 
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

asterisk-dev mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-dev

Reply via email to