Bug 68268

Summary: [PATCH] SECURITY UPDATE isc-dhcp3-server to 3.0.1rc14
Product: Ports & Packages Reporter: Jason Li <delphij>
Component: Individual Port(s)Assignee: Oliver Eikemeier <eik>
Status: Closed FIXED    
Severity: Affects Only Me CC: cyrille.lefevre
Priority: Normal    
Version: Latest   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
patch-isc none

Description Jason Li 2004-06-24 09:00:43 UTC
	The attached patch upgrades isc-dhcp3-server to 3.0.1rc14, which is a
	security update. An vuxml entry should be added to warn users about
	the vulnerablities found in isc-dhcp3-server 3.0.1rc12 - 3.0.1rc13.

	Maintainer, please review my patch and consider approving it, thanks
	in advance!

	According to US-CERT Technical Cyber Security Alert TA04-174A -- MultipleVulnerabilities in ISC DHCP 3:

	Two vulnerabilities in the ISC DHCP allow a remote attacker to cause a
	denial of the DHCP service on a vulnerable system. It may be possible
	to exploit these vulnerabilities to execute arbitrary code on the
	system.

Fix: Apply the attached patch, then remove zero-sized file (files/patch-freebsd)
Comment 1 Oliver Eikemeier freebsd_committer freebsd_triage 2004-06-24 09:10:34 UTC
State Changed
From-To: open->feedback

Awaiting maintainer approval (maintainer CC'ed) 


Comment 2 Oliver Eikemeier freebsd_committer freebsd_triage 2004-06-24 09:10:34 UTC
Responsible Changed
From-To: freebsd-ports-bugs->eik

I'll handle this (portaudit entry already done)
Comment 3 Cyrille Lefevre 2004-06-25 17:29:00 UTC
Hi,

I've a pending full rewrite of files/isc-dhcpd.sh.sample.
unfortunatelly, I've not finished all the test cases.
since it takes me too much time, here is the port upgrade
not related to rc.subr but related to the security hole.
hope it will be finished soon.

Makefile
	PORTVERSION bumped
	DOC_FILES -> PORTDOCS
	extract-script added to post-extract
distinfo
	updated
pkg-plist
	PORTDOCS deleted
files/patch-Makefile.dist
	shrinked
files/patch-server::dhcpd.c
	updated
files/patch-server::scripts::freebsd
	resynced w/ -current w/ a little change in enter/exit-hooks
	handling.  there was no way to define some functions inside
	since there where source from a function! I'll submit a PR
	about that.

Index: Makefile
===================================================================
RCS file: /home/ncvs/ports/net/isc-dhcp3-server/Makefile,v
retrieving revision 1.95
diff -u -I$Id.*$ -I$.+BSD.*$ -r1.95 Makefile
--- Makefile	1 Jun 2004 13:34:27 -0000	1.95
+++ Makefile	25 Jun 2004 16:23:06 -0000
@@ -7,8 +7,7 @@
 #
 
 PORTNAME=	dhcp
-PORTVERSION=	3.0.1.r12
-PORTREVISION=	3
+PORTVERSION=	3.0.1.r14
 CATEGORIES=	net
 MASTER_SITES=	${MASTER_SITE_ISC}
 MASTER_SITE_SUBDIR=	dhcp dhcp/dhcp-3.0-history
@@ -112,7 +112,9 @@
 BIN_FILES=	dhcrelay
 RC_FILES=	isc-dhcrelay
 .endif
-DOC_FILES=	ANONCVS CHANGES COPYRIGHT README RELNOTES
+.if !defined(NOPORTDOCS)
+PORTDOCS=	LICENSE README RELNOTES
+.endif
 
 SAMP_SUFX=	.sample
 
@@ -128,7 +130,7 @@
 # Post-extract
 #
 
-post-extract: extract-omshell
+post-extract: extract-omshell extract-script
 
 extract-omshell:
 	@${MKDIR} ${WRKSRC}/omshell
@@ -136,6 +138,9 @@
 	@${CP} ${FILESDIR}/omshell::Makefile.dist \
 		${WRKSRC}/omshell/Makefile.dist
 
+extract-script:
+	@${CP} ${FILESDIR}/client::scripts::freebsd ${WRKSRC}/client/scripts/freebsd
+
 # Post-patch
 #
 
@@ -214,7 +219,7 @@
 install-doc-files:
 .if !defined(NOPORTDOCS)
 	@${MKDIR} ${DOCSDIR}
-.for f in ${DOC_FILES}
+.for f in ${PORTDOCS}
 	@${INSTALL_DATA} ${WRKSRC}/${f} ${DOCSDIR}
 .endfor
 .endif
Index: distinfo
===================================================================
RCS file: /home/ncvs/ports/net/isc-dhcp3-server/distinfo,v
retrieving revision 1.46
diff -u -I$Id.*$ -I$.+BSD.*$ -r1.46 distinfo
--- distinfo	11 Mar 2004 13:03:53 -0000	1.46
+++ distinfo	24 Jun 2004 15:00:28 -0000
@@ -1,2 +1,2 @@
-MD5 (dhcp-3.0.1rc12.tar.gz) = cf00193dcf349c888a62e4462ae1eb9c
-SIZE (dhcp-3.0.1rc12.tar.gz) = 857323
+MD5 (dhcp-3.0.1rc14.tar.gz) = a68074d9ebdeb355c293d9b3645b3c2c
+SIZE (dhcp-3.0.1rc14.tar.gz) = 842712
Index: pkg-plist
===================================================================
RCS file: /home/ncvs/ports/net/isc-dhcp3-server/pkg-plist,v
retrieving revision 1.27
diff -u -I$Id.*$ -I$.+BSD.*$ -r1.27 pkg-plist
--- pkg-plist	16 Mar 2004 20:31:15 -0000	1.27
+++ pkg-plist	25 Jun 2004 16:12:59 -0000
@@ -3,11 +3,5 @@
 etc/dhcpd.conf.sample
 etc/rc.d/isc-dhcpd.sh
 sbin/dhcpd
-%%PORTDOCS%%%%DOCSDIR%%/ANONCVS
-%%PORTDOCS%%%%DOCSDIR%%/CHANGES
-%%PORTDOCS%%%%DOCSDIR%%/COPYRIGHT
-%%PORTDOCS%%%%DOCSDIR%%/README
-%%PORTDOCS%%%%DOCSDIR%%/RELNOTES
-%%PORTDOCS%%@dirrm %%DOCSDIR%%
 @exec [ -f /var/db/dhcpd.leases ] || touch /var/db/dhcpd.leases
 @unexec [ -s /var/db/dhcpd.leases ] || rm -f /var/db/dhcpd.leases
Index: files/patch-Makefile.dist
===================================================================
RCS file: /home/ncvs/ports/net/isc-dhcp3-server/files/patch-Makefile.dist,v
retrieving revision 1.1
diff -u -I$Id.*$ -I$.+BSD.*$ -r1.1 patch-Makefile.dist
--- files/patch-Makefile.dist	17 Jan 2004 23:09:02 -0000	1.1
+++ files/patch-Makefile.dist	24 Jun 2004 15:02:41 -0000
@@ -1,22 +1,5 @@
 --- Makefile.dist.orig	Fri Nov  8 00:10:08 2002
 +++ Makefile.dist	Tue Apr 29 00:07:43 2003
-@@ -3,13 +3,13 @@
- # Copyright (c) 1996-2002 Internet Software Consortium.
- # Use is subject to license terms which appear in the file named
- # ISC-LICENSE that should have accompanied this file when you
--# received it.   If a file named ISC-LICENSE did not accompany this
-+# received it.  If a file named ISC-LICENSE did not accompany this
- # file, or you are not sure the one you have is correct, you may
- # obtain an applicable copy of the license at:
- #
--#             http://www.isc.org/isc-license-1.0.html. 
-+#            http://www.isc.org/isc-license-1.0.html. 
- #
--# This file is part of the ISC DHCP distribution.   The documentation
-+# This file is part of the ISC DHCP distribution.  The documentation
- # associated with this file is listed in the file DOCUMENTATION,
- # included in the top-level directory of this release.
- #
 @@ -17,47 +17,200 @@
  # http://www.isc.org for more information.
  #
Index: files/patch-server::dhcpd.c
===================================================================
RCS file: /home/ncvs/ports/net/isc-dhcp3-server/files/patch-server::dhcpd.c,v
retrieving revision 1.1
diff -u -I$Id.*$ -I$.+BSD.*$ -r1.1 patch-server::dhcpd.c
--- files/patch-server::dhcpd.c	1 Jun 2004 13:34:27 -0000	1.1
+++ files/patch-server::dhcpd.c	25 Jun 2004 13:49:31 -0000
@@ -1,6 +1,6 @@
---- server/dhcpd.c.orig	Wed Jan 15 00:15:24 2003
-+++ server/dhcpd.c	Sun May 30 23:14:42 2004
-@@ -56,6 +56,22 @@
+--- server/dhcpd.c.orig	Thu Jun 10 19:59:52 2004
++++ server/dhcpd.c	Fri Jun 25 15:49:09 2004
+@@ -47,6 +47,22 @@
  #include "version.h"
  #include <omapip/omapip_p.h>
  
@@ -23,7 +23,7 @@
  static void usage PROTO ((void));
  
  TIME cur_time;
-@@ -204,6 +220,35 @@
+@@ -195,6 +211,35 @@
  	omapi_object_dereference (&listener, MDL);
  }
  
@@ -59,7 +59,7 @@
  int main (argc, argv, envp)
  	int argc;
  	char **argv, **envp;
-@@ -236,6 +281,20 @@
+@@ -227,6 +272,25 @@
  	char *traceinfile = (char *)0;
  	char *traceoutfile = (char *)0;
  #endif
@@ -69,18 +69,23 @@
 +	uid_t set_uid = 0;
 +	gid_t set_gid = 0;
 +	int early_chroot = 0;
++	int no_dhcpd_user = 0;
++	int no_dhcpd_group = 0;
 +#endif /* PARANOIA */
 +#if defined (PARANOIA) || defined (JAIL)
 +	char *set_chroot = 0;
++	int no_dhcpd_chroot = 0;
 +#endif /* PARANOIA || JAIL */
 +#if defined (JAIL)
 +	char *set_jail = 0;
 +	u_int32_t jail_ip_address = 0; /* Good as long as it's IPv4 ... */
++	int no_dhcpd_jail = 0;
++	char *s2;
 +#endif /* JAIL */
  
  	/* Make sure we have stdin, stdout and stderr. */
  	status = open ("/dev/null", O_RDWR);
-@@ -298,6 +357,35 @@
+@@ -289,6 +353,39 @@
  			if (++i == argc)
  				usage ();
  			server = argv [i];
@@ -89,10 +94,12 @@
 +			if (++i == argc)
 +				usage ();
 +			set_user = argv [i];
++			no_dhcpd_user = 1;
 +		} else if (!strcmp (argv [i], "-group")) {
 +			if (++i == argc)
 +				usage ();
 +			set_group = argv [i];
++			no_dhcpd_group = 1;
 +		} else if (!strcmp (argv [i], "-early_chroot")) {
 +			early_chroot = 1;
 +#endif /* PARANOIA */
@@ -101,6 +108,7 @@
 +			if (++i == argc)
 +				usage ();
 +			set_chroot = argv [i];
++			no_dhcpd_chroot = 1;
 +#endif /* PARANOIA || JAIL */
 +#if defined (JAIL)
 +		} else if (!strcmp (argv [i], "-jail")) {
@@ -110,13 +118,43 @@
 +			if (++i == argc)
 +				usage ();
 +			if (ascii2addr (AF_INET, argv[i], &jail_ip_address) < 0)
-+				usage();
++				log_fatal ("invalid ip address: %s", argv[i]);
 +			jail_ip_address = ntohl (jail_ip_address);
++			no_dhcpd_jail = 1;
 +#endif /* JAIL */
  		} else if (!strcmp (argv [i], "-cf")) {
  			if (++i == argc)
  				usage ();
-@@ -397,6 +485,57 @@
+@@ -366,6 +463,28 @@
+ 	if (!no_dhcpd_pid && (s = getenv ("PATH_DHCPD_PID"))) {
+ 		path_dhcpd_pid = s;
+ 	}
++#if defined (PARANOIA)
++	if (!no_dhcpd_user && (s = getenv ("DHCPD_USER"))) {
++		set_user = s;
++	}
++	if (!no_dhcpd_group && (s = getenv ("DHCPD_GROUP"))) {
++		set_group = s;
++	}
++#endif /* PARANOIA */
++#if defined (PARANOIA) || defined (JAIL)
++	if (!no_dhcpd_chroot && (s = getenv ("PATH_DHCPD_CHROOT"))) {
++		set_chroot = s;
++	}
++#endif /* PARANOIA || JAIL */
++#if defined (JAIL)
++	if (!no_dhcpd_jail && (s = getenv ("DHCPD_JAIL_HOSTNAME")) &&
++	    (s2 = getenv ("DHCPD_JAIL_IPADDRESS"))) {
++		set_jail = s;
++		if (ascii2addr (AF_INET, s2, &jail_ip_address) < 0)
++			log_fatal ("invalid ip address: %s", s2);
++		jail_ip_address = ntohl (jail_ip_address);
++	}
++#endif /* JAIL */
+ 
+ 	if (!quiet) {
+ 		log_info ("%s %s", message, DHCP_VERSION);
+@@ -388,6 +507,57 @@
  					     trace_seed_stop, MDL);
  #endif
  
@@ -174,7 +212,7 @@
  	/* Default to the DHCP/BOOTP port. */
  	if (!local_port)
  	{
-@@ -471,6 +610,9 @@
+@@ -462,6 +632,9 @@
  #endif
  
  	/* Initialize icmp support... */
@@ -184,7 +222,7 @@
  	if (!cftest && !lftest)
  		icmp_startup (1, lease_pinged);
  
-@@ -500,6 +642,14 @@
+@@ -491,6 +664,14 @@
  
  	postconf_initialization (quiet);
  
@@ -199,7 +237,7 @@
          /* test option should cause an early exit */
   	if (cftest && !lftest) 
   		exit(0);
-@@ -542,7 +692,22 @@
+@@ -533,7 +714,22 @@
  		else if (pid)
  			exit (0);
  	}
@@ -222,7 +260,7 @@
  	/* Read previous pid file. */
  	if ((i = open (path_dhcpd_pid, O_RDONLY)) >= 0) {
  		status = read (i, pbuf, (sizeof pbuf) - 1);
-@@ -886,8 +1051,24 @@
+@@ -877,8 +1073,24 @@
  	log_info (copyright);
  	log_info (arr);
  
--- /dev/null	Fri Jun 25 18:00:36 2004
+++ files/client::scripts::freebsd	Thu Jun 24 17:43:12 2004
@@ -0,0 +1,509 @@
+#!/bin/sh
+
+#############################################################################
+#
+# Copyright (c) 1999, MindStep Corporation
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+#    notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#    notice, this list of conditions and the following disclaimer in the
+#    documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+#
+#
+#############################################################################
+#
+# This script was written by Patrick Bihan-Faou, patrick@mindstep.com,
+# Please contact us for bug reports, etc.
+#
+#############################################################################
+# $MindStep_Id: dhclient-script.sh,v 1.8 1999/12/07 22:11:08 patrick Exp $
+# $MindStep_Tag: CONTRIB_19991207 $
+# $FreeBSD: src/sbin/dhclient/dhclient-script.sh,v 1.2 2002/02/01 18:46:58 alfred Exp $
+#############################################################################
+
+
+#############################################################################
+# hook functions prototypes
+#
+# The "pre_state_XXX_hook" functions are called before the main
+# work is done for the state XXX
+#
+# The "post_state_XXX_hook" functions are called after the main
+# work is done for the state XXX
+#
+# These functions are meant to be overridden by the user's
+# dhclient-enter-hooks file
+#############################################################################
+
+pre_state_MEDIUM_hook () { }
+pre_state_PREINIT_hook () { }
+pre_state_ARPCHECK_hook () { }
+pre_state_ARPSEND_hook () { }
+pre_state_RENEW_hook () { }
+pre_state_REBIND_hook () { }
+pre_state_BOUND_hook () { }
+pre_state_REBOOT_hook () { }
+pre_state_EXPIRE_hook () { }
+pre_state_FAIL_hook () { }
+pre_state_TIMEOUT_hook () { }
+post_state_MEDIUM_hook () { }
+post_state_PREINIT_hook () { }
+post_state_ARPCHECK_hook () { }
+post_state_ARPSEND_hook () { }
+post_state_RENEW_hook () { }
+post_state_REBIND_hook () { }
+post_state_BOUND_hook () { }
+post_state_REBOOT_hook () { }
+post_state_EXPIRE_hook () { }
+post_state_FAIL_hook () { }
+post_state_TIMEOUT_hook () { }
+
+#############################################################################
+# make_resolv_conf
+#
+# This function is called to update the information related to the
+# DNS configuration (the resolver part)
+#############################################################################
+make_resolv_conf () 
+{
+   if [ "x$new_domain_name" != x ] && [ "x$new_domain_name_servers" != x ]; then
+     echo search $new_domain_name >/etc/resolv.conf
+     for nameserver in $new_domain_name_servers; do
+       echo nameserver $nameserver >>/etc/resolv.conf
+     done
+   fi
+}
+
+#############################################################################
+# set_XXX
+# unset_XXX
+#
+# These function each deal with one particular setting.
+# They are OS dependent and may be overridden in the 
+# dhclient-enter-hooks file if needed.
+#
+# These functions are called with either "new" or "old" to indicate which
+# set of variables to use (new_ip_address or old_ip_address...)
+#
+#############################################################################
+
+update_hostname ()
+{
+	local current_hostname=`/bin/hostname`
+
+  	if	[ "$current_hostname" = "" ] || \
+		[ "$current_hostname" = "$old_host_name" ]
+	then
+		if [ "$new_host_name" != "$old_host_name" ]
+		then
+			$LOGGER "New Hostname: $new_host_name"
+			hostname $new_host_name
+		fi
+	fi
+}
+
+set_ip_address () 
+{
+	local ip
+	local mask
+	local bcast
+
+	if [ $# -lt 1 ]
+	then
+		return  1
+	fi
+
+	eval ip="\$${1}_ip_address"
+	eval mask="\$${1}_subnet_mask"
+	eval bcast="\$${1}_broadcast_address"
+
+	if [ "$ip" != "" ]
+	then
+		ifconfig $interface inet $ip netmask $mask broadcast $bcast $medium
+#		route add $ip 127.0.0.1 > /dev/null 2>&1
+	fi
+}
+
+unset_ip_address () 
+{
+	local ip
+
+	if [ $# -lt 1 ]
+	then
+		return  1
+	fi
+
+	eval ip="\$${1}_ip_address"
+
+	if [ "$ip" != "" ]
+	then
+		ifconfig $interface inet -alias $ip $medium
+#		route delete $ip 127.0.0.1 > /dev/null 2>&1
+	fi
+}
+
+set_ip_alias () 
+{
+	if [ "$alias_ip_address" != "" ]
+	then
+		ifconfig $interface inet alias $alias_ip_address netmask $alias_subnet_mask
+#		route add $alias_ip_address 127.0.0.1
+	fi
+}
+
+unset_ip_alias () 
+{
+	if [ "$alias_ip_address" != "" ]
+	then
+		ifconfig $interface inet -alias $alias_ip_address > /dev/null 2>&1
+#		route delete $alias_ip_address 127.0.0.1 > /dev/null 2>&1
+	fi
+}
+
+set_routers () 
+{
+	local router_list
+
+	if [ $# -lt 1 ]
+	then
+		return  1
+	fi
+
+	eval router_list="\$${1}_routers"
+
+	for router in $router_list
+	do
+		route add default $router >/dev/null 2>&1
+	done
+}
+
+unset_routers () 
+{
+	local router_list
+
+	if [ $# -lt 1 ]
+	then
+		return  1
+	fi
+
+	eval router_list="\$${1}_routers"
+
+	for router in $router_list
+	do
+		route delete default $router >/dev/null 2>&1
+	done
+}
+
+set_static_routes () 
+{
+	local static_routes
+
+	if [ $# -lt 1 ]
+	then
+		return  1
+	fi
+
+	eval static_routes="\$${1}_static_routes"
+
+	set static_routes
+
+	while [ $# -ge 2 ]
+	do
+		$LOGGER "New Static Route: $1 -> $2"
+		route add $1 $2
+		shift; shift
+	done
+}
+
+unset_static_routes () 
+{
+	local static_routes
+
+	if [ $# -lt 1 ]
+	then
+		return  1
+	fi
+
+	eval static_routes="\$${1}_static_routes"
+
+	set static_routes
+
+	while [ $# -ge 2 ]
+	do
+		route delete $1 $2
+		shift; shift
+	done
+}
+
+#############################################################################
+#
+# utility functions grouping what needs to be done in logical units.
+#
+#############################################################################
+
+set_all ()
+{
+	set_ip_address new
+	set_routers new
+	set_static_routes new
+
+	if	[ "$new_ip_address" != "$alias_ip_address" ]
+	then
+		set_ip_alias
+	fi
+}
+
+set_others ()
+{
+	update_hostname
+	make_resolv_conf
+}
+
+clear_arp_table () 
+{
+	arp -d -a
+}
+
+unset_all ()
+{
+	if [ "$alias_ip_address" != "$old_ip_address" ]
+	then
+		unset_ip_alias
+	fi
+
+	if [ "$old_ip_address" != "" ] 
+	then
+		unset_ip_address old
+		unset_routers old
+		unset_static_routes old
+		clear_arp_table
+	fi
+}
+
+test_new_lease () 
+{
+	local rc
+
+	set $new_routers
+
+	if [ $# -ge 1 ]
+	then
+		set_ip_address new
+		if ping -q -c 1 $1
+		then
+			rc=0
+		else
+			rc=1
+		fi
+		unset_ip_address new
+	else
+		rc=1
+	fi
+	return  $rc
+}
+
+#############################################################################
+# Main State functions.
+#
+# There is a state function for each state of the DHCP client
+# These functions are OS specific and should be be tampered with.
+#############################################################################
+
+in_state_MEDIUM () 
+{
+  ifconfig $interface $medium
+  ifconfig $interface inet -alias 0.0.0.0 $medium >/dev/null 2>&1
+  sleep 1
+  exit_status=0
+}
+
+in_state_PREINIT () 
+{
+	unset_ip_alias
+
+	ifconfig $interface inet 0.0.0.0 netmask 0.0.0.0 \
+			broadcast 255.255.255.255 up
+	exit_status=0
+}
+
+in_state_ARPCHECK () 
+{
+  exit_status=0
+}
+
+in_state_ARPSEND () 
+{
+  exit_status=0
+}
+
+in_state_RENEW () 
+{
+	if [ "$old_ip_address" != "$new_ip_address" ]
+	then
+		unset_all
+		set_all
+	fi
+
+	set_others
+}
+
+in_state_REBIND () {
+	in_state_RENEW
+}
+
+in_state_BOUND () {
+	unset_all
+	set_all
+	set_others
+}
+
+in_state_REBOOT () {
+	in_state_BOUND
+}
+
+in_state_EXPIRE () 
+{
+	unset_all
+	set_ip_alias
+	exit_status=0
+}
+
+in_state_FAIL () {
+	in_state_EXPIRE
+}
+
+in_state_TIMEOUT () 
+{
+	unset_all
+
+	if test_new_lease
+	then
+		set_all
+		set_others
+	else
+	 	$LOGGER "No good lease information in TIMEOUT state"	
+		set_ip_alias
+		exit_status=1
+	fi
+}
+
+#############################################################################
+# Main functions:
+#
+# dhclient_script_init() parses the optional "enter_hooks" script which can
+#   override any of the state functions
+#
+# This function also parses the variables and notifies the detected changes.
+#############################################################################
+dhclient_script_init ()
+{
+	if [ "$new_network_number" != "" ]
+	then
+		$LOGGER "New Network Number: $new_network_number"
+	fi
+
+	if [ "$new_ip_address" != "" ]
+	then
+		$LOGGER "New IP Address: $new_ip_address"
+	fi
+
+	if [ "$new_broadcast_address" != "" ]
+	then
+		$LOGGER "New Broadcast Address: $new_broadcast_address"
+	fi
+
+	if [ "$new_subnet_mask" != "" ]
+	then
+		$LOGGER "New Subnet Mask for $interface: $new_subnet_mask"
+	fi
+
+	if [ "$alias_subnet_mask" != "" ]
+	then
+	fi
+}
+
+#############################################################################
+# dhclient_main() does the appropriate work depending on the state of
+# the dhcp client
+#############################################################################
+dhclient_script_main ()
+{
+#	set -x
+	exit_status=0
+
+	case $reason in
+		MEDIUM|\
+		PREINIT|\
+		ARPCHECK|\
+		ARPSEND|\
+		RENEW|\
+		REBIND|\
+		BOUND|\
+		REBOOT|\
+		EXPIRE|\
+		FAIL|\
+		TIMEOUT)
+			pre_state_${reason}_hook
+			in_state_${reason}
+			post_state_${reason}_hook
+			;;
+		*)
+			$LOGGER "dhclient-script called with invalid reason $reason"
+			exit_status=1
+			;;
+	esac
+}
+
+#############################################################################
+# Let's do the work...
+#############################################################################
+
+if [ -x /usr/bin/logger ]; then
+	LOGGER="/usr/bin/logger -s -p user.notice -t dhclient"
+else
+	LOGGER=echo
+fi
+
+# Invoke the local dhcp client enter hooks, if they exist.
+if [ -x %%PREFIX%%/etc/dhclient-enter-hooks ]
+then
+	exit_status=0
+	. %%PREFIX%%/etc/dhclient-enter-hooks
+	# allow the local script to abort processing of this state
+	# local script must set exit_status variable to nonzero.
+	if [ $exit_status -ne 0 ]
+	then
+		exit $exit_status
+	fi
+fi
+
+dhclient_script_init
+dhclient_script_main
+
+# Invokes the local dhcp client exit hooks, if any.
+if [ -x %%PREFIX%%/etc/dhclient-exit-hooks ]; then
+	. %%PREFIX%%/etc/dhclient-exit-hooks
+fi
+
+exit $exit_status
+
+#############################################################################
+# That's all folks
+#############################################################################
Cyrille Lefevre
-- 
mailto:cyrille.lefevre@laposte.net
Comment 4 Cyrille Lefevre 2004-06-25 18:58:24 UTC
"Oliver Eikemeier" <eikemeier@fillmore-labs.com> wrote:
> Cyrille Lefevre wrote:
> 
> > files/patch-server::scripts::freebsd
> 
> no such file here.
> 
> ===>  Applying FreeBSD patches for isc-dhcp3-server-3.0.1.r14
> 5 out of 5 hunks failed--saving rejects to client/scripts/freebsd.rej
>  >> Patch patch-freebsd failed to apply cleanly.


oops, it looks I've made some mixup, here %-/

files/patch-freebsd
    deleted
files/client::scripts::freebsd 
    new file

sorry.

CC -gnats

Cyrille Lefevre.
-- 
home: mailto:cyrille.lefevre@laposte.net
Comment 5 Oliver Eikemeier freebsd_committer freebsd_triage 2004-06-26 18:05:26 UTC
State Changed
From-To: feedback->closed

Committed, thanks!