From 4f96abae666b3952b6165a0e6ee84afe0d92418e Mon Sep 17 00:00:00 2001
From: Renato Botelho <garga@FreeBSD.org>
Date: Thu, 1 Jun 2006 15:33:32 +0000
Subject: - The current fwtk port will not build on FreeBSD => 5.x, this is  
 because of the S/Key library requirements.  Moved the S/Key support   behind
 the WITH_SKEY knob and added a WITH_SNK knob as well.  Now   the system will
 build on FreeBSD 6.1 systems if WITH_SKEY is NOT   set. - Change varargs.h to
 stdarg.h, to build with the newer version of gcc. - Pass the maintainership
 to submitter. - Bump PORTREVISION

PR:		ports/97633
Submitted by:	pirzyk
---
 security/fwtk/Makefile                    | 60 +++++++++++++++++++------------
 security/fwtk/distinfo                    |  6 +++-
 security/fwtk/files/patch-aa              | 18 ++++++----
 security/fwtk/files/patch-ak              | 11 ------
 security/fwtk/files/patch-al              | 46 ++++++++++++++++++++++--
 security/fwtk/files/patch-http-gw_error.c | 24 +++++++++++++
 security/fwtk/pkg-plist                   | 16 ++++-----
 7 files changed, 129 insertions(+), 52 deletions(-)
 delete mode 100644 security/fwtk/files/patch-ak
 create mode 100644 security/fwtk/files/patch-http-gw_error.c

diff --git a/security/fwtk/Makefile b/security/fwtk/Makefile
index 7b615c807336..205876a5d2a9 100644
--- a/security/fwtk/Makefile
+++ b/security/fwtk/Makefile
@@ -1,4 +1,3 @@
-# ex:ts=8
 # Ports collection makefile for:  fwtk
 # Date created:			  15th June 1996
 # Whom:				  gpalmer
@@ -8,22 +7,22 @@
 
 PORTNAME=	fwtk
 PORTVERSION=	2.1
+PORTREVISION=	1
 CATEGORIES=	security
 DISTNAME=	${PORTNAME}${PORTVERSION}
 EXTRACT_SUFX=	.tar.Z
 DISTFILES=	fwtk2.1${EXTRACT_SUFX} fwtk-doc-only${EXTRACT_SUFX}
 DIST_SUBDIR=	fwtk
 
-.if defined(WITH_JUMBO_PATCH)
-PATCHFILES=	trg-jumbo-20001114.diff
-PATCH_SITES=	http://www.fwtk.org/fwtk/patches/
-PATCH_DIST_STRIP=	-p1
-.endif
-
-MAINTAINER=	ports@FreeBSD.org
+MAINTAINER=	pirzyk@FreeBSD.org
 COMMENT=	A toolkit used for building firewalls based on proxy services
 
-RESTRICTED=	"No form of redistribution is allowed"
+RESTRICTED=	No form of redistribution is allowed
+
+OPTIONS=	X11 "Build X11 programs" On \
+		JUMBO_PATCH "Build with  the \"Jumbo\" patch kit" Off \
+		SKEY "Build this package with S/Key support" Off \
+		SNK "Buil this package with DigiPath SNK support" Off
 
 WRKSRC=		${WRKDIR}/fwtk
 HAS_CONFIGURE=	YES
@@ -32,22 +31,31 @@ CONFIGURE_SCRIPT=	fixmake
 MAN3=		auth.3
 MAN5=		netperm-table.5
 MAN8=		authmgr.8 authsrv.8 ftp-gw.8 http-gw.8 login-sh.8 netacl.8 \
-		plug-gw.8 rlogin-gw.8 smap.8 smapd.8 tn-gw.8
+		plug-gw.8 rlogin-gw.8 smap.8 smapd.8 tn-gw.8 x-gw.8
 DOCS=		sample-report.txt manpages.ps admin_guide.ps user_guide.ps \
 		overview.ps presentation.ps
 SBIN_BINS=	authdump authload authmgr
 LIBEXEC_BINS=	authsrv ftp-gw http-gw netacl plug-gw rlogin-gw smap smapd \
-		tn-gw
+		tn-gw x-gw
+
+.include <bsd.port.pre.mk>
+
+.if ${OSVERSION} >= 500000
+.if defined(WITH_SKEY)
+IGNORE=		does not build on 5.x and above with WITH_SKEY set because it requires S/Key libraries and headers
+.endif
+.endif
 
 .if !defined(WITHOUT_X11)
-LIBEXEC_BINS+=	x-gw
 MAN8+=		x-gw.8
+LIBEXEC_BINS+=	x-gw
+USE_XLIB=	yes
 .endif
 
-.include <bsd.port.pre.mk>
-
-.if ${OSVERSION} >= 500000
-IGNORE=		does not build on 5.x and above, requires S/Key libraries and headers
+.if defined(WITH_JUMBO_PATCH)
+PATCHFILES=	trg-jumbo-20001114.diff
+PATCH_SITES=	http://www.fwtk.org/fwtk/patches/
+PATCH_DIST_STRIP=	-p1
 .endif
 
 .if !exists(${DISTDIR}/${DIST_SUBDIR}/fwtk2.1${EXTRACT_SUFX}) \
@@ -55,12 +63,18 @@ IGNORE=		does not build on 5.x and above, requires S/Key libraries and headers
 IGNORE='Please read ftp://ftp.tislabs.com/pub/firewalls/toolkit/dist/README for details of how to obtain the FTWK source.  Put the files fwtk2.1${EXTRACT_SUFX} and fwtk-doc-only${EXTRACT_SUFX} into the directory ${DISTDIR}/${DIST_SUBDIR} and run make again'
 .endif
 
-pre-patch:
-.if !defined(WITH_JUMBO_PATCH)
-	@${ECHO} "*****************************************************************************"
-	@${ECHO} "****  To enable the \"Jumbo\" patch kit, run 'make -DWITH_JUMBO_PATCH'"
-	@${ECHO} "****  For information about patches, read http://www.fwtk.org/fwtk/patches/"
-	@${ECHO} "*****************************************************************************"
+post-patch:
+	@${REINPLACE_CMD} -e 's|<varargs.h>|<stdarg.h>|' \
+		${WRKSRC}/http-gw/http-gw.h
+	@${REINPLACE_CMD} -E 's|(defined\(AIX\))|\1 \&\& !defined(__FreeBSD__)|' \
+		${WRKSRC}/x-gw/sig.c
+.if defined(WITH_SKEY)
+	@${REINPLACE_CMD} -E 's|^/\* (#define	AUTHPROTO_SKEY) \*/|\1|' \
+		${WRKSRC}/auth.h
+.endif
+.if defined(WITH_SNK)
+	@${REINPLACE_CMD} -E 's|^/\* (#define	AUTHPROTO_SNK) \*/|\1|' \
+		${WRKSRC}/auth.h
 .endif
 
 pre-configure:
@@ -74,7 +88,7 @@ pre-configure:
 		${WRKSRC}/firewall.h.in > ${WRKSRC}/firewall.h
 
 post-install:
-	cd ${PREFIX}/libexec ; strip ${SBIN_BINS} ${LIBEXEC_BINS}
+	cd ${PREFIX}/libexec ; ${STRIP_CMD} ${SBIN_BINS} ${LIBEXEC_BINS}
 	cd ${PREFIX}/libexec ; ${MV} ${SBIN_BINS} mqueue ../sbin
 	${INSTALL_DATA} ${WRKSRC}/config/netperm-table \
 		${PREFIX}/etc/netperm-table.sample
diff --git a/security/fwtk/distinfo b/security/fwtk/distinfo
index 529fe3f6d0d1..051bf4119b53 100644
--- a/security/fwtk/distinfo
+++ b/security/fwtk/distinfo
@@ -1,5 +1,9 @@
 MD5 (fwtk/fwtk2.1.tar.Z) = 936bf217fc271c54ef4b5ffca1e642db
+SHA256 (fwtk/fwtk2.1.tar.Z) = 776fe265b89cb0df2f39c0edb93b1b84dc5af8300d599150dbf517f5f8f224be
 SIZE (fwtk/fwtk2.1.tar.Z) = 481055
 MD5 (fwtk/fwtk-doc-only.tar.Z) = 74ab67a3d224ba7ce0cfc2a39cb038cf
+SHA256 (fwtk/fwtk-doc-only.tar.Z) = cf95d9f650bc6b88d5cac9bd38a809d1e30faa372d0585b3a63773cfe7f2066a
 SIZE (fwtk/fwtk-doc-only.tar.Z) = 423991
-MD5 (trg-jumbo-20001114.diff) = 32d8139ffc8826f451c4df80c5640d5a
+MD5 (fwtk/trg-jumbo-20001114.diff) = 32d8139ffc8826f451c4df80c5640d5a
+SHA256 (fwtk/trg-jumbo-20001114.diff) = 8270366706260bf9bbb0f679746dd5fc804a23cdb9929615be0f4cd3863c8e9d
+SIZE (fwtk/trg-jumbo-20001114.diff) = 5678
diff --git a/security/fwtk/files/patch-aa b/security/fwtk/files/patch-aa
index 912068e8421f..a4d04246abde 100644
--- a/security/fwtk/files/patch-aa
+++ b/security/fwtk/files/patch-aa
@@ -1,11 +1,13 @@
---- Makefile.config.orig	Tue Mar  4 20:17:46 1997
-+++ Makefile.config	Sat Apr 18 00:51:14 1998
-@@ -24,13 +24,13 @@
+--- Makefile.config.orig	Tue Mar  4 22:17:46 1997
++++ Makefile.config	Sun May 21 18:01:05 2006
+@@ -24,13 +24,15 @@
  
  # Defines for your operating system
  #
 -DEFINES=
++.if defined(WITH_SKEY)
 +DEFINES= -D_SKEY_INTERNAL
++.endif
  #DEFINES=-DSYSV -DSOLARIS
  
  # Options for your compiler (eg, "-g" for debugging, "-O" for
@@ -16,7 +18,7 @@
  #COPT=	-O $(DEFINES)
  
  # Version of "make" you want to use
-@@ -44,16 +44,16 @@
+@@ -44,16 +46,20 @@
  
  
  # Destination directory for installation of binaries
@@ -32,11 +34,15 @@
  # Names of any auxiliary libraries your system may require (e.g., -lsocket)
  # If you want to link against a resolver library, specify it here.
 -AUXLIB=
++.if defined(WITH_SKEY)
 +AUXLIB= -lcrypt -lskey -lmd
++.else
++AUXLIB= -lcrypt -lmd
++.endif
  #AUXLIB= -lsocket
  #AUXLIB= -lresolv
  # For Solaris:
-@@ -72,23 +72,23 @@
+@@ -72,23 +78,23 @@
  # or -Bstatic for static binaries under SunOS 4.1.x)
  #LDFL=	-Bstatic
  #LDFL=
@@ -64,7 +70,7 @@
  #XLIBS =  -L$(XLIBDIR) -lXaw -lXmu -lXt -lXext -lX11
  # for Linux:
  #XLIBS =  -L$(XLIBDIR) -lXaw -lXmu -lXt -lXext -lX11 -lc
-@@ -98,8 +98,8 @@
+@@ -98,8 +104,8 @@
  #XLIBS = -L$(XLIBDIR) -lXaw -lXmu -lXt -lXext -lX11
  
  # Location of X include files
diff --git a/security/fwtk/files/patch-ak b/security/fwtk/files/patch-ak
deleted file mode 100644
index 5b3e40ef4f45..000000000000
--- a/security/fwtk/files/patch-ak
+++ /dev/null
@@ -1,11 +0,0 @@
---- auth.h.orig	Fri Nov  4 15:31:26 1994
-+++ auth.h	Sat Apr 18 00:37:48 1998
-@@ -69,7 +69,7 @@
- #define	AUTHPROTO_PASSWORD
- 
- /* define this if you want to use bellcore's S/Key */
--/* #define	AUTHPROTO_SKEY */
-+#define	AUTHPROTO_SKEY
- 
- /* define this if you want to use Security Dynamics' SecurID */
- /* #define	AUTHPROTO_SECURID */
diff --git a/security/fwtk/files/patch-al b/security/fwtk/files/patch-al
index a441370d79ea..62bde4e877ea 100644
--- a/security/fwtk/files/patch-al
+++ b/security/fwtk/files/patch-al
@@ -1,11 +1,51 @@
---- auth/Makefile.orig	Fri Apr  5 09:49:21 1996
-+++ auth/Makefile	Sat Apr 18 00:38:57 1998
-@@ -20,7 +20,7 @@
+--- auth/Makefile.orig	Fri Apr  5 11:49:21 1996
++++ auth/Makefile	Sun May 21 22:42:13 2006
+@@ -12,7 +12,7 @@
+ # RcsId: "$Header: /usr/home/rick/fwtk2.0/fwtk/auth/RCS/Makefile,v 1.1 1996/03/27 03:29:55 rick Exp rick $"
+ 
+ 
+-include	../Makefile.config
++.include "../Makefile.config"
+ 
+ 
+ #if you are using the SKEY modules, define SKEYDIR to be the source
+@@ -20,7 +20,9 @@
  #SKEYDIR=../../skey
  #SKEYINC= -I$(SKEYDIR)
  #SKEYLIB= $(SKEYDIR)/libskey.a
 -#SKEYOBJ= skey.o
++.if defined(WITH_SKEY)
 +SKEYOBJ= skey.o
++.endif
  
  
  #if you are using the SecurID module, define SECURDIR to be the source
+@@ -41,20 +43,24 @@
+ 
+ #if you are using the Digital Pathways SNK module, include this:
+ #this also requires DES routines below
+-#SNKOBJ=	snk.o
++.if defined(WITH_SNK)
++SNKOBJ=	snk.o
++.endif
+ 
+ 
+ #if you are using link-level encryption code, this should be the path
+ #to a library that contains DES routines (NOT SUPPLIED!)
+ #you will need to replace srvio.c and cliio.c
+-#DESLIB=	../../libdes/libdes.a
+-#DESINC=	-I../../libdes
++.if defined(WITH_SNK)
++DESLIB=	-lcrypto
++DESINC=	-I/usr/include/openssl
++.endif
+ 
+ 
+ #security protocol modules
+ MODULES= $(SKEYLIB) $(SECURLIB) $(DESLIB)
+ 
+-CFLAGS= -I.. $(COPT)
++CFLAGS+= -I.. $(COPT)
+ LIB=	../libauth.a
+ FWLIB=	../libfwall.a
+ 
diff --git a/security/fwtk/files/patch-http-gw_error.c b/security/fwtk/files/patch-http-gw_error.c
new file mode 100644
index 000000000000..8aefffd65421
--- /dev/null
+++ b/security/fwtk/files/patch-http-gw_error.c
@@ -0,0 +1,24 @@
+--- http-gw/error.c.orig	Tue Jan 13 20:21:28 1998
++++ http-gw/error.c	Sun May 21 22:09:19 2006
+@@ -174,11 +174,7 @@
+ 	return 0;
+ }
+ 
+-int go_error(sockfd, errorno, msg, va_alist)
+-int sockfd;
+-int errorno;
+-char *msg;
+-va_dcl
++int go_error(int sockfd, int errorno, char *msg, ...)
+ {	static int last_errno = 0;
+ 	va_list marker;
+ 
+@@ -192,7 +188,7 @@
+ 		}
+ 	}
+ 	if( msg != NULL){
+-		va_start(marker);
++		va_start(marker, msg);
+ 		vsprintf(errbuf, msg, marker);
+ 		va_end(marker);
+ 		if( (rem_type & (TYPE_HTTP|TYPE_DIR)) == (TYPE_DIR)){
diff --git a/security/fwtk/pkg-plist b/security/fwtk/pkg-plist
index 065cf81788d3..3c73fc9fbe12 100644
--- a/security/fwtk/pkg-plist
+++ b/security/fwtk/pkg-plist
@@ -14,11 +14,11 @@ sbin/authdump
 sbin/authload
 sbin/authmgr
 sbin/mqueue
-%%PORTDOCS%%share/doc/fwtk/LICENSE
-%%PORTDOCS%%share/doc/fwtk/admin_guide.ps
-%%PORTDOCS%%share/doc/fwtk/manpages.ps
-%%PORTDOCS%%share/doc/fwtk/overview.ps
-%%PORTDOCS%%share/doc/fwtk/presentation.ps
-%%PORTDOCS%%share/doc/fwtk/sample-report.txt
-%%PORTDOCS%%share/doc/fwtk/user_guide.ps
-%%PORTDOCS%%@dirrm share/doc/fwtk
+%%PORTDOCS%%%%DOCSDIR%%/LICENSE
+%%PORTDOCS%%%%DOCSDIR%%/admin_guide.ps
+%%PORTDOCS%%%%DOCSDIR%%/manpages.ps
+%%PORTDOCS%%%%DOCSDIR%%/overview.ps
+%%PORTDOCS%%%%DOCSDIR%%/presentation.ps
+%%PORTDOCS%%%%DOCSDIR%%/sample-report.txt
+%%PORTDOCS%%%%DOCSDIR%%/user_guide.ps
+%%PORTDOCS%%@dirrm %%DOCSDIR%%
-- 
cgit debian/1.2.3+git2.25.1-1-2-gaceb0