Broken handling switch statement if case section is empty #1274

Closed
michael-dev opened this Issue Sep 27, 2015 · 0 comments

Projects

None yet

1 participant

@michael-dev

I just upgraded an freeradius 2.1.15 to 2.2.8.

The configuration used some value checking like below.

Expected behaviour (as with 2.1.15): fail is only executed when NAS-Identifier is neither AllowedRealm1, AllowedRealm2, BuggyRealm3, BuggyRealm4.

Experienced Behaviour (with 2.2.8): fail is also executed when NAS-Identifier is AllowedRealm1 or AllowedRealm2.

Raddebug shows
Debug: +++case AllowedRealm1 { ... } # empty sub-section is ignored

I've not found this change documented and it think the resulting interpretation is non-intuitive.

Workaround: add noop into the empty sub-section and add the always module:
always noop {
rcode = noop
}

Excerpt from config:
preacct {
switch "%{NAS-Identifier}" {
case "AllowedRealm1" {
}
case "AllowedRealm2" {
}
case "BuggyRealm3" {
... some changes ...
}
case "BuggyRealm4" {
... some changes ...
}
case {
fail
}
}
... some more commands ...
}

@alandekok alandekok closed this in b0399c2 Sep 28, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment