]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
check that templates without tags don't have tags
authorAlan T. DeKok <aland@freeradius.org>
Thu, 4 Jan 2018 18:33:58 +0000 (13:33 -0500)
committerAlan T. DeKok <aland@freeradius.org>
Thu, 4 Jan 2018 18:34:42 +0000 (13:34 -0500)
and vice versa

src/main/tmpl.c

index 1ee3f1afccd35ea41855558899ce430b0124160f..05d554bde2d8e6246a89e5dfab6bf7e61605968f 100644 (file)
@@ -2415,6 +2415,22 @@ void tmpl_verify(char const *file, int line, vp_tmpl_t const *vpt)
                } else {
                        fr_dict_attr_t const *da;
 
+                       if (!vpt->tmpl_da->flags.has_tag &&
+                           (vpt->tmpl_tag != TAG_ANY)) {
+                               FR_FAULT_LOG("CONSISTENCY CHECK FAILED %s[%u]: TMPL_TYPE_ATTR "
+                                            "da is marked as not having a tag, but the template has a tag",
+                                            file, line);
+                               if (!fr_cond_assert(0)) fr_exit_now(1);
+                       }
+
+                       if (vpt->tmpl_da->flags.has_tag &&
+                           (vpt->tmpl_tag == TAG_ANY)) {
+                               FR_FAULT_LOG("CONSISTENCY CHECK FAILED %s[%u]: TMPL_TYPE_ATTR "
+                                            "da is marked as having a tag, but the template has no tag",
+                                            file, line);
+                               if (!fr_cond_assert(0)) fr_exit_now(1);
+                       }
+
                        /*
                         *      Attribute may be present with multiple names
                         */