]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
limited macro support for sheer simplicity
authorAlan T. DeKok <aland@freeradius.org>
Wed, 12 May 2021 12:52:51 +0000 (08:52 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Wed, 12 May 2021 12:52:51 +0000 (08:52 -0400)
src/lib/util/dict_tokenize.c

index fd8dbbfa58fd8af356605733cd3967be004388b3..bb8927eb458987f286f7283cd41716000829c45e 100644 (file)
@@ -1841,7 +1841,17 @@ static int _dict_from_file(dict_tokenize_ctx_t *ctx,
                         *      parent.
                         */
 
-                       ret = _dict_from_file(ctx, dir, argv[1], fn, line);
+                       /*
+                        *      Allow limited macro capability, so
+                        *      people don't have to remember where
+                        *      the root dictionaries are located.
+                        */
+                       if (strncmp(argv[1], "${dictdir}/", 11) != 0) {
+                               ret = _dict_from_file(ctx, dir, argv[1], fn, line);
+                       } else {
+                               ret = _dict_from_file(ctx, fr_dict_global_ctx_dir(), argv[1] + 11, fn, line);
+                       }
+
                        if ((ret == -2) && (argv[0][8] == '-')) {
                                fr_strerror_clear(); /* delete all errors */
                                ret = 0;