Skip to content

[bug]: config.c: Template inheritance is incorrect for ast_variable_retrieve #244

Description

@InterLinked1

Severity

Major

Versions

20.0.1 (really all versions, ever)

Components/Modules

config.c

Operating Environment

N/A

Frequency of Occurrence

Constant

Issue Description

Imported from JIRA: https://issues.asterisk.org/jira/browse/ASTERISK-30370

If values are specified in a template and then overridden, behavior is currently wrong when explicitly retrieving a variable, as reading a config line by line will result in the overriden value being used (correct), but explicitly asking for it will return the earliest set value, which is that provided by the template.

As a result, modules can pick up the wrong values when loading config items in this manner, and users can get very confused.

This fixes this by adjusting ast_variable_retrieve to return the last match instead of the first (the equivalent of -1 to the AST_CONFIG function), so that the most recently specified/overridden value is returned and behavior is consistent.

Relevant log output

No response

Asterisk Issue Guidelines

  • Yes, I have read the Asterisk Issue Guidelines

Metadata

Metadata

Assignees

Labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions