From: Alan T. DeKok Date: Fri, 21 Dec 2012 12:16:04 +0000 (-0500) Subject: Move Message-Authenticator code X-Git-Tag: release_3_0_0_beta1~1345 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=aebdd33b7b171718ae8ed79fdfc8a5072c882c9b;p=thirdparty%2Ffreeradius-server.git Move Message-Authenticator code from a generic place to a better place --- diff --git a/src/lib/radius.c b/src/lib/radius.c index 600d2295c6a..df1481c6b43 100644 --- a/src/lib/radius.c +++ b/src/lib/radius.c @@ -1521,6 +1521,26 @@ int rad_vp2rfc(const RADIUS_PACKET *packet, return 2; } + /* + * Message-Authenticator is hard-coded. + */ + if (vp->attribute == PW_MESSAGE_AUTHENTICATOR) { + if (room < 18) return -1; + + debug_pair(vp); + ptr[0] = PW_MESSAGE_AUTHENTICATOR; + ptr[1] = 18; + memset(ptr + 2, 0, 16); +#ifndef NDEBUG + if ((fr_debug_flag > 3) && fr_log_fp) { + fprintf(fr_log_fp, "\t\t50 12 ...\n"); + } +#endif + + *pvp = (*pvp)->next; + return 18; + } + return vp2attr_rfc(packet, original, secret, pvp, vp->attribute, ptr, room); } @@ -1545,26 +1565,6 @@ int rad_vp2attr(const RADIUS_PACKET *packet, const RADIUS_PACKET *original, if (vp->vendor == 0) { if (vp->attribute > 255) return 0; - /* - * Message-Authenticator is hard-coded. - */ - if (vp->attribute == PW_MESSAGE_AUTHENTICATOR) { - if (room < 18) return -1; - - debug_pair(vp); - start[0] = PW_MESSAGE_AUTHENTICATOR; - start[1] = 18; - memset(start + 2, 0, 16); -#ifndef NDEBUG - if ((fr_debug_flag > 3) && fr_log_fp) { - fprintf(fr_log_fp, "\t\t50 12 ...\n"); - } -#endif - - *pvp = (*pvp)->next; - return 18; - } - return rad_vp2rfc(packet, original, secret, pvp, start, room); }