]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
"call" can only be used in a "subrequest" section.
authorAlan T. DeKok <aland@freeradius.org>
Thu, 14 Sep 2017 17:47:00 +0000 (13:47 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Thu, 14 Sep 2017 23:30:32 +0000 (19:30 -0400)
For now, until we get more code written

src/main/unlang_compile.c

index aee3c8c9ae0bd18e10a4ee59bbe979fb24ff3a1c..124ca89855df9e3ca850c86d5c994687465dd8e1 100644 (file)
@@ -2568,6 +2568,21 @@ static unlang_t *compile_call(unlang_t *parent, unlang_compile_t *unlang_ctx, CO
        char *packet;
        CONF_SECTION *server_cs, *root;
 
+       /*
+        *      calls with a normal packet are not allowed.  It will
+        *      work, but we don't know what it means.  If someone has
+        *      a good use-case, we can try enabling it.
+        */
+       for (c = parent; c != NULL; c = c->parent) {
+               if (c->type == UNLANG_TYPE_SUBREQUEST) break;
+       }
+
+       if (!c) {
+               cf_log_err(cs, "'%s' can only be used inside of a 'subrequest' section",
+                          unlang_ops[mod_type].name);
+               return NULL;
+       }
+
        name2 = cf_section_name2(cs);
        if (!name2) {
                cf_log_err(cs, "'call' must be given with a server.PACKET argument");