Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 19 Sep 2014 21:33:27 +0000 (UTC)
From:      Guido Falsi <madpilot@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r368602 - in head/www/squidguard: . files
Message-ID:  <201409192133.s8JLXRkL055815@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: madpilot
Date: Fri Sep 19 21:33:26 2014
New Revision: 368602
URL: http://svnweb.freebsd.org/changeset/ports/368602
QAT: https://qat.redports.org/buildarchive/r368602/

Log:
  - Import patch from upstream to allow squidguard to work correctly
    with squid 3.4 [1]
  - Put back the option to choose on which squid version to depend,
    which also controls if the above patch is applied, to allow using
    squid33 until it expires
  - While here, take advantage of option helpers to simplify Makefile
    a little
  - Canonicalize patch filenames
  
  PR:		193771 [1]
  Submitted by:	adrik@salesmanager.nl

Added:
  head/www/squidguard/files/extrapatch-squid34   (contents, props changed)
  head/www/squidguard/files/patch-samples__sample.conf.in
     - copied unchanged from r368601, head/www/squidguard/files/patch-sample_sample.conf.in
  head/www/squidguard/files/patch-src__main.c
     - copied unchanged from r368542, head/www/squidguard/files/patch-src_main.c
  head/www/squidguard/files/patch-src__sgDb.c
     - copied unchanged from r368542, head/www/squidguard/files/patch-src_sgDB.c
Deleted:
  head/www/squidguard/files/patch-sample_sample.conf.in
  head/www/squidguard/files/patch-src_main.c
  head/www/squidguard/files/patch-src_sgDB.c
Modified:
  head/www/squidguard/Makefile

Modified: head/www/squidguard/Makefile
==============================================================================
--- head/www/squidguard/Makefile	Fri Sep 19 21:29:40 2014	(r368601)
+++ head/www/squidguard/Makefile	Fri Sep 19 21:33:26 2014	(r368602)
@@ -2,7 +2,7 @@
 
 PORTNAME=	squidGuard
 PORTVERSION=	1.4
-PORTREVISION=	14
+PORTREVISION=	15
 CATEGORIES=	www
 MASTER_SITES=	http://www.squidguard.org/Downloads/:a \
 		http://www.squidguard.org/Downloads/Contrib/:b
@@ -17,8 +17,6 @@ COMMENT=	Fast redirector for squid
 LICENSE=	GPLv2
 LICENSE_FILE=	${WRKSRC}/COPYING
 
-RUN_DEPENDS=	${LOCALBASE}/sbin/squid:${PORTSDIR}/www/squid
-
 USE_BDB=	yes
 GNU_CONFIGURE=	yes
 CONFIGURE_ARGS=	--with-db-inc=${BDB_INCLUDE_DIR} \
@@ -44,12 +42,22 @@ SUB_FILES=	pkg-deinstall pkg-message
 SUB_LIST=	PORTNAME=${PORTNAME}
 
 OPTIONS_DEFINE=		DNS_BL DOCS EXAMPLES LDAP QUOTE_STRING
+OPTIONS_SINGLE=		SV
+OPTIONS_SINGLE_SV=	SQUID34 SQUID33
+OPTIONS_DEFAULT=	SQUID34
 
 EXAMPLES_DESC=	Install sample blacklists
 DNS_BL_DESC=	Enable DNS based blacklists
 QUOTE_STRING_DESC=	Add quoted string patch
+SQUID33_DESC=   Depend on Squid 3.3 (DEPERCATED)
+SQUID34_DESC=   Depend on Squid 3.4
 
 OPTIONS_SUB=		yes
+SQUID33_RUN_DEPENDS=	${LOCALBASE}/sbin/squid:${PORTSDIR}/www/squid33
+SQUID34_RUN_DEPENDS=	${LOCALBASE}/sbin/squid:${PORTSDIR}/www/squid
+SQUID34_EXTRA_PATCHES=	${FILESDIR}/extrapatch-squid34:-p1
+QUOTE_STRING_EXTRA_PATCHES=	${DISTDIR}/squidGuard-1.4-quoted_string_support.diff:-p2
+DNS_BL_EXTRA_PATCHES=	${DISTDIR}/squidGuard-1.4-dnsbl.patch:-p1
 LDAP_CONFIGURE_ON=	--with-ldap
 LDAP_CONFIGURE_OFF=	--without-ldap
 LDAP_LDFLAGS=		-L${LOCALBASE}/lib
@@ -71,12 +79,6 @@ post-patch:
 		${REINPLACE_CMD} -E -e 's,(db_version),\1_4002,g' \
 			${WRKSRC}/configure ; \
 	fi
-.if ${PORT_OPTIONS:MQUOTE_STRING}
-	${PATCH} -d ${WRKSRC} --forward --quiet -p2 <${DISTDIR}/squidGuard-1.4-quoted_string_support.diff
-.endif
-.if ${PORT_OPTIONS:MDNS_BL}
-	${PATCH} -d ${WRKSRC} --forward --quiet -p1 <${DISTDIR}/squidGuard-1.4-dnsbl.patch
-.endif
 
 post-build:
 .if ${PORT_OPTIONS:MEXAMPLES}

Added: head/www/squidguard/files/extrapatch-squid34
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/www/squidguard/files/extrapatch-squid34	Fri Sep 19 21:33:26 2014	(r368602)
@@ -0,0 +1,76 @@
+diff -urN squidGuard-1.4.orig/src/main.c squidGuard-1.4.upgraded/src/main.c
+--- squidGuard-1.4.orig/src/main.c	2013-12-11 17:42:15.000000000 +1300
++++ squidGuard-1.4.upgraded/src/main.c	2013-12-11 19:04:09.000000000 +1300
+@@ -175,7 +175,7 @@
+ 	sgReloadConfig();
+       }
+       if(failsafe_mode) {
+-	puts("");
++	puts("ERR message=\"squidGuard failsafe mode\"");
+ 	fflush(stdout);
+ 	if(sig_hup){
+           sgReloadConfig();
+@@ -184,7 +184,7 @@
+       }
+       if(parseLine(buf,&squidInfo) != 1){
+ 	sgLogError("Error parsing squid line: %s",buf);
+-	puts("");
++	puts("BH message=\"squidGuard error parsing squid line\"");
+       }
+         else {
+ 	src = Source;
+@@ -196,14 +196,14 @@
+ 	  acl = sgAclCheckSource(src);
+ 	  if((redirect = sgAclAccess(src,acl,&squidInfo)) == NULL){
+ 	    if(src == NULL || src->cont_search == 0){
+-	      puts(""); 
++	      puts("ERR");
+ 	      break;
+ 	    } else
+ 	      if(src->next != NULL){
+ 		src = src->next;
+ 		continue;
+ 	      } else {
+-		puts("");
++		puts("ERR");
+ 		break;
+ 	      }
+ 	  } else {
+@@ -215,9 +215,10 @@
+ 	      squidInfo.ident[0] = '-';
+ 	      squidInfo.ident[1] = '\0';
+ 	    }
+-	    fprintf(stdout,"%s %s/%s %s %s\n",redirect,squidInfo.src,
+-		    squidInfo.srcDomain,squidInfo.ident,
+-		    squidInfo.method);
++	    if (isdigit(redirect[0]) && isdigit(redirect[1]) && isdigit(redirect[2]) && redirect[3]==':') {
++	      fprintf(stdout,"OK status=%c%c%c url=\"%s\"\n", redirect[0], redirect[1], redirect[2], &redirect[4]);
++	    } else
++	      fprintf(stdout,"OK rewrite-url=\"%s\"\n",redirect);
+             /* sgLogError("%s %s/%s %s %s\n",redirect,squidInfo.src,squidInfo.srcDomain,squidInfo.ident,squidInfo.method);  */
+ 	    break;
+ 	  }
+diff -urN squidGuard-1.4.orig/src/sgDiv.c squidGuard-1.4.upgraded/src/sgDiv.c
+--- squidGuard-1.4.orig/src/sgDiv.c	2013-12-11 17:42:15.000000000 +1300
++++ squidGuard-1.4.upgraded/src/sgDiv.c	2013-12-11 18:58:33.000000000 +1300
+@@ -771,7 +771,7 @@
+   }
+   sgLogError("Going into emergency mode");
+   while(fgets(buf, MAX_BUF, stdin) != NULL){
+-    puts("");
++    puts("ERR");
+     fflush(stdout);
+   }
+   sgLogError("ending emergency mode, stdin empty");
+diff -urN squidGuard-1.4.orig/src/sgDiv.c.in squidGuard-1.4.upgraded/src/sgDiv.c.in
+--- squidGuard-1.4.orig/src/sgDiv.c.in	2013-12-11 17:42:15.000000000 +1300
++++ squidGuard-1.4.upgraded/src/sgDiv.c.in	2013-12-11 18:58:40.000000000 +1300
+@@ -782,7 +782,7 @@
+   }
+   sgLogError("Going into emergency mode");
+   while(fgets(buf, MAX_BUF, stdin) != NULL){
+-    puts("");
++    puts("ERR");
+     fflush(stdout);
+   }
+   sgLogError("ending emergency mode, stdin empty");

Copied: head/www/squidguard/files/patch-samples__sample.conf.in (from r368601, head/www/squidguard/files/patch-sample_sample.conf.in)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/www/squidguard/files/patch-samples__sample.conf.in	Fri Sep 19 21:33:26 2014	(r368602, copy of r368601, head/www/squidguard/files/patch-sample_sample.conf.in)
@@ -0,0 +1,15 @@
+--- samples/sample.conf.in.orig	2007-11-16 17:58:32.000000000 +0100
++++ samples/sample.conf.in	2013-10-05 15:30:39.997329900 +0200
+@@ -53,9 +53,9 @@
+ }
+ 
+ dest adult {
+-	domainlist	dest/adult/domains
+-	urllist		dest/adult/urls
+-	expressionlist	dest/adult/expressions
++	domainlist	porn/domains
++	urllist		porn/urls
++	expressionlist	porn/expressions
+ 	redirect 	http://admin.foo.bar.de/cgi/blocked?clientaddr=%a+clientname=%n+clientuser=%i+clientgroup=%s+targetgroup=%t+url=%u
+ }
+ 

Copied: head/www/squidguard/files/patch-src__main.c (from r368542, head/www/squidguard/files/patch-src_main.c)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/www/squidguard/files/patch-src__main.c	Fri Sep 19 21:33:26 2014	(r368602, copy of r368542, head/www/squidguard/files/patch-src_main.c)
@@ -0,0 +1,14 @@
+--- src/main.c.orig	Thu Jun 14 01:56:54 2001
++++ src/main.c	Sun Jan  1 17:04:13 2006
+@@ -108,7 +108,11 @@
+       globalUpdate = 1;
+       break;
+     case 'v':
++#if DB_VERSION_MAJOR * 10 + DB_VERSION_MINOR == 42
++      fprintf(stderr, "SquidGuard: %s %s\n", VERSION,db_version_4002(NULL,NULL,NULL));
++#else
+       fprintf(stderr, "SquidGuard: %s %s\n", VERSION,db_version(NULL,NULL,NULL));
++#endif
+       exit(0);
+       break;
+     case 't':

Copied: head/www/squidguard/files/patch-src__sgDb.c (from r368542, head/www/squidguard/files/patch-src_sgDB.c)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/www/squidguard/files/patch-src__sgDb.c	Fri Sep 19 21:33:26 2014	(r368602, copy of r368542, head/www/squidguard/files/patch-src_sgDB.c)
@@ -0,0 +1,46 @@
+--- src/sgDb.c.orig	2008-07-14 20:29:41.000000000 +0200
++++ src/sgDb.c	2014-01-14 11:53:55.712138134 +0100
+@@ -119,14 +119,39 @@
+     flag = DB_CREATE;
+     if(createdb)
+       flag = flag | DB_TRUNCATE;
+-    if ((ret =
+-         Db->dbp->open(Db->dbp, NULL, dbfile, NULL, DB_BTREE, flag, 0664)) != 0) {
++    if ((ret = Db->dbp->open(Db->dbp,
++#if DB_VERSION_MINOR >= 1
++	NULL,
++#endif
++	dbfile, NULL, DB_BTREE, flag, 0664)) != 0) {
++      (void) Db->dbp->close(Db->dbp, 0);
++      sgLogFatalError("Error db_open: %s", strerror(ret));
++    }
++  } else {
++    if ((ret = Db->dbp->open(Db->dbp,
++#if DB_VERSION_MINOR >= 1
++	NULL,
++#endif
++	dbfile, NULL, DB_BTREE, DB_CREATE, 0664)) != 0) {
++      sgLogFatalError("Error db_open: %s", strerror(ret));
++    }
++  }
++#endif
++#if DB_VERSION_MAJOR >= 5
++  if(globalUpdate || createdb || (dbfile != NULL && stat(dbfile,&st))){
++    flag = DB_CREATE;
++    if(createdb)
++      flag = flag | DB_TRUNCATE;
++    if ((ret = Db->dbp->open(Db->dbp,
++	NULL,
++	dbfile, NULL, DB_BTREE, flag, 0664)) != 0) {
+       (void) Db->dbp->close(Db->dbp, 0);
+       sgLogFatalError("Error db_open: %s", strerror(ret));
+     }
+   } else {
+-    if ((ret =
+-         Db->dbp->open(Db->dbp, NULL, dbfile, NULL, DB_BTREE, DB_CREATE, 0664)) != 0) {
++    if ((ret = Db->dbp->open(Db->dbp,
++	NULL,
++	dbfile, NULL, DB_BTREE, DB_CREATE, 0664)) != 0) {
+       sgLogFatalError("Error db_open: %s", strerror(ret));
+     }
+   }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201409192133.s8JLXRkL055815>