From: Alan T. DeKok Date: Mon, 22 Aug 2022 21:11:17 +0000 (-0400) Subject: let's be a little more forgiving about parsing conditions X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2e29119e9aabb584b5bbbdd6f9e7fbdfba5abc53;p=thirdparty%2Ffreeradius-server.git let's be a little more forgiving about parsing conditions --- diff --git a/src/lib/server/cf_file.c b/src/lib/server/cf_file.c index 3ab73fcd327..ed8d5d81af1 100644 --- a/src/lib/server/cf_file.c +++ b/src/lib/server/cf_file.c @@ -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; }