From owner-freebsd-ports-bugs@FreeBSD.ORG Tue May 23 08:50:21 2006 Return-Path: X-Original-To: freebsd-ports-bugs@hub.freebsd.org Delivered-To: freebsd-ports-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 2857916A451 for ; Tue, 23 May 2006 08:50:21 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id BBB8643D5E for ; Tue, 23 May 2006 08:50:19 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.4/8.13.4) with ESMTP id k4N8oJ7K023875 for ; Tue, 23 May 2006 08:50:19 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.4/8.13.4/Submit) id k4N8oJuX023874; Tue, 23 May 2006 08:50:19 GMT (envelope-from gnats) Resent-Date: Tue, 23 May 2006 08:50:19 GMT Resent-Message-Id: <200605230850.k4N8oJuX023874@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-ports-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Joerg Pulz Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 12FC016A41F; Tue, 23 May 2006 08:40:32 +0000 (UTC) (envelope-from Joerg.Pulz@frm2.tum.de) Received: from mailhost.frm2.tum.de (mailhost.frm2.tum.de [129.187.179.12]) by mx1.FreeBSD.org (Postfix) with ESMTP id 805AB43D45; Tue, 23 May 2006 08:40:26 +0000 (GMT) (envelope-from Joerg.Pulz@frm2.tum.de) Received: from localhost (mailhost.frm2.tum.de [129.187.179.12]) by mailhost.frm2.tum.de (8.13.4/8.13.4) with ESMTP id k4N8eKnY090884; Tue, 23 May 2006 10:40:21 +0200 (CEST) (envelope-from jpulz@frm2.tum.de) Received: from hades.admin.frm2 (hades.admin.frm2 [172.25.1.10]) by mailhost.frm2.tum.de (8.13.4/8.13.4) with ESMTP id k4N8dJ7V090857 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Tue, 23 May 2006 10:39:19 +0200 (CEST) (envelope-from jpulz@frm2.tum.de) Received: from hades.admin.frm2 (localhost [127.0.0.1]) by hades.admin.frm2 (8.13.4/8.13.4) with ESMTP id k4N8dJBa081829; Tue, 23 May 2006 10:39:19 +0200 (CEST) (envelope-from jpulz@frm2.tum.de) Received: (from jpulz@localhost) by hades.admin.frm2 (8.13.4/8.13.4/Submit) id k4N8dJmx081828; Tue, 23 May 2006 10:39:19 +0200 (CEST) (envelope-from jpulz) Message-Id: <200605230839.k4N8dJmx081828@hades.admin.frm2> Date: Tue, 23 May 2006 10:39:19 +0200 (CEST) From: Joerg Pulz To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Cc: Sergey Matveychuk Subject: ports/97681: [maintainer-update] net/isc-dhcp3-server: better fix for time_t size problem on *64 ARCHS X-BeenThere: freebsd-ports-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Joerg Pulz List-Id: Ports bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 May 2006 08:50:25 -0000 >Number: 97681 >Category: ports >Synopsis: [maintainer-update] net/isc-dhcp3-server: better fix for time_t size problem on *64 ARCHS >Confidential: no >Severity: critical >Priority: high >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: maintainer-update >Submitter-Id: current-users >Arrival-Date: Tue May 23 08:50:19 GMT 2006 >Closed-Date: >Last-Modified: >Originator: Joerg Pulz >Release: FreeBSD 6.1-PRERELEASE i386 >Organization: TU-Munich / ZWE FRM-II >Environment: System: FreeBSD hades.admin.frm2 6.1-PRERELEASE FreeBSD 6.1-PRERELEASE #11: Wed Feb 22 19:01:44 CET 2006 root@hades.admin.frm2:/usr/obj/usr/src/sys/HADES i386 >Description: Fix the time_t problem on *64 ARCHS without introducing a possible security risk by writing 8 bytes to a 4 byte declared variable. My first fix was really a ugly quick hack as some reallife tasks took slightly longer than i thought. I'm really sorry for all this trouble. Many thanks to Dan Lukes for pointing this out and providing the patch. Tested on: RELENG_6_1 amd64, sparc64 with Windows XP client >How-To-Repeat: >Fix: - apply the patch - add files/patch-server::dhcp.c to CVS --- net_isc-dhcp3-server.diff begins here --- Index: Makefile =================================================================== RCS file: /home/ncvs/ports/net/isc-dhcp3-server/Makefile,v retrieving revision 1.115 diff -u -r1.115 Makefile --- Makefile 21 May 2006 18:05:39 -0000 1.115 +++ Makefile 23 May 2006 08:25:22 -0000 @@ -8,7 +8,7 @@ PORTNAME= dhcp PORTVERSION= 3.0.4 -PORTREVISION= 1 +PORTREVISION= 2 CATEGORIES= net MASTER_SITES= ${MASTER_SITE_ISC} MASTER_SITE_SUBDIR= dhcp dhcp/dhcp-3.0-history @@ -40,10 +40,6 @@ .include -.if ${ARCH} == "amd64" || ${ARCH} == "ia64" || ${ARCH} == "sparc64" -FORBIDDEN= the last fix for 64-bit platforms may cause security problems -.endif - .if ${SUBSYS} == server && defined(WITH_DHCP_LDAP) # Based on patch from Brian Masney : PATCH_SITES= http://www.newwave.net/~masneyb/:ldap \ Index: files/patch-includes::cf::freebsd.h =================================================================== RCS file: /home/ncvs/ports/net/isc-dhcp3-server/files/patch-includes::cf::freebsd.h,v retrieving revision 1.3 diff -u -r1.3 patch-includes::cf::freebsd.h --- files/patch-includes::cf::freebsd.h 16 May 2006 06:20:52 -0000 1.3 +++ files/patch-includes::cf::freebsd.h 23 May 2006 08:25:22 -0000 @@ -9,15 +9,6 @@ #include #include #include -@@ -82,7 +82,7 @@ - - /* Time stuff... */ - #include --#define TIME time_t -+#define TIME u_int32_t - #define GET_TIME(x) time ((x)) - - #define HAVE_SA_LEN @@ -97,6 +97,10 @@ #define SOCKLEN_T int #endif Index: files/patch-server::dhcp.c =================================================================== RCS file: files/patch-server::dhcp.c diff -N files/patch-server::dhcp.c --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ files/patch-server::dhcp.c 23 May 2006 08:25:22 -0000 @@ -0,0 +1,53 @@ +--- server/dhcp.c.orig Wed Feb 22 23:43:27 2006 ++++ server/dhcp.c Mon May 22 01:39:59 2006 +@@ -2442,6 +2442,7 @@ + offered_lease_time = + state -> offered_expiry - cur_time; + ++ state -> expiry = 0; + putULong ((unsigned char *)&state -> expiry, + (unsigned long)offered_lease_time); + i = DHO_DHCP_LEASE_TIME; +@@ -2452,7 +2453,7 @@ + if (option_cache_allocate (&oc, MDL)) { + if (make_const_data (&oc -> expression, + (unsigned char *)&state -> expiry, +- sizeof state -> expiry, ++ 4, + 0, 0, MDL)) { + oc -> option = dhcp_universe.options [i]; + save_option (&dhcp_universe, +@@ -2463,6 +2464,7 @@ + + /* Renewal time is lease time * 0.5. */ + offered_lease_time /= 2; ++ state -> renewal = 0; + putULong ((unsigned char *)&state -> renewal, + (unsigned long)offered_lease_time); + i = DHO_DHCP_RENEWAL_TIME; +@@ -2474,7 +2476,7 @@ + if (make_const_data (&oc -> expression, + (unsigned char *) + &state -> renewal, +- sizeof state -> renewal, ++ 4, + 0, 0, MDL)) { + oc -> option = dhcp_universe.options [i]; + save_option (&dhcp_universe, +@@ -2486,6 +2488,7 @@ + /* Rebinding time is lease time * 0.875. */ + offered_lease_time += (offered_lease_time / 2 + + offered_lease_time / 4); ++ state -> rebind = 0; + putULong ((unsigned char *)&state -> rebind, + (unsigned)offered_lease_time); + i = DHO_DHCP_REBINDING_TIME; +@@ -2496,7 +2499,7 @@ + if (option_cache_allocate (&oc, MDL)) { + if (make_const_data (&oc -> expression, + (unsigned char *)&state -> rebind, +- sizeof state -> rebind, ++ 4, + 0, 0, MDL)) { + oc -> option = dhcp_universe.options [i]; + save_option (&dhcp_universe, --- net_isc-dhcp3-server.diff ends here --- >Release-Note: >Audit-Trail: >Unformatted: