]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
don't parse "Foo-Bar" as an attribute for tmpl_is_unresolved()
authorAlan T. DeKok <aland@freeradius.org>
Fri, 8 Jan 2021 16:22:00 +0000 (11:22 -0500)
committerAlan T. DeKok <aland@freeradius.org>
Sat, 9 Jan 2021 20:02:16 +0000 (15:02 -0500)
v4 requires "&" prefixes.  So "&Foo-Bar" is tmpl_is_attr_unresolved()

src/lib/server/cond_tokenize.c

index 7e246d4c7a81d26451b6dfd6463ba50140e86bb4..81cd7826d2d3c2216668d4407609131470225640 100644 (file)
@@ -550,52 +550,6 @@ static ssize_t cond_check_attrs(fr_cond_t *c, fr_sbuff_marker_t *m_lhs, fr_sbuff
                }
        }
 
-       /*
-        *      If the LHS is a bare word, AND it looks like
-        *      an attribute, try to parse it as such.
-        *
-        *      This allows LDAP-Group and SQL-Group to work.
-        *
-        *      The real fix is to just read the config files,
-        *      and do no parsing until after all of the modules
-        *      are loaded.  But that has issues, too.
-        */
-       if (tmpl_is_unresolved(lhs) && (lhs->quote == T_BARE_WORD)) {
-               int hyphens = 0;
-               bool may_be_attr = true;
-               size_t i;
-               ssize_t attr_slen;
-
-               /*
-                *      Backwards compatibility: Allow Foo-Bar,
-                *      e.g. LDAP-Group and SQL-Group.
-                */
-               for (i = 0; i < lhs->len; i++) {
-                       if (!fr_dict_attr_allowed_chars[(uint8_t) lhs->name[i]]) {
-                               may_be_attr = false;
-                               break;
-                       }
-
-                       if (lhs->name[i] == '-') {
-                               hyphens++;
-                       }
-               }
-
-               if (!hyphens || (hyphens > 3)) may_be_attr = false;
-
-               if (may_be_attr) {
-                       attr_slen = tmpl_afrom_attr_str(c->data.map, NULL, &vpt, fr_sbuff_current(m_lhs),
-                                                       &(tmpl_rules_t){
-                                                               .allow_unknown = true,
-                                                               .allow_unresolved = true
-                                                       });
-                       if ((attr_slen > 0) && (vpt->len == lhs->len)) {
-                               talloc_free(lhs);
-                               c->pass2_fixup = PASS2_FIXUP_ATTR;
-                       }
-               }
-       }
-
        return 1;
 }