From: Ted Lemon Date: Tue, 30 Mar 1999 20:40:59 +0000 (+0000) Subject: - Test for lease before dereferencing it in dhcprequest. X-Git-Tag: V2-BETA-1-PATCH-23~2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=c40ad3fe1944e8fca834796f4f04320bf1ceb542;p=thirdparty%2Fdhcp.git - Test for lease before dereferencing it in dhcprequest. - Free the client parameter request list in dhcpnak if there is one. --- diff --git a/server/dhcp.c b/server/dhcp.c index 30a71be29..52164febb 100644 --- a/server/dhcp.c +++ b/server/dhcp.c @@ -42,7 +42,7 @@ #ifndef lint static char copyright[] = -"$Id: dhcp.c,v 1.57.2.23 1999/03/29 22:29:31 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium. All rights reserved.\n"; +"$Id: dhcp.c,v 1.57.2.24 1999/03/30 20:40:59 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium. All rights reserved.\n"; #endif /* not lint */ #include "dhcpd.h" @@ -314,7 +314,8 @@ void dhcprequest (packet) } /* If we're not allowed to serve this client anymore, don't. */ - if (!lease -> host && + if (lease && + !lease -> host && !lease -> subnet -> group -> boot_unknown_clients) { note ("Ignoring unknown client %s", print_hw_addr (packet -> raw -> htype, @@ -449,6 +450,7 @@ void nak_lease (packet, cip) unsigned char nak = DHCPNAK; struct packet outgoing; struct hardware hto; + int i; struct tree_cache *options [256]; struct tree_cache dhcpnak_tree; @@ -476,9 +478,12 @@ void nak_lease (packet, cip) options [DHO_DHCP_MESSAGE] -> tree = (struct tree *)0; /* Do not use the client's requested parameter list. */ - packet -> options [DHO_DHCP_PARAMETER_REQUEST_LIST].len = 0; - packet -> options [DHO_DHCP_PARAMETER_REQUEST_LIST].data = - (unsigned char *)0; + i = DHO_DHCP_PARAMETER_REQUEST_LIST; + if (packet -> options [i].data) { + packet -> options [i].len = 0; + dfree (packet -> options [i].data, "nak_lease"); + packet -> options [i].data = (unsigned char *)0; + } /* Set up the option buffer... */ outgoing.packet_length =