Date: Wed, 25 Apr 2001 18:48:18 +0300 From: Victor Ivanov <v0rbiz@icon.bg> To: freebsd-hackers@freebsd.org Cc: freebsd-isp@freebsd.org Subject: ppp showing radius message Message-ID: <20010425184818.A20522@icon.icon.bg>
next in thread | raw e-mail | index | archive | help
--R3G7APHDIzY6R/pk Content-Type: multipart/mixed; boundary="82I3+IH0IqGh5yIs" Content-Disposition: inline --82I3+IH0IqGh5yIs Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi, I made a simple (and ugly) patch to ppp to show the radius message when a radius reject is received. It also saves it in struct authinfo so the au= th failure routine can pass it to the peer. The patch modifies pap.c to do th= is, but I don't know how to modify the other auth types (I'm using pap only her= e). Someone finds this useful (except me)? P.S. It's tested on the server side (with Windows client and a PicoBSD clie= nt for peers). --=20 Players win and winners play Have a lucky day --82I3+IH0IqGh5yIs Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="ppp-message.patch" Content-Transfer-Encoding: quoted-printable --- auth.h.orig Wed Apr 25 18:13:13 2001 +++ auth.h Wed Apr 25 18:13:25 2001 @@ -42,6 +42,7 @@ struct { struct fsm_retry fsm; /* How often/frequently to resend requests */ } cfg; + char *fail_message; }; =20 #define auth_Failure(a) (*a->fn.failure)(a); --- pap.c.orig Wed Apr 25 18:13:43 2001 +++ pap.c Wed Apr 25 18:15:51 2001 @@ -149,7 +149,8 @@ static void pap_Failure(struct authinfo *authp) { - SendPapCode(authp, PAP_NAK, "Login incorrect"); + SendPapCode(authp, PAP_NAK, + (authp->fail_message ? authp->fail_message : "Login incorrect")); datalink_AuthNotOk(authp->physical->dl); } =20 --- radius.c.orig Wed Apr 25 18:15:55 2001 +++ radius.c Wed Apr 25 18:24:07 2001 @@ -83,6 +83,8 @@ #include "datalink.h" #include "bundle.h" =20 +static char fail_message[128]; + /* * rad_continue_send_request() has given us `got' (non-zero). Deal with i= t. */ @@ -111,10 +113,32 @@ break; =20 case RAD_ACCESS_REJECT: - log_Printf(LogPHASE, "Radius(%s): REJECT received\n", stype); - if (r->cx.auth) - auth_Failure(r->cx.auth); - rad_close(r->cx.rad); + { + int got2; + + nuke =3D NULL; + while (!nuke && ((got2 =3D rad_get_attr(r->cx.rad, &data, &len)) >= 0)) { + if (got2 =3D=3D RAD_REPLY_MESSAGE) { + if ((nuke =3D rad_cvt_string(data, len)) =3D=3D NULL) { + log_Printf(LogERROR, "rad_cvt_string: %s\n", rad_strerror(r->cx.rad= )); + rad_close(r->cx.rad); + return; + } + } + } + if (nuke) { + strlcpy(fail_message, nuke, sizeof(fail_message)); + free(nuke); + r->cx.auth->fail_message =3D fail_message; + log_Printf(LogPHASE, "Radius(%s): REJECT received (%s)\n", + stype, fail_message); + } else + log_Printf(LogPHASE, "Radius(%s): REJECT received\n", stype); + + if (r->cx.auth) + auth_Failure(r->cx.auth); + rad_close(r->cx.rad); + } return; =20 case RAD_ACCESS_CHALLENGE: --82I3+IH0IqGh5yIs-- --R3G7APHDIzY6R/pk Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: PGP 6.5.1i iQCVAwUBOubxwPD9M5lef5W3AQH3vgQAjcmUOXh9w7seLaBhpEl4n8IZkgSCS1Z3 jzaNt3QMgfOGRz2zMubV0JyJxu2lgBoGn1+NnQ/wRJyzGQI9w8qkG9ZPzwnNN9Qu wlCksFfJ+WTaEpJYDeiqDuYSt+qQB+J2fCz0sINUg2yGIpB2CNgIIGo3qGK5KMzC Oon5YS8ZZV4= =9p7B -----END PGP SIGNATURE----- --R3G7APHDIzY6R/pk-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010425184818.A20522>