From: Alan T. DeKok Date: Tue, 15 Sep 2015 13:22:38 +0000 (-0400) Subject: Allow dots in policy / module names. Fixes #1237 X-Git-Tag: release_3_0_10~92 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1d089f8a1527c6fe4e095204a720ebf62cc55116;p=thirdparty%2Ffreeradius-server.git Allow dots in policy / module names. Fixes #1237 --- diff --git a/src/main/modcall.c b/src/main/modcall.c index ac6b4b6618b..0cc3f1eb351 100644 --- a/src/main/modcall.c +++ b/src/main/modcall.c @@ -2153,7 +2153,7 @@ static int all_children_are_modules(CONF_SECTION *cs, char const *name) * If it's "foo.method", look for "foo", and return "method" as the method * we wish to use, instead of the input component. */ -static CONF_SECTION *virtual_module_find_cs(char const *virtual_name, char const *method_name, +static CONF_SECTION *virtual_module_find_cs(char const *real_name, char const *virtual_name, char const *method_name, rlm_components_t *pcomponent) { CONF_SECTION *cs, *subcs; @@ -2170,9 +2170,12 @@ static CONF_SECTION *virtual_module_find_cs(char const *virtual_name, char const if (strcmp(comp2str[i], method_name) == 0) break; } - if (i == MOD_COUNT) return NULL; - - method = i; + if (i != MOD_COUNT) { + method = i; + } else { + method_name = NULL; + virtual_name = real_name; + } } /* @@ -2511,14 +2514,14 @@ static modcallable *do_compile_modsingle(modcallable *parent, subcs = NULL; p = strrchr(modrefname, '.'); if (!p) { - subcs = virtual_module_find_cs(modrefname, NULL, &method); + subcs = virtual_module_find_cs(modrefname, modrefname, NULL, &method); } else { char buffer[256]; strlcpy(buffer, modrefname, sizeof(buffer)); buffer[p - modrefname] = '\0'; - subcs = virtual_module_find_cs(buffer, buffer + (p - modrefname) + 1, &method); + subcs = virtual_module_find_cs(modrefname, buffer, buffer + (p - modrefname) + 1, &method); } /* diff --git a/src/tests/keywords/radiusd.conf b/src/tests/keywords/radiusd.conf index a57d7097c54..3b4521a96ce 100644 --- a/src/tests/keywords/radiusd.conf +++ b/src/tests/keywords/radiusd.conf @@ -88,6 +88,10 @@ policy { virtual_policy { ok } + + with.dots { + ok + } } instantiate { diff --git a/src/tests/keywords/with_dots b/src/tests/keywords/with_dots new file mode 100644 index 00000000000..4fc6b06fb56 --- /dev/null +++ b/src/tests/keywords/with_dots @@ -0,0 +1,19 @@ +# +# PRE: update +# + +# +# Ensure that policies can have dots. +# +# The main problem is that conf section references +# also have dots in them... +# +with.dots + +update control { + Cleartext-Password := 'hello' +} + +update reply { + Filter-Id := "filter" +}