]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
parse ":V" in fr_pair_make()
authorAlan T. DeKok <aland@freeradius.org>
Tue, 25 Feb 2025 15:49:06 +0000 (10:49 -0500)
committerAlan T. DeKok <aland@freeradius.org>
Tue, 25 Feb 2025 15:49:06 +0000 (10:49 -0500)
src/lib/pair.c

index 50cc1e9be787529c98fb3ce1e5867262e5f86abf..545fcfd053a6b9d718821e9bc742adf9bdee810a 100644 (file)
@@ -1620,7 +1620,10 @@ VALUE_PAIR *fr_pair_make(TALLOC_CTX *ctx, VALUE_PAIR **vps,
                         if (tc && !*tc && TAG_VALID_ZERO(tag))
                                 *ts = '\0';
                         else tag = TAG_ANY;
+                } else if (ts[1] == 'V') {
+                        tag = TAG_VALUE;
                 } else {
+                invalid_tag:
                         fr_strerror_printf("Invalid tag for attribute %s", attribute);
                         return NULL;
                 }
@@ -1638,6 +1641,11 @@ VALUE_PAIR *fr_pair_make(TALLOC_CTX *ctx, VALUE_PAIR **vps,
                return vp;
        }
 
+       /*
+        *      Can only use tags when the DA says that it supports tags.
+        */
+       if (!da->flags.has_tag && found_tag) goto invalid_tag;
+
        /*      Check for a tag in the 'Merit' format of:
         *      :Tag:Value.  Print an error if we already found
         *      a tag in the Attribute.
@@ -1645,7 +1653,7 @@ VALUE_PAIR *fr_pair_make(TALLOC_CTX *ctx, VALUE_PAIR **vps,
 
        if (value && (*value == ':' && da->flags.has_tag)) {
                /* If we already found a tag, this is invalid */
-               if(found_tag) {
+               if(found_tag && (tag != TAG_VALUE)) {
                        fr_strerror_printf("Duplicate tag %s for attribute %s",
                                   value, da->name);
                        DEBUG("Duplicate tag %s for attribute %s\n",