]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
set tag before parsing value
authorAlan T. DeKok <aland@freeradius.org>
Wed, 26 Feb 2025 10:40:56 +0000 (05:40 -0500)
committerAlan T. DeKok <aland@freeradius.org>
Wed, 26 Feb 2025 10:44:50 +0000 (05:44 -0500)
src/main/map.c
src/modules/rlm_ldap/attrmap.c
src/modules/rlm_python/rlm_python.c
src/modules/rlm_python3/rlm_python3.c
src/modules/rlm_sql_map/rlm_sql_map.c

index c6eeed410b4688338d01e143a01949e039cce357..6b6043a30e95ba574cddc0afcb27a8c45c936ebf 100644 (file)
@@ -748,8 +748,10 @@ static int map_exec_to_vp(TALLOC_CTX *ctx, VALUE_PAIR **out, REQUEST *request, v
 
                vp = fr_pair_afrom_da(ctx, map->lhs->tmpl_da);
                if (!vp) return -1;
+
                vp->op = map->op;
                vp->tag = map->lhs->tmpl_tag;
+'
                if (fr_pair_value_from_str(vp, answer, -1) < 0) {
                        fr_pair_list_free(&vp);
                        return -2;
index 05896975b203b1f50097946cc565c38f00ae3360..8e3d1b71e5faeff5f151c24dbca1848a3f05bb95 100644 (file)
@@ -115,6 +115,9 @@ int rlm_ldap_map_getvalue(TALLOC_CTX *ctx, VALUE_PAIR **out, REQUEST *request, v
                        vp = fr_pair_afrom_da(ctx, map->lhs->tmpl_da);
                        rad_assert(vp);
 
+                       vp->op = map->op;
+                       vp->tag = map->lhs->tmpl_tag;
+
                        if (fr_pair_value_from_str(vp, self->values[i]->bv_val, self->values[i]->bv_len) < 0) {
                                char *escaped;
 
@@ -126,7 +129,6 @@ int rlm_ldap_map_getvalue(TALLOC_CTX *ctx, VALUE_PAIR **out, REQUEST *request, v
                                continue;
                        }
 
-                       vp->op = map->op;
                        fr_cursor_insert(&cursor, vp);
 
                        /*
index 412859c06bc33a7485a5c61bfe045f4beb25b5aa..88634cd30fb834f32092844ddfaf7b85d4703bf6 100644 (file)
@@ -347,11 +347,7 @@ static void mod_vptuple(TALLOC_CTX *ctx, REQUEST *request, VALUE_PAIR **vps, PyO
                }
 
                vp->op = op;
-
-               /*
-                *      @todo - use tmpl_cast_to_vp() instead ???
-                */
-               if (vp->da->flags.has_tag) vp->tag = dst.tmpl_tag;
+               vp->tag = dst.tmpl_tag;
 
                if (fr_pair_value_from_str(vp, s2, -1) < 0) {
                        DEBUG("%s - Failed: '%s:%s' %s '%s'", funcname, list_name, s1,
index 4f0f68d7f3416ff362de68b87c09b05b5981826b..52347a8113c3ee0d4818b3322cd9c293791f0835 100644 (file)
@@ -360,11 +360,7 @@ static void mod_vptuple(TALLOC_CTX *ctx, REQUEST *request, VALUE_PAIR **vps, PyO
                }
 
                vp->op = op;
-
-               /*
-                *      @todo - use tmpl_cast_to_vp() instead ???
-                */
-               if (vp->da->flags.has_tag) vp->tag = dst.tmpl_tag;
+               vp->tag = dst.tmpl_tag;
 
                if (fr_pair_value_from_str(vp, s2, -1) < 0) {
                        DEBUG("%s - Failed: '%s:%s' %s '%s'", funcname, list_name, s1,
index 28e263424835d515ac98b9b5fac238b89999a527..9c3f47606d267e683b0a564fc07b36740e5e760b 100644 (file)
@@ -181,6 +181,9 @@ static int sql_map_getvalue(TALLOC_CTX *ctx, VALUE_PAIR **out, REQUEST *request,
                vp = fr_pair_afrom_da(ctx, map->lhs->tmpl_da);
                rad_assert(vp);
 
+               vp->op = map->op;
+               vp->tag = map->lhs->tmpl_tag;
+
                if (fr_pair_value_from_str(vp, value, -1) < 0) {
                        char *escaped;
 
@@ -191,7 +194,6 @@ static int sql_map_getvalue(TALLOC_CTX *ctx, VALUE_PAIR **out, REQUEST *request,
                        break;
                }
 
-               vp->op = map->op;
                fr_cursor_insert(&cursor, vp);
                break;