]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Correct logic for "elsif"
authorAlan T. DeKok <aland@freeradius.org>
Mon, 26 Aug 2013 12:25:40 +0000 (08:25 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Mon, 26 Aug 2013 12:25:40 +0000 (08:25 -0400)
src/main/modcall.c

index 6f017c051f8c2f85e31b99a7de52f93a33690a9b..e12da5bfaa85e3387b23764c9c3dfe4e92d6887f 100644 (file)
@@ -499,14 +499,22 @@ redo:
        if (c->type == MOD_ELSIF) {
                if (!was_if) goto elsif_error;
 
-               if (!if_taken) goto mod_if; /* check the next if */
+               /*
+                *      Like MOD_ELSE, but allow for a later "else"
+                */
+               if (if_taken) {
+                       RDEBUG2("%.*s ... skipping %s for request %d: Preceding \"if\" was taken",
+                               depth + 1, modcall_spaces,
+                               group_name[c->type], request->number);
+                       was_if = true;
+                       if_taken = true;
+                       goto next_sibling;
+               }
 
                /*
-                *      Treat it like an "else", but allow for a later "else".
+                *      Check the "if" condition.
                 */
-               was_if = true;
-               if_taken = false;
-               goto do_children;
+               goto mod_if;
        } /* MOD_ELSIF */
 
        /*
@@ -526,7 +534,7 @@ redo:
                                depth + 1, modcall_spaces,
                                group_name[c->type], request->number);
                        was_if = false;
-                       if_taken = false;       
+                       if_taken = false;
                        goto next_sibling;
                }