frame->result = result;
frame->priority = -1;
frame->unwind = UNLANG_TYPE_NULL;
- frame->if_taken = false;
frame->resume = false;
frame->state = NULL;
}
*/
if (!condition) {
RDEBUG2(" ...");
- frame->if_taken = false;
if (*presult != RLM_MODULE_UNKNOWN) *priority = instruction->actions[*presult];
}
/*
- * We took the "if". Go recurse into its' children.
- */
- frame->if_taken = true;
-
- return unlang_group(request, stack, presult, priority);
-}
-
-static unlang_action_t unlang_elsif(REQUEST *request, unlang_stack_t *stack,
- rlm_rcode_t *presult, int *priority)
-{
- unlang_stack_frame_t *frame = &stack->frame[stack->depth];
- unlang_t *instruction = frame->instruction;
-
- /*
- * Like UNLANG_TYPE_ELSE, but allow for a later "else"
- */
- if (frame->if_taken) {
- RDEBUG2("... skipping %s for request %" PRIu64 ": Preceding \"if\" was taken",
- unlang_ops[instruction->type].name, request->number);
- frame->if_taken = true;
- return UNLANG_ACTION_CONTINUE;
- }
-
- /*
- * Check the "if" condition.
+ * Tell the main interpreter to skip over the else /
+ * elsif blocks, as this "if" condition was taken.
*/
- return unlang_if(request, stack, presult, priority);
-}
-
-static unlang_action_t unlang_else(REQUEST *request, unlang_stack_t *stack,
- rlm_rcode_t *presult, int *priority)
-{
- unlang_stack_frame_t *frame = &stack->frame[stack->depth];
- unlang_t *instruction = frame->instruction;
-
- if (frame->if_taken) {
- RDEBUG2("... skipping %s for request %" PRIu64 ": Preceding \"if\" was taken",
- unlang_ops[instruction->type].name, request->number);
- frame->if_taken = false;
-
- *presult = RLM_MODULE_NOOP;
- *priority = instruction->actions[RLM_MODULE_NOOP];
- return UNLANG_ACTION_CONTINUE;
+ while (frame->next &&
+ ((frame->next->type == UNLANG_TYPE_ELSE) ||
+ (frame->next->type == UNLANG_TYPE_ELSIF))) {
+ frame->next = frame->next->next;
}
/*
- * We need to process it. Go do that.
+ * We took the "if". Go recurse into its' children.
*/
- frame->if_taken = false;
-
return unlang_group(request, stack, presult, priority);
}
+
static unlang_action_t unlang_module_resumption(REQUEST *request, unlang_stack_t *stack,
rlm_rcode_t *presult, int *priority)
{
},
[UNLANG_TYPE_ELSE] = {
.name = "else",
- .func = unlang_else,
+ .func = unlang_group,
.debug_braces = true
},
[UNLANG_TYPE_ELSIF] = {
.name = "elsif",
- .func = unlang_elsif,
+ .func = unlang_if,
.debug_braces = true
},
[UNLANG_TYPE_UPDATE] = {
*/
while (frame->instruction != NULL) {
resume_subsection:
+ frame->next = frame->instruction->next;
instruction = frame->instruction;
DUMP_STACK;
} /* switch over return code from the interpreter function */
frame->instruction = frame->next;
- if (frame->instruction) frame->next = frame->instruction->next;
}
RDEBUG4("** [%i] %s - done current subsection with (%s %d)",