]> git.ipfire.org Git - thirdparty/asterisk.git/commit
config.c Make ast_variable_update update last match.
authorNaveen Albert <asterisk@phreaknet.org>
Wed, 23 Oct 2024 12:34:07 +0000 (08:34 -0400)
committerasterisk-org-access-app[bot] <120671045+asterisk-org-access-app[bot]@users.noreply.github.com>
Tue, 12 Nov 2024 19:58:32 +0000 (19:58 +0000)
commit3cab4e7ab4a3ae483430d5f5e8fa167d02a8128c
treed1e2d98a76dd99bb655b68dee74871df4d04162d
parent7173c92d9f385d272b267f465af63aa145cf4bde
config.c Make ast_variable_update update last match.

ast_variable_update currently sets the first match for a variable, as
opposed to the last one. This issue is complementary to that raised
in #244.

This is incorrect and results in the wrong (or no) action being taken
in cases where a section inherits from a template section. When the
traversal occurs to update the setting, the existing code erroneously
would use the first of possibly multiple matches in its update logic,
which is wrong. Now, explicitly use the last match in the traversal,
which will ensure that the actual setting is updated properly, and
not skipped or ignored because a template from which the setting's
section inherits was used for comparison.

Resolves: #960

UpgradeNote: Config variables, when set/updated, such as via AMI,
will now have the corresponding setting updated, even if their
sections inherit from template sections.
main/config.c