Subject: pkg/22910: Build fixes for security/smtpd
To: None <gnats-bugs@gnats.NetBSD.org>
From: None <jonathan@perkin.org.uk>
List: netbsd-bugs
Date: 09/23/2003 11:24:03
>Number:         22910
>Category:       pkg
>Synopsis:       Build fixes for security/smtpd
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Sep 23 11:25:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     Jonathan Perkin
>Release:        N/A
>Organization:
British Broadcasting Corporation
>Environment:
SunOS build1 5.9 Generic_112233-01 sun4u sparc SUNW,UltraSPARC-IIi-cEngine
>Description:
A few portability build fixes for smptd.

1) Ensure correct CFLAGS for Solaris and IRIX, defaulting back to *BSD
   or Linux (previous hardcoded default).
2) Remove gcc-isms
3) Make chown user/group specifier ":" as opposed to "."
4) Solaris network libraries.
5) Pass pkgsrc LDFLAGS.

Tested on SunOS-5.9/sparc and NetBSD-1.6ZC/sparc64.  Untested on IRIX.
>How-To-Repeat:
smtpd.c:688: warning: implicit declaration of function `flock'
smtpd.c:688: `LOCK_EX' undeclared (first use in this function)
smtpd.c:688: (Each undeclared identifier is reported only once
smtpd.c:688: for each function it appears in.)

etc
>Fix:
http://www.perkin.org.uk/projects/netbsd/smtpd.diff

Index: Makefile
===================================================================
RCS file: /cvsroot/pkgsrc/security/smtpd/Makefile,v
retrieving revision 1.10
diff -u -r1.10 Makefile
--- Makefile	2003/07/17 22:53:15	1.10
+++ Makefile	2003/09/23 11:21:11
@@ -14,10 +14,21 @@
 
 SPOOL=		/var/spool/smtpd
 
+.include "../../mk/bsd.prefs.mk"
+
+.if ${OPSYS} == "SunOS"
+CFLAGS+=	-DUSE_LOCKF -DNEEDS_FCNTL_H -DNEEDS_STRINGS_H -DBROKEN_SUN_INCLUDES
+LDFLAGS+=	-lsocket -lnsl -lresolv
+.elif ${OPSYS} == "IRIX"
+CFLAGS+=	-DGETOPT_EOF -DUSE_FLOCK -DNEEDS_FCNTL_H -DNEEDS_BSTRING_H -DIRIX_BROKEN_INCLUDES
+.else # *BSD, Linux
+CFLAGS+=	-DUSE_FLOCK -DUSE_MKSTEMP
+.endif
+
 pre-install:
 		-${INSTALL_DATA_DIR} ${SPOOL}/etc
 		for f in antirelay_check_rules_example antispam_check_rules.example smtpd_check_rules.example ; do ${INSTALL_DATA} ${WRKSRC}/$$f ${SPOOL}/etc; done
-		${CHOWN} -R uucp.mail ${SPOOL}
+		${CHOWN} -R uucp:mail ${SPOOL}
 		${CHMOD} -R g=,o= ${SPOOL}
 		${CP} /etc/localtime /etc/resolv.conf ${SPOOL}/etc
 
Index: distinfo
===================================================================
RCS file: /cvsroot/pkgsrc/security/smtpd/distinfo,v
retrieving revision 1.3
diff -u -r1.3 distinfo
--- distinfo	2002/11/30 14:56:53	1.3
+++ distinfo	2003/09/23 11:21:11
@@ -4,5 +4,5 @@
 Size (smtpd-2.0.tar.gz) = 62605 bytes
 SHA1 (patch-smtpd-2.0-RBL.gz) = 180bfcca83cb5e0523cf5d983083ed83bacdde7f
 Size (patch-smtpd-2.0-RBL.gz) = 3829 bytes
-SHA1 (patch-aa) = 2600fe1a486697c5a92a35fa14724b06b02555f5
+SHA1 (patch-aa) = bc008404dac9289bf7c17a8334637eb51e1d9960
 SHA1 (patch-ab) = 717ffbe58c771967ef2ce6a1ea56003535929ccf
Index: patches/patch-aa
===================================================================
RCS file: /cvsroot/pkgsrc/security/smtpd/patches/patch-aa,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 patch-aa
--- patches/patch-aa	2000/04/21 10:57:33	1.1.1.1
+++ patches/patch-aa	2003/09/23 11:21:11
@@ -1,7 +1,7 @@
 $NetBSD: patch-aa,v 1.1.1.1 2000/04/21 10:57:33 mjl Exp $
 
---- Makefile.orig	Thu Apr 20 18:23:56 2000
-+++ Makefile	Thu Apr 20 18:29:42 2000
+--- Makefile.orig	Mon Oct 13 02:40:34 1997
++++ Makefile	Tue Sep 23 12:13:08 2003
 @@ -1,7 +1,7 @@
  ##########################################################
  ## Where do I get installed? #############################
@@ -58,3 +58,36 @@
  
  # The rules file for address checking, if enabled, remember this file
  # will be in the chroot jail, so the line below probably means
+@@ -318,7 +318,7 @@
+ 
+ ## CC of choice.
+ #CC = cc
+-CC = gcc
++#CC = gcc
+ 
+ ####################################################
+ ###### Uncomment your Operating System below #######
+@@ -325,8 +325,9 @@
+ ####################################################
+ 
+ # The Source is with you (*BSD 4.4, Linux)
+-CFLAGS = -g -O -Wall -DUSE_FLOCK -DUSE_MKSTEMP $(OPTIONS)
++#CFLAGS = -g -O -Wall -DUSE_FLOCK -DUSE_MKSTEMP $(OPTIONS)
+ 
++CFLAGS += $(OPTIONS)
+ 
+ #SunOS 5.X
+ #CFLAGS = -g -O -Wall -DUSE_LOCKF -DNEEDS_FCNTL_H -DNEEDS_STRINGS_H -DBROKEN_SUN_INCLUDES $(OPTIONS)
+@@ -347,10 +348,10 @@
+ all: smtpd smtpfwdd
+ 
+ smtpd:	smtpd.o address_check.o
+-	$(CC) -o smtpd smtpd.o address_check.o $(LD_LIBS)
++	$(CC) -o smtpd smtpd.o address_check.o $(LDFLAGS)
+ 
+ smtpfwdd:	smtpfwdd.o
+-	$(CC) -o smtpfwdd smtpfwdd.o $(LD_LIBS)
++	$(CC) -o smtpfwdd smtpfwdd.o $(LDFLAGS)
+ 
+ smtpd.o:	smtpd.c smtpd.h smtp.h 
+ 
>Release-Note:
>Audit-Trail:
>Unformatted: