]> git.ipfire.org Git - thirdparty/asterisk.git/commit
config: Make text_file_save and 'dialplan save' escape semicolons in values.
authorGeorge Joseph <george.joseph@fairview5.com>
Wed, 5 Nov 2014 00:11:45 +0000 (00:11 +0000)
committerGeorge Joseph <george.joseph@fairview5.com>
Wed, 5 Nov 2014 00:11:45 +0000 (00:11 +0000)
commitd81e9a98e2ed1501b33411c8ecf8736efd2b7437
treeda7f0189eb275ac0e3c5c7d8b6c6bd64ebb71472
parentc84324aeea94cb2d4f258975f92ebb24b5494660
config: Make text_file_save and 'dialplan save' escape semicolons in values.

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.

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

Tested-by: George Joseph
ASTERISK-20127 #close

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

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/12@427275 65c4cc65-6c06-0410-ace0-fbb531ad65f3
include/asterisk/utils.h
main/config.c
main/utils.c
pbx/pbx_config.c
tests/test_strings.c