From: Arran Cudbard-Bell Date: Wed, 31 Jan 2018 05:40:22 +0000 (-0700) Subject: Remove unused function eap_basic_compose X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bb79397192ea4f0ddf5201d1add60bb228b3ffd8;p=thirdparty%2Ffreeradius-server.git Remove unused function eap_basic_compose --- diff --git a/src/modules/rlm_eap/lib/base/eap_types.h b/src/modules/rlm_eap/lib/base/eap_types.h index d1f322c586e..0ecd8e43c2a 100644 --- a/src/modules/rlm_eap/lib/base/eap_types.h +++ b/src/modules/rlm_eap/lib/base/eap_types.h @@ -143,7 +143,7 @@ typedef struct CC_HINT(__packed__) eap_packet_raw { eap_type_t eap_name2type(char const *name); char const *eap_type2name(eap_type_t method); int eap_wireformat(eap_packet_t *reply); -int eap_basic_compose(RADIUS_PACKET *packet, eap_packet_t *reply); + VALUE_PAIR *eap_packet2vp(RADIUS_PACKET *packet, eap_packet_raw_t const *reply); eap_packet_raw_t *eap_vp2packet(TALLOC_CTX *ctx, VALUE_PAIR *vps); void eap_add_reply(REQUEST *request, char const *name, uint8_t const *value, int len); diff --git a/src/modules/rlm_eap/lib/base/eapcommon.c b/src/modules/rlm_eap/lib/base/eapcommon.c index 29f8acea35e..c1d820d9f06 100644 --- a/src/modules/rlm_eap/lib/base/eapcommon.c +++ b/src/modules/rlm_eap/lib/base/eapcommon.c @@ -173,72 +173,6 @@ int eap_wireformat(eap_packet_t *reply) return 0; } - -/* - * compose EAP reply packet in EAP-Message attr of RADIUS. If - * EAP exceeds 253, frame it in multiple EAP-Message attrs. - */ -int eap_basic_compose(RADIUS_PACKET *packet, eap_packet_t *reply) -{ - VALUE_PAIR *vp; - eap_packet_raw_t *eap_packet; - int rcode; - - if (eap_wireformat(reply) < 0) return RLM_MODULE_INVALID; - eap_packet = (eap_packet_raw_t *)reply->packet; - - fr_pair_delete_by_num(&(packet->vps), 0, FR_EAP_MESSAGE, TAG_ANY); - - vp = eap_packet2vp(packet, eap_packet); - if (!vp) return RLM_MODULE_INVALID; - fr_pair_add(&(packet->vps), vp); - - /* - * EAP-Message is always associated with - * Message-Authenticator but not vice-versa. - * - * Don't add a Message-Authenticator if it's already - * there. - */ - vp = fr_pair_find_by_num(packet->vps, 0, FR_MESSAGE_AUTHENTICATOR, TAG_ANY); - if (!vp) { - vp = fr_pair_afrom_num(packet, 0, FR_MESSAGE_AUTHENTICATOR); - vp->vp_length = AUTH_VECTOR_LEN; - vp->vp_octets = talloc_zero_array(vp, uint8_t, vp->vp_length); - - fr_pair_add(&(packet->vps), vp); - } - - /* Set request reply code, but only if it's not already set. */ - rcode = RLM_MODULE_OK; - if (!packet->code) switch (reply->code) { - case FR_EAP_CODE_RESPONSE: - case FR_EAP_CODE_SUCCESS: - packet->code = FR_CODE_ACCESS_ACCEPT; - rcode = RLM_MODULE_HANDLED; - break; - - case FR_EAP_CODE_FAILURE: - packet->code = FR_CODE_ACCESS_REJECT; - rcode = RLM_MODULE_REJECT; - break; - - case FR_EAP_CODE_REQUEST: - packet->code = FR_CODE_ACCESS_CHALLENGE; - rcode = RLM_MODULE_HANDLED; - break; - - default: - /* Should never enter here */ - ERROR("Reply code %d is unknown, Rejecting the request", reply->code); - packet->code = FR_CODE_ACCESS_REJECT; - break; - } - - return rcode; -} - - VALUE_PAIR *eap_packet2vp(RADIUS_PACKET *packet, eap_packet_raw_t const *eap) { int total, size;