]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
better error messages
authorAlan T. DeKok <aland@freeradius.org>
Thu, 21 Nov 2024 18:54:55 +0000 (13:54 -0500)
committerAlan T. DeKok <aland@freeradius.org>
Thu, 21 Nov 2024 18:54:55 +0000 (13:54 -0500)
If I run into a problem because of a typo, and the error message
isn't clear enough to me, then it should be clarified for others, too

src/lib/server/cf_file.c

index bb97a55113bfff0ec9405dd7a838285d4f3e152e..06385100d4ab010107f855fb950772e6615e7f06 100644 (file)
@@ -2559,7 +2559,15 @@ check_for_eol:
                 */
        parse_name2:
                if (!(isalpha((uint8_t) *ptr) || isdigit((uint8_t) *ptr) || (*(uint8_t const *) ptr >= 0x80))) {
-                       return parse_error(stack, ptr, "Invalid second name for configuration section");
+                       /*
+                        *      Maybe they missed a closing brace somewhere?
+                        */
+                       name2_token = gettoken(&ptr, buff[2], stack->bufsize, false); /* can't be EOL */
+                       if (fr_assignment_op[name2_token]) {
+                               return parse_error(stack, ptr2, "Unexpected operator, was expecting a configuration section.  Is there a missing '}' somewhere?");
+                       }
+
+                       return parse_error(stack, ptr2, "Invalid second name for configuration section");
                }
 
                name2_token = gettoken(&ptr, buff[2], stack->bufsize, false); /* can't be EOL */