]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Fixes for last commit, ported from v3.1.x
authorAlan T. DeKok <aland@freeradius.org>
Sat, 17 Oct 2015 20:45:48 +0000 (16:45 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Sat, 17 Oct 2015 20:45:48 +0000 (16:45 -0400)
src/main/parser.c
src/tests/unit/condition.txt

index abe9db638f41ece9309ed736bab6e91a28eb928e..c80548c23c0416bee37137ba9179b5f9ff19c733 100644 (file)
@@ -1105,21 +1105,24 @@ static ssize_t condition_tokenize(TALLOC_CTX *ctx, CONF_ITEM *ci, char const *st
                                 */
                                if ((c->data.map->lhs->type == TMPL_TYPE_ATTR) &&
                                    (c->data.map->rhs->type == TMPL_TYPE_LITERAL)) {
-                                       PW_TYPE type;
+                                       PW_TYPE type = c->data.map->lhs->tmpl_da->type;
 
                                        switch (c->data.map->lhs->tmpl_da->type) {
                                        case PW_TYPE_IPV4_ADDR:
-                                               type = PW_TYPE_IPV4_PREFIX;
-                                               c->cast = dict_attrbyvalue(PW_CAST_BASE + type, 0);
+                                               if (strchr(c->data.map->rhs->name, '/') != NULL) {
+                                                       type = PW_TYPE_IPV4_PREFIX;
+                                                       c->cast = dict_attrbyvalue(PW_CAST_BASE + type, 0);
+                                               }
                                                break;
 
                                        case PW_TYPE_IPV6_ADDR:
-                                               type = PW_TYPE_IPV6_PREFIX;
-                                               c->cast = dict_attrbyvalue(PW_CAST_BASE + type, 0);
+                                               if (strchr(c->data.map->rhs->name, '/') != NULL) {
+                                                       type = PW_TYPE_IPV6_PREFIX;
+                                                       c->cast = dict_attrbyvalue(PW_CAST_BASE + type, 0);
+                                               }
                                                break;
 
                                        default:
-                                               type = c->data.map->lhs->tmpl_da->type;
                                                break;
                                        }
 
index 122f048fc2630245c2b8eaf7506bdd761d010d62..536450b4da9919de3adce7e1621c8f4e2b6b40ee 100644 (file)
@@ -203,7 +203,7 @@ data <ipv4prefix>&Framed-IP-Address <= 192.168.0.0/16
 
 # All IP address literals should be parsed as prefixes
 condition Framed-IP-Address <= 192.168.0.0/16
-data &Framed-IP-Address <= 192.168.0.0/16
+data <ipv4prefix>&Framed-IP-Address <= 192.168.0.0/16
 
 # string attributes must be string
 condition User-Name == "bob"
@@ -621,10 +621,10 @@ condition &Attr-1 == 'bar'
 data &User-Name == 'bar'
 
 condition &Vendor-11344-Attr-1 == 127.0.0.1
-data &FreeRADIUS-Proxied-To == 127.0.0.1/32
+data &FreeRADIUS-Proxied-To == 127.0.0.1
 
 condition &FreeRADIUS-Attr-1 == 127.0.0.1
-data &FreeRADIUS-Proxied-To == 127.0.0.1/32
+data &FreeRADIUS-Proxied-To == 127.0.0.1
 
 #
 #  Escape the backslashes correctly
@@ -670,4 +670,4 @@ condition &NAS-IP-Address < &PMIP6-Home-IPv4-HoA
 data <ipv4prefix>&NAS-IP-Address < &PMIP6-Home-IPv4-HoA
 
 condition &NAS-IP-Address < 192.168/16
-data <ipv4prefix>&Framed-IP-Address <= 192.168.0.0/16
+data <ipv4prefix>&NAS-IP-Address < 192.168.0.0/16