]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
let's be a little more forgiving about parsing conditions
authorAlan T. DeKok <aland@freeradius.org>
Mon, 22 Aug 2022 21:11:17 +0000 (17:11 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Tue, 23 Aug 2022 03:01:01 +0000 (23:01 -0400)
src/lib/server/cf_file.c

index 3ab73fcd327aeeb2445e58a9b28970980f4ba086..ed8d5d81af1e4546cc0dfc566388fe5216430373 100644 (file)
@@ -1305,6 +1305,18 @@ static CONF_ITEM *process_if(cf_stack_t *stack)
                p = (uint8_t const *) ptr;
 
                while (*p >= ' ') {
+                       while (isspace((int) *p)) p++;
+
+                       /*
+                        *      Conditions end with ") {"
+                        */
+                       if (depth == 0) {
+                               if (*p == '{') {
+                                       found = true;
+                                       break;
+                               }
+                       }
+
                        if (*p == '(') {
                                depth++;
                                p++;
@@ -1319,21 +1331,6 @@ static CONF_ITEM *process_if(cf_stack_t *stack)
                                        return NULL;
                                }
                                depth--;
-
-                               if (depth > 0) continue;
-
-                               /*
-                                *      Conditions end with ") {"
-                                */
-                               if (depth == 0) {
-                                       while (isspace((int) *p)) p++;
-
-                                       if (*p == '{') {
-                                               found = true;
-                                               break;
-                                       }
-                               }
-
                                continue;
                        }