]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
remove xlat_eval_pair() now that nothing sets VT_XLAT
authorAlan T. DeKok <aland@freeradius.org>
Fri, 10 Dec 2021 23:40:04 +0000 (18:40 -0500)
committerAlan T. DeKok <aland@freeradius.org>
Fri, 10 Dec 2021 23:40:04 +0000 (18:40 -0500)
and update radius_pairmove() to no longer take "do_xlat" flag

src/lib/server/paircmp.c
src/lib/server/pairmove.c
src/lib/server/pairmove.h
src/lib/unlang/xlat.h
src/lib/unlang/xlat_eval.c
src/modules/rlm_files/rlm_files.c
src/modules/rlm_mruby/rlm_mruby.c
src/modules/rlm_python/rlm_python.c
src/modules/rlm_rest/rest.c
src/modules/rlm_sql/rlm_sql.c

index c5a0d33403f2b6416436e79b2fe0641ce5dbc672..dbcf67536a23c42598882c44d6f4cf50ea022910 100644 (file)
@@ -582,12 +582,6 @@ int paircmp(request_t *request,
                 */
                if (check_item->op == T_OP_CMP_FALSE) return -1;
 
-               /*
-                *      We've got to xlat the string before doing
-                *      the comparison.
-                */
-               xlat_eval_pair(request, check_item);
-
                /*
                 *      OK it is present now compare them.
                 */
index 69d9c55e212ae87d5a8bd46b6089e9e964ca3973..9f217e4896a3ed44228b0668e1694953d19c5765 100644 (file)
@@ -42,7 +42,7 @@ RCSID("$Id$")
  *     only fr_pair_list_copy() those attributes that we're really going to
  *     use.
  */
-void radius_pairmove(request_t *request, fr_pair_list_t *to, fr_pair_list_t *from, bool do_xlat)
+void radius_pairmove(request_t *request, fr_pair_list_t *to, fr_pair_list_t *from)
 {
        int             i, j, count, to_count, tailto;
        fr_pair_t       *from_vp, *next_from, *to_vp, *next_to = NULL;
@@ -96,8 +96,6 @@ void radius_pairmove(request_t *request, fr_pair_list_t *to, fr_pair_list_t *fro
 
                RDEBUG4("::: Examining %s", from_vp->da->name);
 
-               if (do_xlat) xlat_eval_pair(request, from_vp);
-
                /*
                 *      Attribute should be appended, OR the "to" list
                 *      is empty, and we're supposed to replace or
index 97b2035a32e6e3aa0884b36e59eba95be9a06430..40993bc17108d4c021cd48aeee915c4c22c94a39 100644 (file)
@@ -32,7 +32,7 @@ RCSIDH(pairmove_h, "$Id$")
 extern "C" {
 #endif
 
-void   radius_pairmove(request_t *request, fr_pair_list_t *to, fr_pair_list_t *from, bool do_xlat) CC_HINT(nonnull);
+void   radius_pairmove(request_t *request, fr_pair_list_t *to, fr_pair_list_t *from) CC_HINT(nonnull);
 
 #ifdef __cplusplus
 }
index f5d8e559551bc334575da055c7fd72bb7db52fe1..c11b7c24ba69111b01f9b286a5db1d9c63af6643 100644 (file)
@@ -289,8 +289,6 @@ int         xlat_aeval_compiled_argv(TALLOC_CTX *ctx, char ***argv, request_t *request,
 
 int            xlat_flatten_compiled_argv(TALLOC_CTX *ctx, xlat_exp_t const ***argv, xlat_exp_t const *xlat);
 
-int            xlat_eval_pair(request_t *request, fr_pair_t *vp);
-
 bool           xlat_async_required(xlat_exp_t const *xlat);
 
 ssize_t                xlat_tokenize_ephemeral(TALLOC_CTX *ctx, xlat_exp_t **head,
index 19015f572edce799e6e09c61e462a4bb459c3618..70acc38f13d79c85e0c77f36a4216adfa15c3760 100644 (file)
@@ -1647,55 +1647,6 @@ int xlat_flatten_compiled_argv(TALLOC_CTX *ctx, xlat_exp_t const ***argv, xlat_e
        return count;
 }
 
-/** Expands an attribute marked with fr_pair_mark_xlat
- *
- * Writes the new value to the vp.
- *
- * @param request Current request.
- * @param vp to expand.
- * @return On failure pair will still no longer be marked for xlat expansion.
- *     - 0 if successful.
- *     - -1 On xlat failure.
- *     - -2 On parse failure.
- */
-int xlat_eval_pair(request_t *request, fr_pair_t *vp)
-{
-       ssize_t slen;
-
-       char *expanded = NULL;
-       if (vp->type != VT_XLAT) return 0;
-
-       vp->type = VT_DATA;
-
-       slen = xlat_aeval(request, &expanded, request, vp->xlat, NULL, NULL);
-       talloc_const_free(vp->xlat);
-       vp->xlat = NULL;
-       if (slen < 0) {
-               return -1;
-       }
-
-       /*
-        *      Parse the string into a new value.
-        *
-        *      If the fr_pair_t is being used in a regular expression
-        *      then we just want to copy the new value in unmolested.
-        */
-       if ((vp->op == T_OP_REG_EQ) || (vp->op == T_OP_REG_NE)) {
-               fr_pair_value_bstrdup_buffer(vp, expanded, vp->vp_tainted);
-               talloc_free(expanded);
-               return 0;
-       }
-
-       if (fr_pair_value_from_str(vp, expanded, strlen(expanded), &fr_value_unescape_double, true) < 0){
-               talloc_free(expanded);
-               return -2;
-       }
-
-       talloc_free(expanded);
-
-       return 0;
-}
-
 /** Walk over all xlat nodes (depth first) in a xlat expansion, calling a callback
  *
  * @param[in] exp      to evaluate.
index 0ec935b84b9cff28711d501430d1a34b040cb720..16479bfb4c95db4be028fe3ea909b543d7766899 100644 (file)
@@ -565,7 +565,7 @@ redo:
                                        }
                                }
 
-                               radius_pairmove(request, &request->reply_pairs, &tmp_list, true);
+                               radius_pairmove(request, &request->reply_pairs, &tmp_list);
                        }
                }
 
index c85801cfcde9aee93bab8b5ef50d852fbe649532..c2f973605b9c0cd52dc63e18cb88a2586aa3bf1a 100644 (file)
@@ -385,7 +385,7 @@ static void add_vp_tuple(TALLOC_CTX *ctx, request_t *request, fr_pair_list_t *vp
 
                fr_pair_append(&tmp_list, vp);
        }
-       radius_pairmove(request, vps, &tmp_list, false);
+       radius_pairmove(request, vps, &tmp_list);
 }
 
 static inline int mruby_set_vps(request_t *request, mrb_state *mrb, mrb_value mruby_request,
index 4a6d760905454ebd8face7b0b4a2a1d52b4730e9..12931d4a0bae6cd809b3eee57165e9f152f84d49 100644 (file)
@@ -353,7 +353,7 @@ static void mod_vptuple(TALLOC_CTX *ctx, module_ctx_t const *mctx, request_t *re
 
                fr_pair_append(&tmp_list, vp);
        }
-       radius_pairmove(request, vps, &tmp_list, false);
+       radius_pairmove(request, vps, &tmp_list);
 }
 
 
index eabd0f097fea933fd3bd05f16fb5b79aadfb5f01..5194ce89bf8902d75a348af7814963b7af38c4e9 100644 (file)
@@ -1157,7 +1157,7 @@ static int json_pair_alloc(rlm_rest_t const *instance, rlm_rest_section_t const
                        fr_pair_list_t tmp_list;
                        fr_pair_list_init(&tmp_list);
                        fr_pair_append(&tmp_list, vp);
-                       radius_pairmove(current, vps, &tmp_list, false);
+                       radius_pairmove(current, vps, &tmp_list);
                /*
                 *  If we call json_object_array_get_idx on something that's not an array
                 *  the behaviour appears to be to occasionally segfault.
index c672e411a77c6004739c51e218e7eb1a35094cbd..6b215d906cd40b81ba98e6316e93366da6aaff80 100644 (file)
@@ -934,7 +934,7 @@ static unlang_action_t rlm_sql_process_groups(rlm_rcode_t *p_result,
                                RDEBUG2("&%pP", vp);
                        }
                        REXDENT();
-                       radius_pairmove(request, &request->control_pairs, &check_tmp, true);
+                       radius_pairmove(request, &request->control_pairs, &check_tmp);
 
                        fr_pair_list_free(&check_tmp);
                }
@@ -972,7 +972,7 @@ static unlang_action_t rlm_sql_process_groups(rlm_rcode_t *p_result,
 
                        log_request_pair_list(L_DBG_LVL_2, request, NULL, &reply_tmp, NULL);
 
-                       radius_pairmove(request, &request->reply_pairs, &reply_tmp, true);
+                       radius_pairmove(request, &request->reply_pairs, &reply_tmp);
                        fr_pair_list_free(&reply_tmp);
                /*
                 *      If there's no reply query configured, then we assume
@@ -1315,7 +1315,7 @@ static unlang_action_t CC_HINT(nonnull) mod_authorize(rlm_rcode_t *p_result, mod
                        RDEBUG2("&%pP", vp);
                }
                REXDENT();
-               radius_pairmove(request, &request->control_pairs, &check_tmp, true);
+               radius_pairmove(request, &request->control_pairs, &check_tmp);
 
                rcode = RLM_MODULE_OK;
                fr_pair_list_free(&check_tmp);
@@ -1350,7 +1350,7 @@ static unlang_action_t CC_HINT(nonnull) mod_authorize(rlm_rcode_t *p_result, mod
 
                log_request_pair_list(L_DBG_LVL_2, request, NULL, &reply_tmp, NULL);
 
-               radius_pairmove(request, &request->reply_pairs, &reply_tmp, true);
+               radius_pairmove(request, &request->reply_pairs, &reply_tmp);
 
                rcode = RLM_MODULE_OK;
                fr_pair_list_free(&reply_tmp);