aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeonardo Arena <rnalrd@gmail.com>2010-07-13 08:35:30 +0000
committerLeonardo Arena <rnalrd@gmail.com>2010-07-13 08:37:40 +0000
commit05f7b76a0d044693460872278223eb03746b20ea (patch)
tree00e19f9a020f3a42d175fc5519e422778dc5ed41
parent573e22ed61e696c7beb121d3c95d829f4f623596 (diff)
downloadaports-05f7b76a0d044693460872278223eb03746b20ea.tar.bz2
aports-05f7b76a0d044693460872278223eb03746b20ea.tar.xz
testing/squidguard: new aport
-rw-r--r--testing/squidguard/APKBUILD46
-rw-r--r--testing/squidguard/blockedsites1
-rw-r--r--testing/squidguard/squidGuard.conf.blocksites13
-rw-r--r--testing/squidguard/squidGuard.conf.minimal7
-rw-r--r--testing/squidguard/squidguard-1.4-gentoo.patch74
-rw-r--r--testing/squidguard/squidguard-1.4-upstream-fixes.patch24
-rw-r--r--testing/squidguard/squidguard-1.4-vsnprintf.patch44
-rw-r--r--testing/squidguard/squidguard.post-install3
8 files changed, 212 insertions, 0 deletions
diff --git a/testing/squidguard/APKBUILD b/testing/squidguard/APKBUILD
new file mode 100644
index 0000000000..522386ea2e
--- /dev/null
+++ b/testing/squidguard/APKBUILD
@@ -0,0 +1,46 @@
+# Maintainer: Leonardo Arena <rnalrd@gmail.com>
+pkgname=squidguard
+_realname=squidGuard
+pkgver=1.4
+pkgrel=0
+pkgdesc="Squid URL redirector"
+url="http://www.squidguard.org"
+license="GPL"
+depends=
+makedepends="flex bison db-dev"
+install="$pkgname.post-install"
+subpackages=""
+source="http://www.squidguard.org/Downloads/$_realname-$pkgver.tar.gz
+ squidguard-1.4-gentoo.patch
+ squidguard-1.4-upstream-fixes.patch
+ squidguard-1.4-vsnprintf.patch"
+
+_builddir="$srcdir"/$_realname-$pkgver
+
+prepare() {
+ cd "$_builddir"
+ patch -p1 < ../../squidguard-1.4-gentoo.patch
+ patch -p1 < ../../squidguard-1.4-upstream-fixes.patch
+ patch -p1 < ../../squidguard-1.4-vsnprintf.patch
+}
+
+build() {
+ cd "$_builddir"
+ ./configure --prefix=/usr \
+ --sysconfdir=/etc \
+ --with-sg-config=/etc/squidGuard/squidGuard.conf \
+ --with-sg-logdir=/var/log/squidGuard
+ make || return 1
+}
+
+package() {
+ cd "$_builddir"
+ make INSTDIR="$pkgdir" install
+ install -D -m644 ../../squidGuard.conf.blocksites $pkgdir/etc/squidGuard/squidGuard.conf
+ install -D -m644 ../../blockedsites $pkgdir/etc/squidGuard/blockedsites
+}
+
+md5sums="de834150998c1386c30feae196f16b06 squidGuard-1.4.tar.gz
+ba58e934fe2f75fcb5dfbe054e045449 squidguard-1.4-gentoo.patch
+4b512e930dede70ddf36d4f7c75a598f squidguard-1.4-upstream-fixes.patch
+8878c72f27e45dab99e5d0197d50caec squidguard-1.4-vsnprintf.patch"
diff --git a/testing/squidguard/blockedsites b/testing/squidguard/blockedsites
new file mode 100644
index 0000000000..46279a47ee
--- /dev/null
+++ b/testing/squidguard/blockedsites
@@ -0,0 +1 @@
+sex.com
diff --git a/testing/squidguard/squidGuard.conf.blocksites b/testing/squidguard/squidGuard.conf.blocksites
new file mode 100644
index 0000000000..eaa8cdeef0
--- /dev/null
+++ b/testing/squidguard/squidGuard.conf.blocksites
@@ -0,0 +1,13 @@
+logdir /var/log/squidGuard
+dbhome /etc/squidGuard/db
+
+dest blockedsites {
+ domainlist blockedsites
+}
+
+acl {
+ default {
+ pass !blockedsites all
+ redirect http://www.sample.com/empty.png
+ }
+}
diff --git a/testing/squidguard/squidGuard.conf.minimal b/testing/squidguard/squidGuard.conf.minimal
new file mode 100644
index 0000000000..3b0ebf55c7
--- /dev/null
+++ b/testing/squidguard/squidGuard.conf.minimal
@@ -0,0 +1,7 @@
+logdir /var/log/squidGuard
+
+acl {
+ default {
+ pass all
+ }
+}
diff --git a/testing/squidguard/squidguard-1.4-gentoo.patch b/testing/squidguard/squidguard-1.4-gentoo.patch
new file mode 100644
index 0000000000..60b5461e9e
--- /dev/null
+++ b/testing/squidguard/squidguard-1.4-gentoo.patch
@@ -0,0 +1,74 @@
+diff -Nru squidGuard-1.4.orig/Makefile.in squidGuard-1.4/Makefile.in
+--- squidGuard-1.4.orig/Makefile.in 2008-05-17 18:36:44.000000000 +0000
++++ squidGuard-1.4/Makefile.in 2009-01-10 13:02:14.000000000 +0000
+@@ -43,7 +43,7 @@
+ # Dependencies for installing
+ #
+
+-install: install-build install-conf
++install: install-build
+
+ install-conf:
+ @echo Installing configuration file ;
+@@ -85,10 +85,10 @@
+
+ install-build:
+ @echo Installing squidGuard
+- @if [ ! -d $(bindir) ]; then \
+- $(MKINSTALLDIRS) $(bindir) ; \
++ @if [ ! -d "$(INSTDIR)"/$(bindir) ]; then \
++ $(MKINSTALLDIRS) "$(INSTDIR)"/$(bindir) ; \
+ fi ; \
+- cp src/squidGuard $(bindir) || exit 1 ; \
++ cp src/squidGuard "$(INSTDIR)"/$(bindir) || exit 1 ; \
+ echo Done. ;
+
+ clean::
+diff -Nru squidGuard-1.4.orig/src/Makefile.in squidGuard-1.4/src/Makefile.in
+--- squidGuard-1.4.orig/src/Makefile.in 2009-01-03 20:05:39.000000000 +0000
++++ squidGuard-1.4/src/Makefile.in 2009-01-10 13:02:14.000000000 +0000
+@@ -110,6 +110,8 @@
+ mv -f y.tab.c y.tab.c.bison
+ mv -f y.tab.h y.tab.h.bison
+
++sg.y sg.l:
++
+ #
+ # Dependencies for installing
+ #
+@@ -122,8 +124,8 @@
+
+ install.bin:: squidGuard
+ @echo making $@ in `basename \`pwd\``
+- @$(MKDIR) $(bindir) $(logdir) $(cfgdir)
+- $(INSTALL_PROGRAM) squidGuard $(bindir)/squidGuard
++ @$(MKDIR) "$(INSTDIR)"/$(bindir) "$(INSTDIR)"/$(logdir) "$(INSTDIR)"/$(cfgdir)
++ $(INSTALL_PROGRAM) squidGuard "$(INSTDIR)"/$(bindir)/squidGuard
+
+ uninstall.bin::
+ @echo making $@ in `basename \`pwd\``
+diff -Nru squidGuard-1.4.orig/src/sgDb.c squidGuard-1.4/src/sgDb.c
+--- squidGuard-1.4.orig/src/sgDb.c 2008-07-14 18:29:41.000000000 +0000
++++ squidGuard-1.4/src/sgDb.c 2009-01-10 13:02:14.000000000 +0000
+@@ -103,13 +103,21 @@
+ if(createdb)
+ flag = flag | DB_TRUNCATE;
+ if ((ret =
++#if DB_VERSION_MAJOR > 4 || (DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR >= 1)
++ Db->dbp->open(Db->dbp, NULL, dbfile, NULL, DB_BTREE, flag, 0664)) != 0) {
++#else
+ Db->dbp->open(Db->dbp, dbfile, NULL, DB_BTREE, flag, 0664)) != 0) {
++#endif
+ (void) Db->dbp->close(Db->dbp, 0);
+ sgLogFatalError("Error db_open: %s", strerror(ret));
+ }
+ } else {
+ if ((ret =
++#if DB_VERSION_MAJOR > 4 || (DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR >= 1)
++ Db->dbp->open(Db->dbp, NULL, dbfile, NULL, DB_BTREE, DB_CREATE, 0664)) != 0) {
++#else
+ Db->dbp->open(Db->dbp, dbfile, NULL, DB_BTREE, DB_CREATE, 0664)) != 0) {
++#endif
+ sgLogFatalError("Error db_open: %s", strerror(ret));
+ }
+ }
diff --git a/testing/squidguard/squidguard-1.4-upstream-fixes.patch b/testing/squidguard/squidguard-1.4-upstream-fixes.patch
new file mode 100644
index 0000000000..007e6b4c36
--- /dev/null
+++ b/testing/squidguard/squidguard-1.4-upstream-fixes.patch
@@ -0,0 +1,24 @@
+diff -Nru squidGuard-1.4.orig/src/sgDiv.c.in squidGuard-1.4/src/sgDiv.c.in
+--- squidGuard-1.4.orig/src/sgDiv.c.in 2008-07-14 18:02:43.000000000 +0200
++++ squidGuard-1.4/src/sgDiv.c.in 2009-11-28 09:33:05.000000000 +0100
+@@ -745,7 +745,7 @@
+ p++;
+ break;
+ case 'u': /* Requested URL */
+- strcat(buf, req->orig);
++ strncat(buf, req->orig, 2048);
+ p++;
+ break;
+ default:
+diff -Nru squidGuard-1.4.orig/src/sg.h.in squidGuard-1.4/src/sg.h.in
+--- squidGuard-1.4.orig/src/sg.h.in 2007-11-16 17:58:32.000000000 +0100
++++ squidGuard-1.4/src/sg.h.in 2009-11-28 09:33:37.000000000 +0100
+@@ -73,7 +73,7 @@
+ #define REQUEST_TYPE_REDIRECT 2
+ #define REQUEST_TYPE_PASS 3
+
+-#define MAX_BUF 4096
++#define MAX_BUF 12288
+
+ #define DEFAULT_LOGFILE "squidGuard.log"
+ #define WARNING_LOGFILE "squidGuard.log"
diff --git a/testing/squidguard/squidguard-1.4-vsnprintf.patch b/testing/squidguard/squidguard-1.4-vsnprintf.patch
new file mode 100644
index 0000000000..bf4efec604
--- /dev/null
+++ b/testing/squidguard/squidguard-1.4-vsnprintf.patch
@@ -0,0 +1,44 @@
+diff -Nru squidGuard-1.4.orig/configure.in squidGuard-1.4/configure.in
+--- squidGuard-1.4.orig/configure.in 2009-04-26 12:28:49.000000000 +0000
++++ squidGuard-1.4/configure.in 2009-04-26 12:29:35.000000000 +0000
+@@ -421,7 +421,7 @@
+ AC_CHECK_FUNCS(regexec, , AC_MSG_ERROR([No regexec library function.]))
+ AC_CHECK_FUNCS(strdup, , AC_MSG_ERROR([No strdup library function.]))
+ AC_CHECK_FUNCS(strerror, , AC_MSG_ERROR([No strerror library function.]))
+-AC_CHECK_FUNCS(vsprintf, , AC_MSG_ERROR([No vsprintf library function.]))
++AC_CHECK_FUNCS(vsnprintf, , AC_MSG_ERROR([No vsnprintf library function.]))
+ AC_CHECK_FUNCS(sigaction)
+ AC_CHECK_FUNCS(signal)
+
+diff -Nru squidGuard-1.4.orig/src/sgLog.c squidGuard-1.4/src/sgLog.c
+--- squidGuard-1.4.orig/src/sgLog.c 2007-11-16 16:58:32.000000000 +0000
++++ squidGuard-1.4/src/sgLog.c 2009-04-26 12:31:40.000000000 +0000
+@@ -55,7 +55,7 @@
+ char msg[MAX_BUF];
+ va_list ap;
+ VA_START(ap, format);
+- if(vsprintf(msg, format, ap) > (MAX_BUF - 1))
++ if(vsnprintf(msg, MAX_BUF, format, ap) > (MAX_BUF - 1))
+ fprintf(stderr,"overflow in vsprintf (sgLog): %s",strerror(errno));
+ va_end(ap);
+ date = niso(0);
+@@ -87,8 +87,8 @@
+ char msg[MAX_BUF];
+ va_list ap;
+ VA_START(ap, format);
+- if(vsprintf(msg, format, ap) > (MAX_BUF - 1))
+- sgLogFatalError("overflow in vsprintf (sgLogError): %s",strerror(errno));
++ if(vsnprintf(msg, MAX_BUF, format, ap) > (MAX_BUF - 1))
++ fprintf(stderr,"overflow in vsprintf (sgLogError): %s",strerror(errno));
+ va_end(ap);
+ sgLog(globalErrorLog,"%s",msg);
+ }
+@@ -104,7 +104,7 @@
+ char msg[MAX_BUF];
+ va_list ap;
+ VA_START(ap, format);
+- if(vsprintf(msg, format, ap) > (MAX_BUF - 1))
++ if(vsnprintf(msg, MAX_BUF, format, ap) > (MAX_BUF - 1))
+ return;
+ va_end(ap);
+ sgLog(globalErrorLog,"%s",msg);
diff --git a/testing/squidguard/squidguard.post-install b/testing/squidguard/squidguard.post-install
new file mode 100644
index 0000000000..2620de05f4
--- /dev/null
+++ b/testing/squidguard/squidguard.post-install
@@ -0,0 +1,3 @@
+#!/bin/sh
+mkdir /var/log/squidGuard &>/dev/null
+chown squid.squid /var/log/squidGuard