]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
allow lists to be updated from exec
authorAlan T. DeKok <aland@freeradius.org>
Wed, 4 Oct 2023 14:34:32 +0000 (10:34 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Wed, 4 Oct 2023 14:35:21 +0000 (10:35 -0400)
src/lib/util/pair_legacy.c
src/tests/keywords/exec-list [new file with mode: 0644]
src/tests/keywords/radius.conf

index f50ef0036c17b33299518f4b890cc9dff3e05368..dbff76ae2902619a5e99e4281e2cbe210287309b 100644 (file)
@@ -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 (file)
index 0000000..57af968
--- /dev/null
@@ -0,0 +1,7 @@
+&request += %exec('/bin/sh', '-c', '/bin/echo \&Reply-Message = foo')
+
+if !(&Reply-Message == 'foo') {
+       test_fail
+}
+
+success
index 245a969665a87ea56145100f46928fae4a33e3fc..f4ea9f7f7df64f236df2f4e58d0d2361d08f8ca0 100644 (file)
@@ -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