From owner-freebsd-bugs Tue Jun 15 12:50: 4 1999 Delivered-To: freebsd-bugs@freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.ORG [204.216.27.21]) by hub.freebsd.org (Postfix) with ESMTP id F30DF15602 for ; Tue, 15 Jun 1999 12:50:00 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.9.3/8.9.2) id MAA32676; Tue, 15 Jun 1999 12:50:01 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: from bamby.marka.net.ua (office-bayda.marka.net.ua [193.193.219.245]) by hub.freebsd.org (Postfix) with ESMTP id 6009B14ECA for ; Tue, 15 Jun 1999 12:40:59 -0700 (PDT) (envelope-from bamby@bamby.marka.net.ua) Received: (from bamby@localhost) by bamby.marka.net.ua (8.9.3/8.9.2) id WAA21466; Tue, 15 Jun 1999 22:38:27 +0300 (EEST) (envelope-from bamby) Message-Id: <199906151938.WAA21466@bamby.marka.net.ua> Date: Tue, 15 Jun 1999 22:38:27 +0300 (EEST) From: bamby@marka.net.ua Reply-To: bamby@marka.net.ua To: FreeBSD-gnats-submit@freebsd.org X-Send-Pr-Version: 3.2 Subject: bin/12225: Incompletness of radius request in ppp Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >Number: 12225 >Category: bin >Synopsis: incompletness of radius request in /usr/sbin/ppp >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Tue Jun 15 12:50:00 PDT 1999 >Closed-Date: >Last-Modified: >Originator: Andriy I Pilipenko >Release: FreeBSD 3.2-STABLE i386 >Organization: Marka Ltd, Zaporizhia, Ukraine >Environment: /usr/sbin/ppp from FreeBSD 3.2-STABLE and Merit AAA Radius Server >Description: Current implementation of /usr/sbin/ppp creates malformed radius request with NAS identifier missing. Merit AAA Radius Server refuses to process such a request. >How-To-Repeat: Build radius package from /usr/ports/net/radius and try to run ppp with radius authentication. ppp never receives reply and server will report malformed request. >Fix: Following patch is made partially based on PAM radius module from FreeBSD 3.2-STABLE. Patch adds two attributes to radius request - NAS-IP-Address (or NAS-Identifier if address is not available) and NAS-Port which is simply ttyslot() return value. *** radius.c.orig Wed May 26 21:15:40 1999 --- radius.c Mon Jun 7 19:54:06 1999 *************** *** 41,46 **** --- 41,48 ---- #include #include #include + #include + #include #include "defs.h" #include "log.h" *************** *** 337,342 **** --- 339,347 ---- { struct timeval tv; int got; + char hostname[MAXHOSTNAMELEN]; + struct hostent *hp; + struct in_addr hostaddr; if (!*r->cfg.file) return; *************** *** 390,396 **** --- 395,432 ---- rad_close(r->cx.rad); return; } + + if (gethostname(hostname, sizeof hostname) != 0) { + log_Printf(LogERROR, "rad_put: cannot get own hostname\n"); + rad_close(r->cx.rad); + return; + } + if ((hp = gethostbyname(hostname)) == (struct hostent *) NULL) { + if (rad_put_string(r->cx.rad, RAD_NAS_IDENTIFIER, hostname) != 0) { + log_Printf(LogERROR, "rad_put: rad_put_string: %s\n", + rad_strerror(r->cx.rad)); + rad_close(r->cx.rad); + return; + } + } + else { + hostaddr.s_addr = *(u_long *)hp->h_addr; + if (rad_put_addr(r->cx.rad, RAD_NAS_IP_ADDRESS, hostaddr) != 0) { + log_Printf(LogERROR, "rad_put: rad_put_string: %s\n", + rad_strerror(r->cx.rad)); + rad_close(r->cx.rad); + return; + } + } + + if(rad_put_int(r->cx.rad, RAD_NAS_PORT, ttyslot()) != 0) { + log_Printf(LogERROR, "rad_put: rad_put_string: %s\n", + rad_strerror(r->cx.rad)); + rad_close(r->cx.rad); + return; + } + if ((got = rad_init_send_request(r->cx.rad, &r->cx.fd, &tv))) radius_Process(r, got); else { >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message