assertion failure in rlm_policy

Stephan Jaeger stephan.jaeger at ewetel.de
Thu Aug 11 16:25:44 CEST 2005


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(&reg, this->rhs, REG_EXTENDED|
REG_NOSUB);
                        rad_assert(data != NULL);
                        rcode = regexec(&reg, data,


Regards

Stephan Jaeger




More information about the Freeradius-Devel mailing list