From: Arran Cudbard-Bell Date: Wed, 7 Dec 2016 18:04:42 +0000 (-0500) Subject: Rename xlat public functions s/radius_xlat/xlat_eval/ X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=35dc3e4cdcb0ac9bd365d1914aedb8f5973a0add;p=thirdparty%2Ffreeradius-server.git Rename xlat public functions s/radius_xlat/xlat_eval/ --- diff --git a/src/include/radiusd.h b/src/include/radiusd.h index 4ea1ddabe6d..d261535ef42 100644 --- a/src/include/radiusd.h +++ b/src/include/radiusd.h @@ -547,7 +547,7 @@ int paircompare(REQUEST *request, VALUE_PAIR *req_list, VALUE_PAIR *check, VALUE_PAIR **rep_list); vp_tmpl_t *xlat_to_tmpl_attr(TALLOC_CTX *ctx, xlat_exp_t *xlat); xlat_exp_t *xlat_from_tmpl_attr(TALLOC_CTX *ctx, vp_tmpl_t *vpt); -int radius_xlat_do(REQUEST *request, VALUE_PAIR *vp); +int xlat_eval_do(REQUEST *request, VALUE_PAIR *vp); int radius_compare_vps(REQUEST *request, VALUE_PAIR *check, VALUE_PAIR *vp); int radius_callback_compare(REQUEST *request, VALUE_PAIR *req, VALUE_PAIR *check, VALUE_PAIR *check_pairs, diff --git a/src/include/xlat.h b/src/include/xlat.h index b8b7b18ca2d..d1bc35091ff 100644 --- a/src/include/xlat.h +++ b/src/include/xlat.h @@ -68,19 +68,19 @@ typedef ssize_t (*xlat_func_t)(TALLOC_CTX *ctx, char **out, size_t outlen, */ typedef int (*xlat_instantiate_t)(void *xlat_inst, void *mod_inst, char const *fmt); -ssize_t radius_xlat(char *out, size_t outlen, REQUEST *request, char const *fmt, xlat_escape_t escape, +ssize_t xlat_eval(char *out, size_t outlen, REQUEST *request, char const *fmt, xlat_escape_t escape, void const *escape_ctx) CC_HINT(nonnull (1 ,3 ,4)); -ssize_t radius_xlat_struct(char *out, size_t outlen, REQUEST *request, xlat_exp_t const *xlat, +ssize_t xlat_eval_compiled(char *out, size_t outlen, REQUEST *request, xlat_exp_t const *xlat, xlat_escape_t escape, void const *escape_ctx) CC_HINT(nonnull (1 ,3 ,4)); -ssize_t radius_axlat(TALLOC_CTX *ctx, char **out, REQUEST *request, +ssize_t xlat_aeval(TALLOC_CTX *ctx, char **out, REQUEST *request, char const *fmt, xlat_escape_t escape, void const *escape_ctx) CC_HINT(nonnull (2, 3, 4)); -ssize_t radius_axlat_struct(TALLOC_CTX *ctx, char **out, REQUEST *request, +ssize_t xlat_aeval_compiled(TALLOC_CTX *ctx, char **out, REQUEST *request, xlat_exp_t const *xlat, xlat_escape_t escape, void const *escape_ctx) CC_HINT(nonnull (2, 3, 4)); diff --git a/src/main/auth.c b/src/main/auth.c index 725679329cd..c8c5b805a5f 100644 --- a/src/main/auth.c +++ b/src/main/auth.c @@ -138,7 +138,7 @@ static int rad_authlog(char const *msg, REQUEST *request, int goodpass) if (extra_msg) { extra[0] = ' '; p = extra + 1; - if (radius_xlat(p, sizeof(extra) - 1, request, extra_msg, NULL, NULL) < 0) { + if (xlat_eval(p, sizeof(extra) - 1, request, extra_msg, NULL, NULL) < 0) { return -1; } } else { diff --git a/src/main/cond_eval.c b/src/main/cond_eval.c index 8d30cf93f5c..451230249c2 100644 --- a/src/main/cond_eval.c +++ b/src/main/cond_eval.c @@ -890,7 +890,7 @@ void radius_pairmove(REQUEST *request, VALUE_PAIR **to, VALUE_PAIR *from, bool d RDEBUG4("::: Examining %s", from_list[i]->da->name); - if (do_xlat) radius_xlat_do(request, from_list[i]); + if (do_xlat) xlat_eval_do(request, from_list[i]); /* * Attribute should be appended, OR the "to" list diff --git a/src/main/log.c b/src/main/log.c index 51a17af4860..95051803c62 100644 --- a/src/main/log.c +++ b/src/main/log.c @@ -745,7 +745,7 @@ void vradlog_request(log_type_t type, log_lvl_t lvl, REQUEST *request, char cons /* * Prevent infinitely recursive calls if - * radius_axlat attempts to write to the request log. + * xlat_aeval attempts to write to the request log. */ request->log.func = NULL; @@ -753,7 +753,7 @@ void vradlog_request(log_type_t type, log_lvl_t lvl, REQUEST *request, char cons * This is SLOW! Doing it for every log message * in every request is NOT recommended! */ - if (radius_axlat(request, &exp, request, filename, rad_filename_escape, NULL) < 0) return; + if (xlat_aeval(request, &exp, request, filename, rad_filename_escape, NULL) < 0) return; /* * Restore the original logging function diff --git a/src/main/mainconfig.c b/src/main/mainconfig.c index c3eedb9b97c..7922ffd565c 100644 --- a/src/main/mainconfig.c +++ b/src/main/mainconfig.c @@ -356,7 +356,7 @@ static ssize_t xlat_config(UNUSED TALLOC_CTX *ctx, char **out, size_t outlen, /* * Expand it safely. */ - if (radius_xlat(buffer, sizeof(buffer), request, fmt, config_escape_func, NULL) < 0) return 0; + if (xlat_eval(buffer, sizeof(buffer), request, fmt, config_escape_func, NULL) < 0) return 0; ci = cf_reference_item(request->root->config, request->root->config, buffer); diff --git a/src/main/map.c b/src/main/map.c index 03d4cc2b55f..fa227d592b3 100644 --- a/src/main/map.c +++ b/src/main/map.c @@ -815,7 +815,7 @@ int map_to_vp(TALLOC_CTX *ctx, VALUE_PAIR **out, REQUEST *request, vp_map_t cons if (!new) return -1; /* - * We do the debug printing because radius_axlat_struct + * We do the debug printing because xlat_aeval_compiled * doesn't have access to the original string. It's been * mangled during the parsing to xlat_exp_t */ @@ -823,7 +823,7 @@ int map_to_vp(TALLOC_CTX *ctx, VALUE_PAIR **out, REQUEST *request, vp_map_t cons RINDENT(); str = NULL; - slen = radius_axlat_struct(request, &str, request, map->rhs->tmpl_xlat, NULL, NULL); + slen = xlat_aeval_compiled(request, &str, request, map->rhs->tmpl_xlat, NULL, NULL); REXDENT(); if (slen < 0) { @@ -852,7 +852,7 @@ int map_to_vp(TALLOC_CTX *ctx, VALUE_PAIR **out, REQUEST *request, vp_map_t cons if (!new) return -1; str = NULL; - slen = radius_axlat(request, &str, request, map->rhs->name, NULL, NULL); + slen = xlat_aeval(request, &str, request, map->rhs->name, NULL, NULL); if (slen < 0) { rcode = slen; goto error; diff --git a/src/main/pair.c b/src/main/pair.c index 6af388bf3b0..154a789e2bf 100644 --- a/src/main/pair.c +++ b/src/main/pair.c @@ -578,7 +578,7 @@ int paircompare(REQUEST *request, VALUE_PAIR *req_list, VALUE_PAIR *check, * We've got to xlat the string before doing * the comparison. */ - radius_xlat_do(request, check_item); + xlat_eval_do(request, check_item); /* * OK it is present now compare them. @@ -652,7 +652,7 @@ int paircompare(REQUEST *request, VALUE_PAIR *req_list, VALUE_PAIR *check, * - -1 On xlat failure. * - -2 On parse failure. */ -int radius_xlat_do(REQUEST *request, VALUE_PAIR *vp) +int xlat_eval_do(REQUEST *request, VALUE_PAIR *vp) { ssize_t slen; @@ -661,7 +661,7 @@ int radius_xlat_do(REQUEST *request, VALUE_PAIR *vp) vp->type = VT_DATA; - slen = radius_axlat(request, &expanded, request, vp->xlat, NULL, NULL); + slen = xlat_aeval(request, &expanded, request, vp->xlat, NULL, NULL); talloc_const_free(vp->xlat); vp->xlat = NULL; if (slen < 0) { diff --git a/src/main/tls/session.c b/src/main/tls/session.c index 2bd8ddfbb75..f07a9e5bf3e 100644 --- a/src/main/tls/session.c +++ b/src/main/tls/session.c @@ -245,7 +245,7 @@ unsigned int tls_session_psk_server_cb(SSL *ssl, const char *identity, vp = pair_make_request("TLS-PSK-Identity", identity, T_OP_SET); if (!vp) return 0; - hex_len = radius_xlat(buffer, sizeof(buffer), request, conf->psk_query, + hex_len = xlat_eval(buffer, sizeof(buffer), request, conf->psk_query, NULL, NULL); if (!hex_len) { RWDEBUG("PSK expansion returned an empty string."); diff --git a/src/main/tls/validate.c b/src/main/tls/validate.c index e5d698eb259..95593cebade 100644 --- a/src/main/tls/validate.c +++ b/src/main/tls/validate.c @@ -240,7 +240,7 @@ int tls_validate_cert_cb(int ok, X509_STORE_CTX *x509_ctx) if (my_ok && conf->check_cert_cn) { char cn_str[1024]; - if (radius_xlat(cn_str, sizeof(cn_str), request, conf->check_cert_cn, NULL, NULL) < 0) { + if (xlat_eval(cn_str, sizeof(cn_str), request, conf->check_cert_cn, NULL, NULL) < 0) { /* if this fails, fail the verification */ my_ok = 0; } else { diff --git a/src/main/tmpl.c b/src/main/tmpl.c index 931a2bccc88..5183243c808 100644 --- a/src/main/tmpl.c +++ b/src/main/tmpl.c @@ -1549,7 +1549,7 @@ ssize_t _tmpl_to_type(void *out, return -1; } /* Error in expansion, this is distinct from zero length expansion */ - slen = radius_xlat((char *)buff, bufflen, request, vpt->name, escape, escape_ctx); + slen = xlat_eval((char *)buff, bufflen, request, vpt->name, escape, escape_ctx); if (slen < 0) return slen; /* @@ -1570,7 +1570,7 @@ ssize_t _tmpl_to_type(void *out, return -1; } /* Error in expansion, this is distinct from zero length expansion */ - slen = radius_xlat_struct((char *)buff, bufflen, request, vpt->tmpl_xlat, escape, escape_ctx); + slen = xlat_eval_compiled((char *)buff, bufflen, request, vpt->tmpl_xlat, escape, escape_ctx); if (slen < 0) return slen; RDEBUG2(" --> %s", (char *)buff); /* Print pre-unescaping (so it's escaped) */ @@ -1843,7 +1843,7 @@ ssize_t _tmpl_to_atype(TALLOC_CTX *ctx, void *out, RDEBUG4("EXPAND TMPL XLAT"); /* Error in expansion, this is distinct from zero length expansion */ - slen = radius_axlat(tmp_ctx, (char **)&vd.datum.ptr, request, vpt->name, escape, escape_ctx); + slen = xlat_aeval(tmp_ctx, (char **)&vd.datum.ptr, request, vpt->name, escape, escape_ctx); if (slen < 0) goto error; vd.length = slen; @@ -1870,7 +1870,7 @@ ssize_t _tmpl_to_atype(TALLOC_CTX *ctx, void *out, RDEBUG2("EXPAND %s", vpt->name); /* xlat_struct doesn't do this */ /* Error in expansion, this is distinct from zero length expansion */ - slen = radius_axlat_struct(tmp_ctx, (char **)&vd.datum.ptr, request, vpt->tmpl_xlat, escape, escape_ctx); + slen = xlat_aeval_compiled(tmp_ctx, (char **)&vd.datum.ptr, request, vpt->tmpl_xlat, escape, escape_ctx); if (slen < 0) return slen; vd.length = slen; diff --git a/src/main/unit_test_module.c b/src/main/unit_test_module.c index 11724d1977f..df98eff4e5f 100644 --- a/src/main/unit_test_module.c +++ b/src/main/unit_test_module.c @@ -628,7 +628,7 @@ static bool do_xlats(char const *filename, FILE *fp) continue; } - len = radius_xlat_struct(output, sizeof(output), request, head, NULL, NULL); + len = xlat_eval_compiled(output, sizeof(output), request, head, NULL, NULL); if (len < 0) { snprintf(output, sizeof(output), "ERROR expanding xlat: %s", fr_strerror()); continue; diff --git a/src/main/unlang_interpret.c b/src/main/unlang_interpret.c index 7d46486db40..7f2fd51bc09 100644 --- a/src/main/unlang_interpret.c +++ b/src/main/unlang_interpret.c @@ -474,7 +474,7 @@ static unlang_action_t unlang_xlat_inline(REQUEST *request, unlang_stack_t *stac char buffer[128]; if (!mx->exec) { - radius_xlat(buffer, sizeof(buffer), request, mx->xlat_name, NULL, NULL); + xlat_eval(buffer, sizeof(buffer), request, mx->xlat_name, NULL, NULL); } else { RDEBUG("`%s`", mx->xlat_name); radius_exec_program(request, NULL, 0, NULL, request, mx->xlat_name, request->packet->vps, diff --git a/src/main/util.c b/src/main/util.c index cef5f854ef2..b639122c792 100644 --- a/src/main/util.c +++ b/src/main/util.c @@ -672,7 +672,7 @@ int rad_expand_xlat(REQUEST *request, char const *cmd, strlcpy(argv_buf, cmd, argv_buflen); /* - * Split the string into argv's BEFORE doing radius_xlat... + * Split the string into argv's BEFORE doing xlat_eval... */ from = cmd; to = argv_buf; @@ -764,7 +764,7 @@ int rad_expand_xlat(REQUEST *request, char const *cmd, if (!request) continue; - sublen = radius_xlat(to, left - 1, request, argv[i], NULL, NULL); + sublen = xlat_eval(to, left - 1, request, argv[i], NULL, NULL); if (sublen <= 0) { if (can_fail) { /* diff --git a/src/main/xlat_eval.c b/src/main/xlat_eval.c index f2656f22224..69bd441c117 100644 --- a/src/main/xlat_eval.c +++ b/src/main/xlat_eval.c @@ -714,21 +714,20 @@ static size_t xlat_process(TALLOC_CTX *ctx, char **out, REQUEST *request, xlat_e return total; } - /** Replace %whatever in a string. * * See 'doc/configuration/variables.rst' for more information. * - * @param[in] ctx to allocate expansion buffers in. - * @param[out] out Where to write pointer to output buffer. - * @param[in] outlen Size of out. - * @param[in] request current request. - * @param[in] node the xlat structure to expand - * @param[in] escape function to escape final value e.g. SQL quoting. - * @param[in] escape_ctx pointer to pass to escape function. + * @param[in] ctx to allocate expansion buffers in. + * @param[out] out Where to write pointer to output buffer. + * @param[in] outlen Size of out. + * @param[in] request current request. + * @param[in] node the xlat structure to expand + * @param[in] escape function to escape final value e.g. SQL quoting. + * @param[in] escape_ctx pointer to pass to escape function. * @return length of string written @bug should really have -1 for failure. */ -static ssize_t xlat_expand_struct(TALLOC_CTX *ctx, char **out, size_t outlen, REQUEST *request, +static ssize_t _xlat_eval_compiled(TALLOC_CTX *ctx, char **out, size_t outlen, REQUEST *request, xlat_exp_t const *node, xlat_escape_t escape, void const *escape_ctx) { char *buff; @@ -762,23 +761,23 @@ static ssize_t xlat_expand_struct(TALLOC_CTX *ctx, char **out, size_t outlen, RE return len; } -static ssize_t xlat_expand(TALLOC_CTX *ctx, char **out, size_t outlen, REQUEST *request, char const *fmt, +static ssize_t _xlat_eval(TALLOC_CTX *ctx, char **out, size_t outlen, REQUEST *request, char const *fmt, xlat_escape_t escape, void const *escape_ctx) CC_HINT(nonnull (2, 4, 5)); /** Replace %whatever in a string. * * See 'doc/configuration/variables.rst' for more information. * - * @param[in] ctx to allocate expansion buffers in. - * @param[out] out Where to write pointer to output buffer. - * @param[in] outlen Size of out. - * @param[in] request current request. - * @param[in] fmt string to expand. - * @param[in] escape function to escape final value e.g. SQL quoting. - * @param[in] escape_ctx pointer to pass to escape function. + * @param[in] ctx to allocate expansion buffers in. + * @param[out] out Where to write pointer to output buffer. + * @param[in] outlen Size of out. + * @param[in] request current request. + * @param[in] fmt string to expand. + * @param[in] escape function to escape final value e.g. SQL quoting. + * @param[in] escape_ctx pointer to pass to escape function. * @return length of string written @bug should really have -1 for failure. */ -static ssize_t xlat_expand(TALLOC_CTX *ctx, char **out, size_t outlen, REQUEST *request, char const *fmt, +static ssize_t _xlat_eval(TALLOC_CTX *ctx, char **out, size_t outlen, REQUEST *request, char const *fmt, xlat_escape_t escape, void const *escape_ctx) { ssize_t len; @@ -807,7 +806,7 @@ static ssize_t xlat_expand(TALLOC_CTX *ctx, char **out, size_t outlen, REQUEST * return -1; } - len = xlat_expand_struct(ctx, out, outlen, request, node, escape, escape_ctx); + len = _xlat_eval_compiled(ctx, out, outlen, request, node, escape, escape_ctx); talloc_free(node); REXDENT(); @@ -816,28 +815,28 @@ static ssize_t xlat_expand(TALLOC_CTX *ctx, char **out, size_t outlen, REQUEST * return len; } -ssize_t radius_xlat(char *out, size_t outlen, REQUEST *request, - char const *fmt, xlat_escape_t escape, void const *escape_ctx) +ssize_t xlat_eval(char *out, size_t outlen, REQUEST *request, + char const *fmt, xlat_escape_t escape, void const *escape_ctx) { - return xlat_expand(request, &out, outlen, request, fmt, escape, escape_ctx); + return _xlat_eval(request, &out, outlen, request, fmt, escape, escape_ctx); } -ssize_t radius_xlat_struct(char *out, size_t outlen, REQUEST *request, +ssize_t xlat_eval_compiled(char *out, size_t outlen, REQUEST *request, xlat_exp_t const *xlat, xlat_escape_t escape, void const *escape_ctx) { - return xlat_expand_struct(request, &out, outlen, request, xlat, escape, escape_ctx); + return _xlat_eval_compiled(request, &out, outlen, request, xlat, escape, escape_ctx); } -ssize_t radius_axlat(TALLOC_CTX *ctx, char **out, REQUEST *request, char const *fmt, - xlat_escape_t escape, void const *escape_ctx) +ssize_t xlat_aeval(TALLOC_CTX *ctx, char **out, REQUEST *request, char const *fmt, + xlat_escape_t escape, void const *escape_ctx) { *out = NULL; - return xlat_expand(ctx, out, 0, request, fmt, escape, escape_ctx); + return _xlat_eval(ctx, out, 0, request, fmt, escape, escape_ctx); } -ssize_t radius_axlat_struct(TALLOC_CTX *ctx, char **out, REQUEST *request, +ssize_t xlat_aeval_compiled(TALLOC_CTX *ctx, char **out, REQUEST *request, xlat_exp_t const *xlat, xlat_escape_t escape, void const *escape_ctx) { *out = NULL; - return xlat_expand_struct(ctx, out, 0, request, xlat, escape, escape_ctx); + return _xlat_eval_compiled(ctx, out, 0, request, xlat, escape, escape_ctx); } diff --git a/src/main/xlat_func.c b/src/main/xlat_func.c index 6f670e183f9..e43f96b334c 100644 --- a/src/main/xlat_func.c +++ b/src/main/xlat_func.c @@ -591,7 +591,7 @@ static ssize_t xlat_xlat(TALLOC_CTX *ctx, char **out, size_t outlen, * If it's a string, expand it again */ if (vp->da->type == PW_TYPE_STRING) { - slen = radius_xlat(*out, outlen, request, vp->vp_strvalue, NULL, NULL); + slen = xlat_eval(*out, outlen, request, vp->vp_strvalue, NULL, NULL); if (slen <= 0) return slen; /* * If it's not a string, treat it as a literal diff --git a/src/modules/proto_radius/proto_radius_auth.c b/src/modules/proto_radius/proto_radius_auth.c index 7551a06af0e..bcaf90a1163 100644 --- a/src/modules/proto_radius/proto_radius_auth.c +++ b/src/modules/proto_radius/proto_radius_auth.c @@ -102,7 +102,7 @@ static void auth_message(char const *msg, REQUEST *request, int goodpass) if (extra_msg) { extra[0] = ' '; p = extra + 1; - if (radius_xlat(p, sizeof(extra) - 1, request, extra_msg, NULL, NULL) < 0) { + if (xlat_eval(p, sizeof(extra) - 1, request, extra_msg, NULL, NULL) < 0) { return; } } else { diff --git a/src/modules/rlm_attr_filter/rlm_attr_filter.c b/src/modules/rlm_attr_filter/rlm_attr_filter.c index 4efbbf207b0..669bbfbcaa7 100644 --- a/src/modules/rlm_attr_filter/rlm_attr_filter.c +++ b/src/modules/rlm_attr_filter/rlm_attr_filter.c @@ -219,7 +219,7 @@ static rlm_rcode_t CC_HINT(nonnull(1,2)) attr_filter_common(void const *instance if (!vp) { goto error; } - radius_xlat_do(request, vp); + xlat_eval_do(request, vp); fr_cursor_append(&out, vp); } } diff --git a/src/modules/rlm_detail/rlm_detail.c b/src/modules/rlm_detail/rlm_detail.c index 5db36618f8d..7a91fe5c0fd 100644 --- a/src/modules/rlm_detail/rlm_detail.c +++ b/src/modules/rlm_detail/rlm_detail.c @@ -223,7 +223,7 @@ static int detail_write(FILE *out, rlm_detail_t const *inst, REQUEST *request, R VALUE_PAIR *vp; char timestamp[256]; - if (radius_xlat(timestamp, sizeof(timestamp), request, inst->header, NULL, NULL) < 0) { + if (xlat_eval(timestamp, sizeof(timestamp), request, inst->header, NULL, NULL) < 0) { return -1; } @@ -358,9 +358,9 @@ static rlm_rcode_t CC_HINT(nonnull) detail_do(void const *instance, REQUEST *req /* * Generate the path for the detail file. Use the same * format, but truncate at the last /. Then feed it - * through radius_xlat() to expand the variables. + * through xlat_eval() to expand the variables. */ - if (radius_xlat(buffer, sizeof(buffer), request, inst->filename, inst->escape_func, NULL) < 0) { + if (xlat_eval(buffer, sizeof(buffer), request, inst->filename, inst->escape_func, NULL) < 0) { return RLM_MODULE_FAIL; } diff --git a/src/modules/rlm_eap/types/rlm_eap_gtc/rlm_eap_gtc.c b/src/modules/rlm_eap/types/rlm_eap_gtc/rlm_eap_gtc.c index faba7c088ad..e3fe3de33a2 100644 --- a/src/modules/rlm_eap/types/rlm_eap_gtc/rlm_eap_gtc.c +++ b/src/modules/rlm_eap/types/rlm_eap_gtc/rlm_eap_gtc.c @@ -159,7 +159,7 @@ static rlm_rcode_t mod_session_init(void *instance, eap_session_t *eap_session) eap_round_t *eap_round = eap_session->this_round; rlm_eap_gtc_t *inst = (rlm_eap_gtc_t *) instance; - if (radius_xlat(challenge_str, sizeof(challenge_str), eap_session->request, inst->challenge, NULL, NULL) < 0) { + if (xlat_eval(challenge_str, sizeof(challenge_str), eap_session->request, inst->challenge, NULL, NULL) < 0) { return RLM_MODULE_FAIL; } diff --git a/src/modules/rlm_expr/paircmp.c b/src/modules/rlm_expr/paircmp.c index fded43ddbdc..0caae008c26 100644 --- a/src/modules/rlm_expr/paircmp.c +++ b/src/modules/rlm_expr/paircmp.c @@ -187,7 +187,7 @@ static int genericcmp(UNUSED void *instance, snprintf(name, sizeof(name), "%%{%s}", check->da->name); - if (radius_xlat(value, sizeof(value), request, name, NULL, NULL) < 0) { + if (xlat_eval(value, sizeof(value), request, name, NULL, NULL) < 0) { return 0; } vp = fr_pair_make(req, NULL, check->da->name, value, check->op); diff --git a/src/modules/rlm_files/rlm_files.c b/src/modules/rlm_files/rlm_files.c index 1dffe28189e..84193c77151 100644 --- a/src/modules/rlm_files/rlm_files.c +++ b/src/modules/rlm_files/rlm_files.c @@ -361,7 +361,7 @@ static rlm_rcode_t file_common(rlm_files_t const *inst, REQUEST *request, char c } else { int len; - len = radius_xlat(buffer, sizeof(buffer), request, inst->key, NULL, NULL); + len = xlat_eval(buffer, sizeof(buffer), request, inst->key, NULL, NULL); if (len < 0) { return RLM_MODULE_FAIL; } @@ -413,7 +413,7 @@ static rlm_rcode_t file_common(rlm_files_t const *inst, REQUEST *request, char c for (vp = fr_cursor_init(&cursor, &check_tmp); vp; vp = fr_cursor_next(&cursor)) { - if (radius_xlat_do(request, vp) < 0) { + if (xlat_eval_do(request, vp) < 0) { RWARN("Failed parsing expanded value for check item, skipping entry: %s", fr_strerror()); fr_pair_list_free(&check_tmp); continue; diff --git a/src/modules/rlm_ldap/ldap.c b/src/modules/rlm_ldap/ldap.c index 7384848f721..22a92208b40 100644 --- a/src/modules/rlm_ldap/ldap.c +++ b/src/modules/rlm_ldap/ldap.c @@ -524,7 +524,7 @@ ssize_t rlm_ldap_xlat_filter(REQUEST *request, char const **sub, size_t sublen, in = buffer; } - len = radius_xlat(out, outlen, request, in, rlm_ldap_escape_func, NULL); + len = xlat_eval(out, outlen, request, in, rlm_ldap_escape_func, NULL); if (len < 0) { REDEBUG("Failed creating filter"); diff --git a/src/modules/rlm_ldap/rlm_ldap.c b/src/modules/rlm_ldap/rlm_ldap.c index a9fbc2f1f0c..8a87c843f92 100644 --- a/src/modules/rlm_ldap/rlm_ldap.c +++ b/src/modules/rlm_ldap/rlm_ldap.c @@ -1167,7 +1167,7 @@ static rlm_rcode_t user_modify(rlm_ldap_t const *inst, REQUEST *request, ldap_ac *p++ = '.'; } - if (radius_xlat(p, (sizeof(path) - (p - path)) - 1, request, section->reference, NULL, NULL) < 0) { + if (xlat_eval(p, (sizeof(path) - (p - path)) - 1, request, section->reference, NULL, NULL) < 0) { goto error; } @@ -1241,7 +1241,7 @@ static rlm_rcode_t user_modify(rlm_ldap_t const *inst, REQUEST *request, ldap_ac } else if (do_xlat) { char *exp = NULL; - if (radius_axlat(request, &exp, request, value, NULL, NULL) <= 0) { + if (xlat_aeval(request, &exp, request, value, NULL, NULL) <= 0) { RDEBUG("Skipping attribute \"%s\"", attr); talloc_free(exp); diff --git a/src/modules/rlm_linelog/rlm_linelog.c b/src/modules/rlm_linelog/rlm_linelog.c index 4c9c8b466bc..0c994c4dae0 100644 --- a/src/modules/rlm_linelog/rlm_linelog.c +++ b/src/modules/rlm_linelog/rlm_linelog.c @@ -651,7 +651,7 @@ build_vector: { char path[2048]; - if (radius_xlat(path, sizeof(path), request, inst->file.name, inst->file.escape_func, NULL) < 0) { + if (xlat_eval(path, sizeof(path), request, inst->file.name, inst->file.escape_func, NULL) < 0) { return RLM_MODULE_FAIL; } diff --git a/src/modules/rlm_mschap/rlm_mschap.c b/src/modules/rlm_mschap/rlm_mschap.c index 7684daf336e..30678c49e1f 100644 --- a/src/modules/rlm_mschap/rlm_mschap.c +++ b/src/modules/rlm_mschap/rlm_mschap.c @@ -801,7 +801,7 @@ static int CC_HINT(nonnull (1, 2, 4, 5)) do_mschap_cpw(rlm_mschap_t const *inst, */ if (inst->ntlm_cpw_username) { - len = radius_xlat(buf, sizeof(buf) - 2, request, inst->ntlm_cpw_username, NULL, NULL); + len = xlat_eval(buf, sizeof(buf) - 2, request, inst->ntlm_cpw_username, NULL, NULL); if (len < 0) { goto ntlm_auth_err; } @@ -818,7 +818,7 @@ static int CC_HINT(nonnull (1, 2, 4, 5)) do_mschap_cpw(rlm_mschap_t const *inst, } if (inst->ntlm_cpw_domain) { - len = radius_xlat(buf, sizeof(buf) - 2, request, inst->ntlm_cpw_domain, NULL, NULL); + len = xlat_eval(buf, sizeof(buf) - 2, request, inst->ntlm_cpw_domain, NULL, NULL); if (len < 0) { goto ntlm_auth_err; } @@ -1065,7 +1065,7 @@ ntlm_auth_err: *x = '\0'; /* Perform the xlat */ - result_len = radius_xlat(result, sizeof(result), request, inst->local_cpw, NULL, NULL); + result_len = xlat_eval(result, sizeof(result), request, inst->local_cpw, NULL, NULL); if (result_len < 0){ return -1; } else if (result_len == 0) { diff --git a/src/modules/rlm_otp/rlm_otp.c b/src/modules/rlm_otp/rlm_otp.c index c912acc056e..40bdb060880 100644 --- a/src/modules/rlm_otp/rlm_otp.c +++ b/src/modules/rlm_otp/rlm_otp.c @@ -251,7 +251,7 @@ static rlm_rcode_t CC_HINT(nonnull) mod_authorize(void *instance, UNUSED void *t * what the challenge value is. */ - len = radius_axlat(request, &expanded, request, inst->chal_prompt, NULL, NULL); + len = xlat_aeval(request, &expanded, request, inst->chal_prompt, NULL, NULL); if (len < 0) { return RLM_MODULE_FAIL; } diff --git a/src/modules/rlm_pap/rlm_pap.c b/src/modules/rlm_pap/rlm_pap.c index 1e5ea0cda63..8a79e532dea 100644 --- a/src/modules/rlm_pap/rlm_pap.c +++ b/src/modules/rlm_pap/rlm_pap.c @@ -861,7 +861,7 @@ static rlm_rcode_t CC_HINT(nonnull) pap_auth_lm(rlm_pap_t const *inst, REQUEST * return RLM_MODULE_INVALID; } - len = radius_xlat(charbuf, sizeof(charbuf), request, "%{mschap:LM-Hash %{User-Password}}", NULL, NULL); + len = xlat_eval(charbuf, sizeof(charbuf), request, "%{mschap:LM-Hash %{User-Password}}", NULL, NULL); if (len < 0){ return RLM_MODULE_FAIL; } diff --git a/src/modules/rlm_perl/rlm_perl.c b/src/modules/rlm_perl/rlm_perl.c index 7fa410fb321..c89176c4f8c 100644 --- a/src/modules/rlm_perl/rlm_perl.c +++ b/src/modules/rlm_perl/rlm_perl.c @@ -299,7 +299,7 @@ static XS(XS_radiusd_radlog) } /* - * This is a wraper for radius_axlat + * This is a wraper for xlat_aeval * Now users are able to get data that is accessible only via xlat * e.g. %{client:...} * Call syntax is radiusd::xlat(string), string will be handled the @@ -319,7 +319,7 @@ static XS(XS_radiusd_xlat) in_str = (char *) SvPV(ST(0), PL_na); - slen = radius_axlat(request, &expanded, request, in_str, NULL, NULL); + slen = xlat_aeval(request, &expanded, request, in_str, NULL, NULL); if (slen < 0) { REDEBUG("Error parsing xlat '%s'", in_str); XSRETURN_UNDEF; diff --git a/src/modules/rlm_radutmp/rlm_radutmp.c b/src/modules/rlm_radutmp/rlm_radutmp.c index e877dc15fa9..6ef1b63e988 100644 --- a/src/modules/rlm_radutmp/rlm_radutmp.c +++ b/src/modules/rlm_radutmp/rlm_radutmp.c @@ -311,7 +311,7 @@ static rlm_rcode_t CC_HINT(nonnull) mod_accounting(void *instance, UNUSED void * * Get the utmp filename, via xlat. */ filename = NULL; - if (radius_axlat(request, &filename, request, inst->filename, NULL, NULL) < 0) { + if (xlat_aeval(request, &filename, request, inst->filename, NULL, NULL) < 0) { return RLM_MODULE_FAIL; } @@ -348,7 +348,7 @@ static rlm_rcode_t CC_HINT(nonnull) mod_accounting(void *instance, UNUSED void * /* * Translate the User-Name attribute, or whatever else they told us to use. */ - if (radius_axlat(request, &expanded, request, inst->username, NULL, NULL) < 0) { + if (xlat_aeval(request, &expanded, request, inst->username, NULL, NULL) < 0) { rcode = RLM_MODULE_FAIL; goto finish; @@ -562,7 +562,7 @@ static rlm_rcode_t CC_HINT(nonnull) mod_checksimul(void *instance, UNUSED void * /* * Get the filename, via xlat. */ - if (radius_axlat(request, &expanded, request, inst->filename, NULL, NULL) < 0) { + if (xlat_aeval(request, &expanded, request, inst->filename, NULL, NULL) < 0) { return RLM_MODULE_FAIL; } @@ -588,7 +588,7 @@ static rlm_rcode_t CC_HINT(nonnull) mod_checksimul(void *instance, UNUSED void * TALLOC_FREE(expanded); - len = radius_axlat(request, &expanded, request, inst->username, NULL, NULL); + len = xlat_aeval(request, &expanded, request, inst->username, NULL, NULL); if (len < 0) { rcode = RLM_MODULE_FAIL; diff --git a/src/modules/rlm_rest/rest.c b/src/modules/rlm_rest/rest.c index 9e2e03647d8..6cd906c3f2b 100644 --- a/src/modules/rlm_rest/rest.c +++ b/src/modules/rlm_rest/rest.c @@ -826,7 +826,7 @@ static int rest_decode_post(UNUSED rlm_rest_t const *instance, UNUSED rlm_rest_s RDEBUG2("Performing xlat expansion of response value"); - if (radius_axlat(request, &expanded, request, value, NULL, NULL) < 0) { + if (xlat_aeval(request, &expanded, request, value, NULL, NULL) < 0) { goto skip; } @@ -934,7 +934,7 @@ static VALUE_PAIR *json_pair_make_leaf(UNUSED rlm_rest_t const *instance, UNUSED type = PW_TYPE_STRING; value = json_object_get_string(leaf); if (flags->do_xlat) { - if (radius_axlat(request, &expanded, request, value, NULL, NULL) < 0) return NULL; + if (xlat_aeval(request, &expanded, request, value, NULL, NULL) < 0) return NULL; src.datum.strvalue = expanded; src.length = talloc_array_length(src.datum.strvalue) - 1; } else { @@ -1832,7 +1832,7 @@ int rest_request_config(rlm_rest_t const *inst, rlm_rest_thread_t *t, rlm_rest_s if (username) { SET_OPTION(CURLOPT_USERNAME, username); } else if (section->username) { - if (radius_xlat(buffer, sizeof(buffer), request, section->username, NULL, NULL) < 0) { + if (xlat_eval(buffer, sizeof(buffer), request, section->username, NULL, NULL) < 0) { option = STRINGIFY(CURLOPT_USERNAME); goto error; } @@ -1842,7 +1842,7 @@ int rest_request_config(rlm_rest_t const *inst, rlm_rest_thread_t *t, rlm_rest_s if (password) { SET_OPTION(CURLOPT_PASSWORD, password); } else if (section->password) { - if (radius_xlat(buffer, sizeof(buffer), request, section->password, NULL, NULL) < 0) { + if (xlat_eval(buffer, sizeof(buffer), request, section->password, NULL, NULL) < 0) { option = STRINGIFY(CURLOPT_PASSWORD); goto error; } @@ -1855,7 +1855,7 @@ int rest_request_config(rlm_rest_t const *inst, rlm_rest_thread_t *t, rlm_rest_s if (username) { SET_OPTION(CURLOPT_TLSAUTH_USERNAME, username); } else if (section->username) { - if (radius_xlat(buffer, sizeof(buffer), request, section->username, NULL, NULL) < 0) { + if (xlat_eval(buffer, sizeof(buffer), request, section->username, NULL, NULL) < 0) { option = STRINGIFY(CURLOPT_TLSAUTH_USERNAME); goto error; } @@ -1865,7 +1865,7 @@ int rest_request_config(rlm_rest_t const *inst, rlm_rest_thread_t *t, rlm_rest_s if (password) { SET_OPTION(CURLOPT_TLSAUTH_PASSWORD, password); } else if (section->password) { - if (radius_xlat(buffer, sizeof(buffer), request, section->password, NULL, NULL) < 0) { + if (xlat_eval(buffer, sizeof(buffer), request, section->password, NULL, NULL) < 0) { option = STRINGIFY(CURLOPT_TLSAUTH_PASSWORD); goto error; } @@ -1965,7 +1965,7 @@ int rest_request_config(rlm_rest_t const *inst, rlm_rest_thread_t *t, rlm_rest_s rest_custom_data_t *data; char *expanded = NULL; - if (radius_axlat(request, &expanded, request, section->data, NULL, NULL) < 0) return -1; + if (xlat_aeval(request, &expanded, request, section->data, NULL, NULL) < 0) return -1; data = talloc_zero(request, rest_custom_data_t); data->p = expanded; @@ -2309,7 +2309,7 @@ ssize_t rest_uri_build(char **out, rlm_rest_t const *inst, REQUEST *request, cha path = (uri + len); - len = radius_axlat(request, out, request, scheme, NULL, NULL); + len = xlat_aeval(request, out, request, scheme, NULL, NULL); talloc_free(scheme); if (len < 0) { TALLOC_FREE(*out); @@ -2317,7 +2317,7 @@ ssize_t rest_uri_build(char **out, rlm_rest_t const *inst, REQUEST *request, cha return 0; } - len = radius_axlat(request, &path_exp, request, path, rest_uri_escape, NULL); + len = xlat_aeval(request, &path_exp, request, path, rest_uri_escape, NULL); if (len < 0) { TALLOC_FREE(*out); diff --git a/src/modules/rlm_sql/rlm_sql.c b/src/modules/rlm_sql/rlm_sql.c index 89ed46d2208..70a91e672d9 100644 --- a/src/modules/rlm_sql/rlm_sql.c +++ b/src/modules/rlm_sql/rlm_sql.c @@ -691,7 +691,7 @@ int sql_set_user(rlm_sql_t const *inst, REQUEST *request, char const *username) return 0; } - len = radius_axlat(request, &expanded, request, sqluser, NULL, NULL); + len = xlat_aeval(request, &expanded, request, sqluser, NULL, NULL); if (len < 0) { return -1; } @@ -734,7 +734,7 @@ static int sql_get_grouplist(rlm_sql_t const *inst, rlm_sql_handle_t **handle, R entry = *phead = NULL; if (!inst->config->groupmemb_query || !*inst->config->groupmemb_query) return 0; - if (radius_axlat(request, &expanded, request, inst->config->groupmemb_query, + if (xlat_aeval(request, &expanded, request, inst->config->groupmemb_query, inst->sql_escape_func, *handle) < 0) return -1; ret = rlm_sql_select_query(inst, request, handle, expanded); @@ -913,7 +913,7 @@ static rlm_rcode_t rlm_sql_process_groups(rlm_sql_t const *inst, REQUEST *reques /* * Expand the group query */ - if (radius_axlat(request, &expanded, request, inst->config->authorize_group_check_query, + if (xlat_aeval(request, &expanded, request, inst->config->authorize_group_check_query, inst->sql_escape_func, *handle) < 0) { REDEBUG("Error generating query"); rcode = RLM_MODULE_FAIL; @@ -963,7 +963,7 @@ static rlm_rcode_t rlm_sql_process_groups(rlm_sql_t const *inst, REQUEST *reques /* * Now get the reply pairs since the paircompare matched */ - if (radius_axlat(request, &expanded, request, inst->config->authorize_group_reply_query, + if (xlat_aeval(request, &expanded, request, inst->config->authorize_group_reply_query, inst->sql_escape_func, *handle) < 0) { REDEBUG("Error generating query"); rcode = RLM_MODULE_FAIL; @@ -1306,7 +1306,7 @@ static rlm_rcode_t mod_authorize(void *instance, UNUSED void *thread, REQUEST *r vp_cursor_t cursor; VALUE_PAIR *vp; - if (radius_axlat(request, &expanded, request, inst->config->authorize_check_query, + if (xlat_aeval(request, &expanded, request, inst->config->authorize_check_query, inst->sql_escape_func, handle) < 0) { REDEBUG("Failed generating query"); rcode = RLM_MODULE_FAIL; @@ -1354,7 +1354,7 @@ static rlm_rcode_t mod_authorize(void *instance, UNUSED void *thread, REQUEST *r /* * Now get the reply pairs since the paircompare matched */ - if (radius_axlat(request, &expanded, request, inst->config->authorize_reply_query, + if (xlat_aeval(request, &expanded, request, inst->config->authorize_reply_query, inst->sql_escape_func, handle) < 0) { REDEBUG("Error generating query"); rcode = RLM_MODULE_FAIL; @@ -1534,7 +1534,7 @@ static int acct_redundant(rlm_sql_t const *inst, REQUEST *request, sql_acct_sect *p++ = '.'; } - if (radius_xlat(p, sizeof(path) - (p - path), request, section->reference, NULL, NULL) < 0) { + if (xlat_eval(p, sizeof(path) - (p - path), request, section->reference, NULL, NULL) < 0) { rcode = RLM_MODULE_FAIL; goto finish; @@ -1581,7 +1581,7 @@ static int acct_redundant(rlm_sql_t const *inst, REQUEST *request, sql_acct_sect goto finish; } - if (radius_axlat(request, &expanded, request, value, inst->sql_escape_func, handle) < 0) { + if (xlat_aeval(request, &expanded, request, value, inst->sql_escape_func, handle) < 0) { rcode = RLM_MODULE_FAIL; goto finish; @@ -1741,7 +1741,7 @@ static rlm_rcode_t mod_checksimul(void *instance, UNUSED void *thread, REQUEST * return RLM_MODULE_FAIL; } - if (radius_axlat(request, &expanded, request, inst->config->simul_count_query, + if (xlat_aeval(request, &expanded, request, inst->config->simul_count_query, inst->sql_escape_func, handle) < 0) { fr_connection_release(inst->pool, request, handle); sql_unset_user(inst, request); @@ -1783,7 +1783,7 @@ static rlm_rcode_t mod_checksimul(void *instance, UNUSED void *thread, REQUEST * goto finish; } - if (radius_axlat(request, &expanded, request, inst->config->simul_verify_query, + if (xlat_aeval(request, &expanded, request, inst->config->simul_verify_query, inst->sql_escape_func, handle) < 0) { rcode = RLM_MODULE_FAIL; diff --git a/src/modules/rlm_sql/sql.c b/src/modules/rlm_sql/sql.c index 45a9c7a33b7..e8f65995039 100644 --- a/src/modules/rlm_sql/sql.c +++ b/src/modules/rlm_sql/sql.c @@ -529,7 +529,7 @@ void rlm_sql_query_log(rlm_sql_t const *inst, REQUEST *request, sql_acct_section return; } - if (radius_axlat(request, &expanded, request, filename, NULL, NULL) < 0) { + if (xlat_aeval(request, &expanded, request, filename, NULL, NULL) < 0) { return; } diff --git a/src/modules/rlm_sqlcounter/rlm_sqlcounter.c b/src/modules/rlm_sqlcounter/rlm_sqlcounter.c index dea3f221c0b..b5f4e7cb254 100644 --- a/src/modules/rlm_sqlcounter/rlm_sqlcounter.c +++ b/src/modules/rlm_sqlcounter/rlm_sqlcounter.c @@ -358,7 +358,7 @@ static int counter_cmp(void *instance, REQUEST *request, UNUSED VALUE_PAIR *req } /* Finally, xlat resulting SQL query */ - if (radius_axlat(request, &expanded, request, query, NULL, NULL) < 0) { + if (xlat_aeval(request, &expanded, request, query, NULL, NULL) < 0) { return RLM_MODULE_FAIL; } @@ -440,7 +440,7 @@ static rlm_rcode_t CC_HINT(nonnull) mod_authorize(void *instance, UNUSED void *t } /* Finally, xlat resulting SQL query */ - if (radius_axlat(request, &expanded, request, query, NULL, NULL) < 0) { + if (xlat_aeval(request, &expanded, request, query, NULL, NULL) < 0) { return RLM_MODULE_FAIL; } talloc_free(expanded); diff --git a/src/modules/rlm_sqlippool/rlm_sqlippool.c b/src/modules/rlm_sqlippool/rlm_sqlippool.c index d153e1c4883..9f39e368801 100644 --- a/src/modules/rlm_sqlippool/rlm_sqlippool.c +++ b/src/modules/rlm_sqlippool/rlm_sqlippool.c @@ -278,7 +278,7 @@ static int sqlippool_command(char const *fmt, rlm_sql_handle_t **handle, */ sqlippool_expand(query, sizeof(query), fmt, data, param, param_len); - if (radius_axlat(request, &expanded, request, query, data->sql_inst->sql_escape_func, *handle) < 0) return -1; + if (xlat_aeval(request, &expanded, request, query, data->sql_inst->sql_escape_func, *handle) < 0) return -1; ret = data->sql_inst->sql_query(data->sql_inst, request, handle, expanded); if (ret < 0){ @@ -322,7 +322,7 @@ static int CC_HINT(nonnull (1, 3, 4, 5)) sqlippool_query1(char *out, int outlen, /* * Do an xlat on the provided string */ - if (radius_axlat(request, &expanded, request, query, data->sql_inst->sql_escape_func, handle) < 0) { + if (xlat_aeval(request, &expanded, request, query, data->sql_inst->sql_escape_func, handle) < 0) { return 0; } retval = data->sql_inst->sql_select_query(data->sql_inst, request, &handle, expanded); @@ -419,7 +419,7 @@ static int do_logging(REQUEST *request, char const *str, int rcode) if (!str || !*str) return rcode; - if (radius_axlat(request, &expanded, request, str, NULL, NULL) < 0) { + if (xlat_aeval(request, &expanded, request, str, NULL, NULL) < 0) { return rcode; }