From 5b93c51773cea79347d2c86cecee3732d762939a Mon Sep 17 00:00:00 2001 From: "Alan T. DeKok" Date: Wed, 4 Sep 2013 08:22:28 -0400 Subject: [PATCH] Update priority from child, too. Closes #424 --- src/main/modcall.c | 37 +++++++++++++++++++++++-------------- 1 file changed, 23 insertions(+), 14 deletions(-) diff --git a/src/main/modcall.c b/src/main/modcall.c index 72c7b3779919..f84459ba6bf4 100644 --- a/src/main/modcall.c +++ b/src/main/modcall.c @@ -390,8 +390,9 @@ static bool modcall_recurse(REQUEST *request, int component, int depth, /* * Call a child of a block. */ -static int modcall_child(REQUEST *request, int component, int depth, - modcall_stack_entry_t *entry, modcallable *c) +static void modcall_child(REQUEST *request, int component, int depth, + modcall_stack_entry_t *entry, modcallable *c, + int *result, int *priority) { modcall_stack_entry_t *next; @@ -410,11 +411,14 @@ static int modcall_child(REQUEST *request, int component, int depth, if (!modcall_recurse(request, component, depth, next)) { - - return RLM_MODULE_FAIL; + *result = RLM_MODULE_FAIL; + return; } - return next->result; + *result = next->result; + *priority = next->priority; + + return; } /* @@ -706,6 +710,7 @@ static bool modcall_recurse(REQUEST *request, int component, int depth, } /* loop over VPs */ result = next->result; + priority = next->priority; MOD_LOG_CLOSE_BRACE(); goto calculate_result; } /* MOD_FOREACH */ @@ -745,8 +750,9 @@ static bool modcall_recurse(REQUEST *request, int component, int depth, g = mod_callabletogroup(c); MOD_LOG_OPEN_BRACE(group_name[c->type]); - result = modcall_child(request, component, - depth + 1, entry, g->children); + modcall_child(request, component, + depth + 1, entry, g->children, + &result, &priority); MOD_LOG_CLOSE_BRACE(); goto calculate_result; } /* MOD_GROUP */ @@ -798,8 +804,9 @@ static bool modcall_recurse(REQUEST *request, int component, int depth, if (!found) found = null_case; MOD_LOG_OPEN_BRACE(group_name[c->type]); - result = modcall_child(request, component, - depth + 1, entry, found); + modcall_child(request, component, + depth + 1, entry, found, + &result, &priority); MOD_LOG_CLOSE_BRACE(); goto calculate_result; } /* MOD_SWITCH */ @@ -830,9 +837,9 @@ static bool modcall_recurse(REQUEST *request, int component, int depth, MOD_LOG_OPEN_BRACE(group_name[c->type]); if (c->type == MOD_LOAD_BALANCE) { - result = modcall_child(request, component, - depth + 1, entry, found); - + modcall_child(request, component, + depth + 1, entry, found, + &result, &priority); } else { int i; @@ -842,9 +849,11 @@ static bool modcall_recurse(REQUEST *request, int component, int depth, * continue. Otherwise, stop. */ for (i = 1; i < count; i++) { - result = modcall_child(request, component, - depth + 1, entry, found); + modcall_child(request, component, + depth + 1, entry, found, + &result, &priority); if (c->actions[result] == MOD_ACTION_RETURN) { + priority = -1; break; } }