diff options
author | Brad Smith <brad@cvs.openbsd.org> | 2005-09-21 13:58:31 +0000 |
---|---|---|
committer | Brad Smith <brad@cvs.openbsd.org> | 2005-09-21 13:58:31 +0000 |
commit | 87a95c2669adb58328bfe6d64f8fae721466d1c6 (patch) | |
tree | 7304cd90fc285d6d51a8d4089c5d6841bf7b1eee /usr.sbin | |
parent | 5372c2812c1880c641dd28d6f629d3719573dfab (diff) |
If HISMACADDR is set in the environment, pass the value to
the RADIUS server as RAD_CALLING_STATION_ID.
From brian FreeBSD
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/ppp/ppp/radius.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/usr.sbin/ppp/ppp/radius.c b/usr.sbin/ppp/ppp/radius.c index a8d833706f4..712ce3785d1 100644 --- a/usr.sbin/ppp/ppp/radius.c +++ b/usr.sbin/ppp/ppp/radius.c @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $OpenBSD: radius.c,v 1.31 2005/09/21 13:44:55 brad Exp $ + * $OpenBSD: radius.c,v 1.32 2005/09/21 13:58:30 brad Exp $ * */ @@ -827,6 +827,7 @@ radius_Authenticate(struct radius *r, struct authinfo *authp, const char *name, struct timeval tv; int got; char hostname[MAXHOSTNAMELEN]; + char *mac_addr; #if 0 struct hostent *hp; struct in_addr hostaddr; @@ -967,6 +968,13 @@ radius_Authenticate(struct radius *r, struct authinfo *authp, const char *name, } } + if ((mac_addr = getenv("HISMACADDR")) != NULL && + rad_put_string(r->cx.rad, RAD_CALLING_STATION_ID, mac_addr) != 0) { + log_Printf(LogERROR, "rad_put: %s\n", rad_strerror(r->cx.rad)); + rad_close(r->cx.rad); + return 0; + } + radius_put_physical_details(r->cx.rad, authp->physical); r->cx.auth = authp; @@ -1015,6 +1023,7 @@ radius_Account(struct radius *r, struct radacct *ac, struct datalink *dl, struct timeval tv; int got; char hostname[MAXHOSTNAMELEN]; + char *mac_addr; #if 0 struct hostent *hp; struct in_addr hostaddr; @@ -1079,7 +1088,7 @@ radius_Account(struct radius *r, struct radacct *ac, struct datalink *dl, switch (ac->proto) { case PROTO_IPCP: if (rad_put_addr(r->cx.rad, RAD_FRAMED_IP_ADDRESS, - ac->peer.ip.addr) != 0 || \ + ac->peer.ip.addr) != 0 || rad_put_addr(r->cx.rad, RAD_FRAMED_IP_NETMASK, ac->peer.ip.mask) != 0) { log_Printf(LogERROR, "rad_put: %s\n", rad_strerror(r->cx.rad)); @@ -1114,6 +1123,13 @@ radius_Account(struct radius *r, struct radacct *ac, struct datalink *dl, break; } + if ((mac_addr = getenv("HISMACADDR")) != NULL && + rad_put_string(r->cx.rad, RAD_CALLING_STATION_ID, mac_addr) != 0) { + log_Printf(LogERROR, "rad_put: %s\n", rad_strerror(r->cx.rad)); + rad_close(r->cx.rad); + return; + } + if (gethostname(hostname, sizeof hostname) != 0) log_Printf(LogERROR, "rad_put: gethostname(): %s\n", strerror(errno)); else { |