From: Alan T. DeKok Date: Fri, 20 Dec 2024 22:05:28 +0000 (-0500) Subject: make it clear that Message-Authenticator is auto-added X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=04576642267dd026d12b66c3369bc6cbeb239f80;p=thirdparty%2Ffreeradius-server.git make it clear that Message-Authenticator is auto-added manual port of 04b4c655fd --- diff --git a/src/protocols/radius/packet.c b/src/protocols/radius/packet.c index 36f4157935c..91b1f1b9150 100644 --- a/src/protocols/radius/packet.c +++ b/src/protocols/radius/packet.c @@ -486,12 +486,31 @@ void fr_radius_packet_header_log(fr_log_t const *log, fr_packet_t *packet, bool } /* - * Debug the packet header and all attributes + * Debug the packet header and all attributes. This function is only called by the client code. */ void fr_radius_packet_log(fr_log_t const *log, fr_packet_t *packet, fr_pair_list_t *list, bool received) { fr_radius_packet_header_log(log, packet, received); - if (fr_debug_lvl >= L_DBG_LVL_1) fr_pair_list_log(log, 4, list); + + if (!fr_debug_lvl) return; + + /* + * If we're auto-adding Message Authenticator, then print + * out that we're auto-adding it. + */ + if (!received) switch (packet->code) { + case FR_RADIUS_CODE_ACCESS_REQUEST: + case FR_RADIUS_CODE_STATUS_SERVER: + if (!fr_pair_find_by_da(list, NULL, attr_message_authenticator)) { + fprintf(fr_log_fp, "\tMessage-Authenticator = 0x\n"); + } + break; + + default: + break; + } + + fr_pair_list_log(log, 4, list); #ifndef NDEBUG if (fr_debug_lvl >= L_DBG_LVL_4) fr_packet_log_hex(log, packet); #endif