[asterisk-dev] [Code Review] 2684: Fix exposure of template-only config sections

wdoekes reviewboard at asterisk.org
Mon Aug 5 09:45:10 CDT 2013


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


Can't reproduce.

My asterisk-trunk skips [directories](!).
I broke a path, and it starts only when I added "(!)", which leads me to believe that it doesn't read it then.


/trunk/main/config.c
<https://reviewboard.asterisk.org/r/2684/#comment18371>

    Looks to me like your fix *creates* broken behaviour instead of fixing it.
    
    As far as I can tell, that flag 1 means "include ignored/templates".
    
    static struct ast_category *category_get(const struct ast_config *config, const char *category_name, int ignored)
    ...
      if (cat->name == category_name && (ignored || !cat->ignored))
        return cat;
    
    cat->ignored is set if "!" is encountered. The passed variable should be named "include_ignored", and it should be 0 when we don't want templates.
    
    (0 || !1) == false => skip templates


- wdoekes


On July 18, 2013, 1:44 p.m., Russell Bryant wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/2684/
> -----------------------------------------------------------
> 
> (Updated July 18, 2013, 1:44 p.m.)
> 
> 
> Review request for Asterisk Developers.
> 
> 
> Repository: Asterisk
> 
> 
> Description
> -------
> 
> While working on a deployment, I had to change the [directories] section of asterisk.conf from the defaults.  That worked.  Later I noticed that the directories section was defined as a template-only section like so:
> 
>     [directories](!)
> 
> which means my changes should *not* have taken effect.  This one line change fixes that.
> 
> As a side note, while looking at this, I noticed multiple cases of comparing against a category name like this throughout the file, which seems wrong:
> 
> from ast_category_delete()
> 
>                 if (cat->name == category) {
> 
> from ast_variable_browse()
> 
>         if (config->last_browse && (config->last_browse->name == category)) {
> 
> etc.
> 
> 
> Diffs
> -----
> 
>   /trunk/main/config.c 394685 
> 
> Diff: https://reviewboard.asterisk.org/r/2684/diff/
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> Russell Bryant
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20130805/e06062c6/attachment-0001.htm>


More information about the asterisk-dev mailing list