summaryrefslogtreecommitdiff
path: root/usr.sbin/radiusctl/radiusctl.c
diff options
context:
space:
mode:
authorYASUOKA Masahiko <yasuoka@cvs.openbsd.org>2019-04-01 09:51:57 +0000
committerYASUOKA Masahiko <yasuoka@cvs.openbsd.org>2019-04-01 09:51:57 +0000
commit7211c042321744e688c688e63c7d51112be70bcb (patch)
tree1d33a601c0a2b048b0d61a0d10f40826ce1462a7 /usr.sbin/radiusctl/radiusctl.c
parent4cbf65f20f78a141dde86d0ba232312fb90a1953 (diff)
Show message-authenticator correctly. It had shown the result of
authenticator mistakenly. Original diff from IIJ.
Diffstat (limited to 'usr.sbin/radiusctl/radiusctl.c')
-rw-r--r--usr.sbin/radiusctl/radiusctl.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/usr.sbin/radiusctl/radiusctl.c b/usr.sbin/radiusctl/radiusctl.c
index 49c238f6030..6b1d03e1637 100644
--- a/usr.sbin/radiusctl/radiusctl.c
+++ b/usr.sbin/radiusctl/radiusctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: radiusctl.c,v 1.6 2015/12/31 16:22:27 millert Exp $ */
+/* $OpenBSD: radiusctl.c,v 1.7 2019/04/01 09:51:56 yasuoka Exp $ */
/*
* Copyright (c) 2015 YASUOKA Masahiko <yasuoka@yasuoka.net>
*
@@ -252,10 +252,16 @@ radius_dump(FILE *out, RADIUS_PACKET *pkt, bool resp, const char *secret)
" Code = %s(%d)\n",
(int)radius_get_id(pkt), radius_code_str((int)radius_get_code(pkt)),
(int)radius_get_code(pkt));
- if (resp && secret)
- fprintf(out, " Message-Authenticator = %s\n",
+ if (resp && secret) {
+ fprintf(out, " Authenticator = %s\n",
(radius_check_response_authenticator(pkt, secret) == 0)
? "Verified" : "NG");
+ fprintf(out, " Message-Authenticator = %s\n",
+ (!radius_has_attr(pkt, RADIUS_TYPE_MESSAGE_AUTHENTICATOR))
+ ? "(Not present)"
+ : (radius_check_message_authenticator(pkt, secret) == 0)
+ ? "Verified" : "NG");
+ }
if (radius_get_string_attr(pkt, RADIUS_TYPE_USER_NAME, buf,
sizeof(buf)) == 0)