]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
clearer error messages
authorAlan T. DeKok <aland@freeradius.org>
Mon, 18 Aug 2025 12:19:23 +0000 (08:19 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Mon, 18 Aug 2025 18:45:53 +0000 (14:45 -0400)
src/lib/util/dict_tokenize.c

index 3d9a4d0478be4973936907d2e55fd9726e6eb8c5..ec199a948a37d2de537337c3d05ea67627294108 100644 (file)
@@ -3278,7 +3278,15 @@ static int _dict_from_file(dict_tokenize_ctx_t *dctx,
                if (argc == 0) continue;
 
                if (argc == 1) {
-                       fr_strerror_const("Invalid syntax - expected keyword followed by arguments");
+                       /*
+                        *      Be nice.
+                        */
+                       if ((strcmp(argv[0], "BEGIN") == 0) ||
+                           (fr_dict_keyword(&parser, keywords, NUM_ELEMENTS(keywords), argv_p[0], NULL))) {
+                               fr_strerror_printf("Keyword %s is missing all of its arguments", argv[0]);
+                       } else {
+                               fr_strerror_printf("Invalid syntax - unknown keyword %s", argv[0]);
+                       }
 
                error:
                        fr_strerror_printf_push("Failed parsing dictionary at %s[%d]", fr_cwd_strip(fn), line);