help-gnu-radius
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-gnu-radius] Ascend-Data-Filter syntax


From: Sergey Poznyakoff
Subject: Re: [Help-gnu-radius] Ascend-Data-Filter syntax
Date: Fri, 18 Jun 2004 01:11:43 +0300

Sergey Poznyakoff wrote:

> I'll check it out again and send you a patch
[...]

Here it goes (attached). To apply, do the following:

     cd radius-1.2
     patch -p1 < patchfile

Regards,
Sergey

--- orig/radius-1.2/lib/ascend.c        Fri Nov 28 15:39:17 2003
+++ radius-1.2/lib/ascend.c     Fri Jun 18 01:06:20 2004
@@ -522,21 +522,30 @@ _get_port(struct ascend_parse_buf *pb)
        return dir;
 }
 
+/* Return value:
+   0 - No port specification found
+   1 - Port specification is found and processed
+   -1 - Parse error pb->errmsg *might* contain diagnostics */
 int
 _ascend_parse_port_clause(struct ascend_parse_buf *pb)
 {
-       int n = _get_port(pb);
+       int n;
+
+        if (_get_direction_type(pb, "port", 1) == ASCEND_DIR_NONE)
+               return 0;
+       
+       n = _get_port(pb);
 
        if (n == ASCEND_DIR_NONE)
-               return 1;
+               return -1;
        if (_get_direction_type(pb, "port", 1) != ASCEND_DIR_NONE) {
                int n1 = _get_port(pb);
                if (n1 == ASCEND_DIR_NONE)
-                       return 1;
+                       return -1;
                if (n1 == n) {
                        asprintf(pb->errmsg,
-                                _("Duplicate IP specification"));
-                       return 1;
+                                _("Duplicate port specification"));
+                       return -1;
                }
        }
        return 0;
@@ -570,7 +579,8 @@ _ascend_parse_ip(struct ascend_parse_buf
                        return 1;
                if (_moreinput(pb)) {
                        char *tok;
-                       if (_ascend_parse_port_clause(pb))
+                        int have_port = _ascend_parse_port_clause(pb);
+                       if (have_port == -1)
                                return 1;
                        tok = _get_token(pb, 0);
                        if (!tok)
@@ -579,7 +589,9 @@ _ascend_parse_ip(struct ascend_parse_buf
                                pb->flt->v.ip.established = 1;
                        else {
                                asprintf(pb->errmsg,
-                                        _("Expected `est' but found `%s'"),
+                                        have_port ?
+                                        _("Expected `est' but found `%s'") :
+                                        _("Expected `{src|dst}port' or `est', 
but found `%s'"),
                                         tok);
                                return 1;
                        }
     



reply via email to

[Prev in Thread] Current Thread [Next in Thread]