tiny patch to fix expansion of variables in $INCLUDED files

Tariq Rashid tariq.rashid at uk.easynet.net
Wed Sep 28 13:03:51 CEST 2005


this follows on from the discussion on the -users mailing list:
	http://www.mail-archive.com/freeradius-users@lists.freeradius.org/msg20024.html
and solution announced:
	http://www.mail-archive.com/freeradius-users@lists.freeradius.org/msg20320.html


problem:
	variables declated in the radiusd.conf or included files were not being expanded in subsequent included files. for example declaring a = b in radiusd.conf would not expand ${a} in an included proxy.conf

solution:
	the inclusion of a file creates (alloc) a new conf section - called "main" - different to the real top-level "main". when trying to expand the variable, the current scope (eg "realm") is searched, and if it fails the parent "main" is searched. except its the temporary one, not the main one. this is proved by various tests - including debugging output showing the searches in progress iterating over planted items in the temporary "main" conf section. this solution properly links the new temporary conf to the real "main" section. 

testing:
	it works fine here - and has been for a a few days.


see below for the tiny patch ... applied to 1.0.2 but the problem and solution are also applicable to 1.0.5

tariq rashid



--- freeradius-1.0.2/src/main/conffile.c        2004-04-06 19:00:57.000000000 +0100
+++ freeradius-1.0.2-patched/src/main/conffile.c        2005-09-26 15:18:47.000000000 +0100
@@ -669,7 +669,7 @@
 
                        DEBUG2( "Config:   including file: %s", value );
 
-                       if ((is = conf_read(cf, *lineno, value, parent)) == NULL) {
+                       if ((is = conf_read(cf, *lineno, value, cs)) == NULL) {
                                cf_section_free(&cs);
                                return NULL;
                        }




More information about the Freeradius-Devel mailing list