hi - below is a patch for a small change to conffile.c which enabled me to 
expand variables in $INCLUDED files, which are defined in the main radiusd.conf 
or earlier included files.



*************** static CONF_SECTION *cf_section_read(con
*** 669,675 ****
  
                        DEBUG2( "Config:   including file: %s", value );
  
!                       if ((is = conf_read(cf, *lineno, value, parent)) == 
NULL) {
                                cf_section_free(&cs);
                                return NULL;
                        }
--- 669,675 ----
  
                        DEBUG2( "Config:   including file: %s", value );
  
!                       if ((is = conf_read(cf, *lineno, value, cs)) == NULL) {
                                cf_section_free(&cs);
                                return NULL;
                        }



should i send it to the -dev list? 

it seems to work over here - someone else should have a look as let me know if 
its the wrong thing to do!


to summarise - the problem is this. included files cause a new top-level "main" 
structure to be created - which is later added to the real "main" list of 
variables (conf items). this is fine. when trying to expand a variable, if it 
is not in the current structure (conf section), then the existing code does try 
to go up a level and look in "main" - except its the "local temporary" main, 
and not the real top-level main - so it doesn't find the variable expansion. 
the above patch should fix this by ensuring that the newly alloced conf section 
is linked to the real top-level "main" conf section. in its absence, the 
"parent" being passed to conf_read() seems always to be null ... 

tariq



-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Tariq
Rashid
Sent: 22 September 2005 12:13
To: FreeRadius users mailing list
Subject: RE: custom variable in config files 




i'm having a go at cracking this problem. i've discovered that any variable 
declared in radiusd.conf (var = abc) cannot be expanded when used in $INCLUDED 
files ( ${var} ) ...

i'm seeing that during the search for the $var in the linked list of variables 
... the list (known as main) used for the included files is not the same one as 
 the one used for variables created in radiusd.conf. that is:

        * if i delcare aaa, bbb, ccc in radiusd.conf
        * and i declare xxx, yyy, zzz in proxy.conf
        * then trying to search for ${ccc} in proxy.conf actually traverses 
xxx, yyy, zzz and NOT
                aaa, bb, ccc

so far i think i am seeing the item pairs being added to the wrong list and not 
appended to the proper list? can a more experienced developer have a look to 
confirm? i'm doing this using a combination of radlog() and ddd.

also - why the need for "lineno" in the config item data structures? surely 
this is a bad idea - and prone to error when inlcuding files? what's the lineno 
for included files?


tariq



-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Alan
DeKok
Sent: 15 September 2005 18:56
To: FreeRadius users mailing list
Subject: Re: custom variable in config files 


"Tariq Rashid" <[EMAIL PROTECTED]> wrote:
> thanks for the suggestion and clarification. trying what you suggested gives 
> me ...
> 
>       Config:   including file: /opt/freeradius102/etc/raddb/proxy.conf
>       config: No such entry network_address for string 
> ${network_address}.126:1812
>       Errors reading radiusd.conf

  Ah... I ran into that the other day.  Expanding configuration
variables in $INCLUDE'd files may not work, and I'm not sure why.
It's a bug.

  Alan deKok.

- 
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html

- 
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html

- 
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html

Reply via email to