From: Alan T. DeKok Date: Wed, 4 Oct 2023 14:34:32 +0000 (-0400) Subject: allow lists to be updated from exec X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=da52c2f4db252bb75b6f324d66dcf1099555ed3b;p=thirdparty%2Ffreeradius-server.git allow lists to be updated from exec --- diff --git a/src/lib/util/pair_legacy.c b/src/lib/util/pair_legacy.c index f50ef0036c..dbff76ae29 100644 --- a/src/lib/util/pair_legacy.c +++ b/src/lib/util/pair_legacy.c @@ -151,6 +151,11 @@ static ssize_t fr_pair_list_afrom_substr(TALLOC_CTX *ctx, fr_dict_attr_t const * my_list = &(*relative_vp)->vp_group; my_ctx = *relative_vp; } else { + /* + * Be nice to people who expect to see '&' everywhere. + */ + if (*p == '&') p++; + /* * We can find an attribute from the parent, but if the path is fully specified, * then we reset any relative VP. So that the _next_ line we parse cannot use diff --git a/src/tests/keywords/exec-list b/src/tests/keywords/exec-list new file mode 100644 index 0000000000..57af968c23 --- /dev/null +++ b/src/tests/keywords/exec-list @@ -0,0 +1,7 @@ +&request += %exec('/bin/sh', '-c', '/bin/echo \&Reply-Message = foo') + +if !(&Reply-Message == 'foo') { + test_fail +} + +success diff --git a/src/tests/keywords/radius.conf b/src/tests/keywords/radius.conf index 245a969665..f4ea9f7f7d 100644 --- a/src/tests/keywords/radius.conf +++ b/src/tests/keywords/radius.conf @@ -48,6 +48,14 @@ modules { utc = yes } + exec { + wait = yes + input_pairs = &request + shell_escape = yes + env_inherit = no + timeout = 1 + } + mschap { attributes { username = &User-Name