From marcus@shumai.marcuscom.com  Thu Sep 13 19:42:21 2001
Return-Path: <marcus@shumai.marcuscom.com>
Received: from creme-brulee.marcuscom.com (rdu57-28-046.nc.rr.com [66.57.28.46])
	by hub.freebsd.org (Postfix) with ESMTP id 7F96C37B40E
	for <FreeBSD-gnats-submit@freebsd.org>; Thu, 13 Sep 2001 19:42:20 -0700 (PDT)
Received: from shumai.marcuscom.com (shumai.marcuscom.com [192.168.1.4])
	by creme-brulee.marcuscom.com (8.11.3/8.11.3) with ESMTP id f8E2f3579840
	for <FreeBSD-gnats-submit@freebsd.org>; Thu, 13 Sep 2001 22:41:03 -0400 (EDT)
	(envelope-from marcus@shumai.marcuscom.com)
Received: (from marcus@localhost)
	by shumai.marcuscom.com (8.11.3/8.11.3) id f8E2gNi07731;
	Thu, 13 Sep 2001 22:42:23 -0400 (EDT)
	(envelope-from marcus)
Message-Id: <200109140242.f8E2gNi07731@shumai.marcuscom.com>
Date: Thu, 13 Sep 2001 22:42:23 -0400 (EDT)
From: marcus@marcuscom.com
Reply-To: marcus@marcuscom.com
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: [MAINTAINER UPDATE] Fix malloc bug in net/netatalk
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         30566
>Category:       ports
>Synopsis:       [MAINTAINER UPDATE] Fix malloc bug in net/netatalk
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-ports
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          maintainer-update
>Submitter-Id:   current-users
>Arrival-Date:   Thu Sep 13 19:50:00 PDT 2001
>Closed-Date:    Thu Sep 13 20:13:24 PDT 2001
>Last-Modified:  Thu Sep 13 20:20:00 PDT 2001
>Originator:     Joe Marcus Clarke
>Release:        FreeBSD 4.3-RELEASE i386
>Organization:
MarcusCom, Inc.
>Environment:
System: FreeBSD shumai.marcuscom.com 4.3-RELEASE FreeBSD 4.3-RELEASE #0: Sun May 6 01:46:59 EDT 2001 root@shumai.marcuscom.com:/usr/src/sys/compile/SHUMAI i386


	
>Description:
	Netatalk contains a nasty malloc bug when no atalkd.conf file exists.
This bug casues atalkd to crash, and other apps to misbehave.  This patch
fixes those problems as well as makes bento happy with regard to the plist.
>How-To-Repeat:
	
>Fix:

diff -ruN netatalk.orig/Makefile netatalk/Makefile
--- netatalk.orig/Makefile	Thu Sep 13 02:12:18 2001
+++ netatalk/Makefile	Thu Sep 13 02:06:11 2001
@@ -2,12 +2,12 @@
 # Date created:         23 Jul 1997
 # Whom:                 stb
 #
-# $FreeBSD: ports/net/netatalk/Makefile,v 1.26 2001/09/10 12:08:07 knu Exp $
+# $FreeBSD: ports/net/netatalk/Makefile,v 1.25 2001/09/08 01:38:58 petef Exp $
 #
 
 PORTNAME=	netatalk
 PORTVERSION=	1.5p7
-PORTREVISION=	2
+PORTREVISION=	3
 CATEGORIES=	net print
 MASTER_SITES=   ${MASTER_SITE_SOURCEFORGE}
 MASTER_SITE_SUBDIR=	netatalk
@@ -59,14 +59,14 @@
 MAN4=		atalk.4
 MAN5=		AppleVolumes.default.5 afpd.conf.5 atalkd.conf.5 \
 		netatalk.conf.5 papd.conf.5
-MAN8=		afpd.8 atalkd.8 pap.8 papd.8 papstatus.8 psf.8
+MAN8=		afpd.8 atalkd.8 pap.8 papd.8 papstatus.8 psf.8 timelord.8
 
 post-extract:
 	@${SED} -e "s=%%PREFIX%%=${PREFIX}=g" ${FILESDIR}/netatalk.sh \
 		> ${WRKSRC}/netatalk.sh
 
 post-configure:
-	@${TOUCH} ${WRKSRC}/config/Makefile.in
+	@${TOUCH} -f ${WRKSRC}/config/Makefile.in
 
 post-install:
 	@${RM} -f ${PREFIX}/bin/nu ${PREFIX}/bin/lp2pap.sh \
diff -ruN netatalk.orig/files/patch-aj netatalk/files/patch-aj
--- netatalk.orig/files/patch-aj	Wed Dec 31 19:00:00 1969
+++ netatalk/files/patch-aj	Thu Sep 13 00:29:01 2001
@@ -0,0 +1,104 @@
+--- libatalk/util/getiface.c.orig	Thu Sep 13 00:28:21 2001
++++ libatalk/util/getiface.c	Thu Sep 13 00:28:30 2001
+@@ -43,13 +43,6 @@
+ {
+     /* if we've run out of room, allocate some more. just return
+      * the present list if we can't. */
+-     if (*i >= *length) {
+-      char **new = realloc(list, sizeof(char **)*(*length + IFACE_NUM));
+-       
+-      if (!new) /* just break if we can't allocate anything */
+-	return -1;
+-      *length += IFACE_NUM;
+-    }
+      
+     if ((list[*i] = strdup(name)) == NULL)
+       return -1;
+@@ -60,30 +53,32 @@
+ }
+ 
+ 
+-static int getifaces(const int sockfd, char **list, int *length)
++static int getifaces(const int sockfd, char ***list, int *length)
+ {
+ #ifdef HAVE_IFNAMEINDEX
+       struct if_nameindex *ifstart, *ifs;
+       int i = 0;
++	  char **new;
+   
+-      if (!list || *length < 1) 
+-	return 0;
+-
+       ifs = ifstart = if_nameindex();
++
++	  new = (char **) malloc((sizeof(ifs)/sizeof(struct if_nameindex) + 1) * sizeof(char *));
+       while (ifs && ifs->if_name) {
+ 	/* just bail if there's a problem */
+-	if (addname(list, &i, length, ifs->if_name) < 0)
++	if (addname(new, &i, length, ifs->if_name) < 0)
+ 	  break;
+ 	ifs++;
+       }
+ 
+       if_freenameindex(ifstart);
++	  *list = new;
+       return i;
+ 
+ #else
+     struct ifconf	ifc;
+     struct ifreq	ifrs[ 64 ], *ifr, *nextifr;
+     int			ifrsize, i = 0;
++	char **new;
+ 
+     if (!list || *length < 1)
+       return 0;
+@@ -96,6 +91,7 @@
+ 	return 0;
+     }
+ 
++	new = (char **) malloc((ifc.ifc_len/sizeof(struct ifreq) + 1) * sizeof(char *));
+     for ( ifr = ifc.ifc_req; ifc.ifc_len >= sizeof( struct ifreq );
+ 	    ifc.ifc_len -= ifrsize, ifr = nextifr ) {
+ #ifdef BSD4_4
+@@ -108,9 +104,10 @@
+ 	nextifr = (struct ifreq *)((caddr_t)ifr + ifrsize );
+ 
+ 	/* just bail if there's a problem */
+-	if (addname(list, &i, length, ifr->ifr_name) < 0)
++	if (addname(new, &i, length, ifr->ifr_name) < 0)
+ 	  break;
+     }
++	*list = new;
+     return i;
+ #endif
+ }
+@@ -122,17 +119,14 @@
+  */
+ char **getifacelist()
+ {
+-  char **list = (char **) malloc(sizeof(char **)*(IFACE_NUM + 1));
++  char **list;
+   char **new;
+-  int length = IFACE_NUM, i, fd;
++  int  length, i, fd;
+ 
+-  if (!list)
+-    return NULL;
+-      
+   if ((fd = socket(PF_INET, SOCK_STREAM, 0)) < 0)
+     return NULL;
+ 
+-  if ((i = getifaces(fd, list, &length)) == 0) {
++  if ((i = getifaces(fd, &list, &length)) == 0) {
+     free(list);
+     close(fd);
+     return NULL;
+@@ -140,7 +134,7 @@
+   close(fd);
+ 
+   if ((i < length) && 
+-      (new = (char **) realloc(list, sizeof(char **)*(i + 1))))
++      (new = (char **) realloc(list, (i + 1) *  sizeof(char *))))
+     return new;
+ 
+   return list;
diff -ruN netatalk.orig/pkg-plist netatalk/pkg-plist
--- netatalk.orig/pkg-plist	Thu Sep 13 02:12:18 2001
+++ netatalk/pkg-plist	Thu Sep 13 02:03:30 2001
@@ -142,3 +142,4 @@
 lib/libatalk.la
 share/aclocal/netatalk.m4
 share/netatalk/pagecount.ps
+@dirrm share/netatalk
>Release-Note:
>Audit-Trail:

From: "David W. Chapman Jr." <dwcjr@inethouston.net>
To: marcus@marcuscom.com
Cc: FreeBSD-gnats-submit@freebsd.org
Subject: Re: ports/30566: [MAINTAINER UPDATE] Fix malloc bug in net/netatalk
Date: Thu, 13 Sep 2001 21:59:49 -0500

 Don't forget to put in the pr if you are deleting or adding files.
 
 -- 
 David W. Chapman Jr.
 dwcjr@inethouston.net	Raintree Network Services, Inc. <www.inethouston.net>
 dwcjr@freebsd.org	FreeBSD Committer <www.FreeBSD.org>
State-Changed-From-To: open->closed 
State-Changed-By: dwcjr 
State-Changed-When: Thu Sep 13 20:04:46 PDT 2001 
State-Changed-Why:  
Committed, thanks! 

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=30566 
State-Changed-From-To: closed->open 
State-Changed-By: dwcjr 
State-Changed-When: Thu Sep 13 20:06:02 PDT 2001 
State-Changed-Why:  
Reopened, commit somehow failed on Makefile 

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=30566 
State-Changed-From-To: open->closed 
State-Changed-By: dwcjr 
State-Changed-When: Thu Sep 13 20:13:24 PDT 2001 
State-Changed-Why:  
Committed (after fixing RCSID tag in Patch) thanks! 

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=30566 

From: Joe Clarke <marcus@marcuscom.com>
To: "David W. Chapman Jr." <dwcjr@inethouston.net>
Cc: <FreeBSD-gnats-submit@freebsd.org>
Subject: Re: ports/30566: [MAINTAINER UPDATE] Fix malloc bug in net/netatalk
Date: Thu, 13 Sep 2001 23:15:25 -0400 (EDT)

 Sorry, I thought that was just for deleting.  I'll remember in the future.
 
 Anyway,
 
 *FILES ADDED
 files/patch-aj
 
 Joe
 
 On Thu, 13 Sep 2001, David W. Chapman Jr. wrote:
 
 > Don't forget to put in the pr if you are deleting or adding files.
 >
 > --
 > David W. Chapman Jr.
 > dwcjr@inethouston.net	Raintree Network Services, Inc. <www.inethouston.net>
 > dwcjr@freebsd.org	FreeBSD Committer <www.FreeBSD.org>
 >
 >
 
>Unformatted:
