]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
hack to allow nested attributes
authorAlan T. DeKok <aland@freeradius.org>
Tue, 4 Jul 2023 14:27:13 +0000 (10:27 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Tue, 4 Jul 2023 14:28:41 +0000 (10:28 -0400)
src/lib/server/password.c

index e282b0eb9a351b0776ee6445a84e0c468f89ac32..cb0347ea8ed72091a37850649c8cd6136029ad14 100644 (file)
@@ -965,6 +965,7 @@ fr_pair_t *password_find(bool *ephemeral, TALLOC_CTX *ctx, request_t *request,
 {
        fr_dcursor_t    cursor;
        fr_pair_t       *known_good;
+       fr_pair_t       *password_tlv;
 
        if (fr_pair_find_by_da(&request->control_pairs, NULL, attr_user) != NULL) {
                RWDEBUG("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
@@ -975,7 +976,17 @@ fr_pair_t *password_find(bool *ephemeral, TALLOC_CTX *ctx, request_t *request,
                RWDEBUG("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
        }
 
-       for (known_good = fr_pair_dcursor_by_ancestor_init(&cursor, &request->control_pairs, attr_root);
+       /*
+        *      Allow nested (or not);
+        */
+       password_tlv = fr_pair_find_by_da(&request->control_pairs, NULL, attr_root);
+       if (!password_tlv) {
+               known_good = fr_pair_dcursor_by_ancestor_init(&cursor, &request->control_pairs, attr_root);
+       } else {
+               known_good = fr_pair_dcursor_init(&cursor, &password_tlv->vp_group);
+       }
+
+       for ( /* nothing */;
             known_good;
             known_good = fr_dcursor_next(&cursor)) {
                password_info_t         *info;