assertion failure in rlm_policy
Hi, if you compare an attribute in rlm_policy if ("%{NAS-Identifier}" =~ ".*_cable_(.*)") { freeradius crashes when it does not exist in the request: [...] rlm_policy: Evaluating policy post-proxy push 0 0x8114c90 pop 0 0x8114c90 Evaluating at line 42 radius_xlat: '' CMP ^.*_cable_(.*) CONDITION COMPARE -1 Assertion failed in evaluate.c, line 646 Aborted The following patch fixes this for me, although i don't know if it is the best way to do it. --- freeradius-snapshot-20050427/src/modules/rlm_policy/evaluate.c 2005-02-14 08:12:24.000000000 +0100 +++ freeradius-snapshot-20050417/src/modules/rlm_policy/evaluate.c 2005-08-11 16:14:45.000000000 +0200 @@ -632,6 +632,13 @@ #ifdef HAVE_REGEX_H case POLICY_LEX_RX_EQUALS: + + /* attribute is not in request */ + if (compare == -1) { + rcode = FALSE; + break; + } + { /* FIXME: copied from src/main/valuepair.c */ int i; regmatch_t rxmatch[REQUEST_MAX_REGEX + 1]; @@ -704,6 +711,13 @@ break; case POLICY_LEX_RX_NOT_EQUALS: + + /* attribute is not in request */ + if (compare == -1) { + rcode = FALSE; + break; + } + regcomp(®, this->rhs, REG_EXTENDED| REG_NOSUB); rad_assert(data != NULL); rcode = regexec(®, data, Regards Stephan Jaeger
participants (1)
-
Stephan Jaeger