Skip to content

Commit

Permalink
Can't use "ok = 1" outside of a module call.
Browse files Browse the repository at this point in the history
Only modules can have their return codes updated.  Sections can't.
  • Loading branch information
alandekok committed Jun 20, 2014
1 parent f46bc6f commit e0d5fa1
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/main/modcall.c
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,8 @@ const FR_NAME_NUMBER mod_rcode_table[] = {
};


static char const *group_name[];

/*
* Compile action && rcode for later use.
*/
Expand All @@ -192,6 +194,12 @@ static int compile_action(modcallable *c, CONF_PAIR *cp)
value = cf_pair_value(cp);
if (!value) return 0;

if (c->type != MOD_SINGLE) {
ERROR("%s[%d] Invalid return code assigment inside of a %s section",
cf_pair_filename(cp), cf_pair_lineno(cp), group_name[c->type]);
return 0;
}

if (!strcasecmp(value, "return"))
action = MOD_ACTION_RETURN;

Expand Down
11 changes: 11 additions & 0 deletions src/tests/keywords/if-rcode-error
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# PRE: if
#
# return code in an "if" section.
#
if (User-Name == "bob") {
update reply {
Filter-Id := "filter"
}

ok = reject # ERROR
}

0 comments on commit e0d5fa1

Please sign in to comment.