From: Arran Cudbard-Bell Date: Wed, 16 May 2018 08:40:44 +0000 (+0600) Subject: Remove radius_pair_create X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=a6d3dcf7ab5512abfdaa81ddd09d72bc7997dd90;p=thirdparty%2Ffreeradius-server.git Remove radius_pair_create --- diff --git a/src/include/radiusd.h b/src/include/radiusd.h index d2b195ea959..5ecc8a01741 100644 --- a/src/include/radiusd.h +++ b/src/include/radiusd.h @@ -495,7 +495,6 @@ int radius_callback_compare(REQUEST *request, VALUE_PAIR *req, VALUE_PAIR *check, VALUE_PAIR *check_pairs, VALUE_PAIR **reply_pairs); int radius_find_compare(fr_dict_attr_t const *attribute); -VALUE_PAIR *radius_pair_create(TALLOC_CTX *ctx, VALUE_PAIR **vps, unsigned int attribute, unsigned int vendor); /* * Less code == fewer bugs diff --git a/src/main/pair.c b/src/main/pair.c index 1087d94179c..ca87e5f41fc 100644 --- a/src/main/pair.c +++ b/src/main/pair.c @@ -693,35 +693,6 @@ int xlat_eval_do(REQUEST *request, VALUE_PAIR *vp) return 0; } -/** Create a #VALUE_PAIR and add it to a list of #VALUE_PAIR s - * - * @note This function ALWAYS returns. If we're OOM, then it causes the - * @note server to exit, so you don't need to check the return value. - * - * @param[in] ctx for talloc - * @param[out] vps List to add new #VALUE_PAIR to, if NULL will just - * return #VALUE_PAIR. - * @param[in] attribute number. - * @param[in] vendor number. - * @return a new #VALUE_PAIR or causes server to exit on error. - */ -VALUE_PAIR *radius_pair_create(TALLOC_CTX *ctx, VALUE_PAIR **vps, - unsigned int attribute, unsigned int vendor) -{ - VALUE_PAIR *vp; - - vp = fr_pair_afrom_num(ctx, vendor, attribute); - if (!vp) { - ERROR("No memory!"); - rad_assert("No memory" == NULL); - fr_exit_now(1); - } - - if (vps) fr_pair_add(vps, vp); - - return vp; -} - /** Print a list of VALUE_PAIRs. * * @param[in] level Debug level (1-4). diff --git a/src/modules/rlm_expr/paircmp.c b/src/modules/rlm_expr/paircmp.c index 0f365c99f2a..1a2ada3570f 100644 --- a/src/modules/rlm_expr/paircmp.c +++ b/src/modules/rlm_expr/paircmp.c @@ -117,8 +117,8 @@ static int presufcmp(UNUSED void *instance, * If "request" is NULL, then the memory will be * lost! */ - vp = radius_pair_create(request->packet, &req, FR_STRIPPED_USER_NAME, 0); - if (!vp) return ret; + MEM(vp = fr_pair_afrom_num(request->packet, 0, FR_STRIPPED_USER_NAME)); + fr_pair_add(&req, vp); request->username = vp; }