summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Popov <pinkbyte@gentoo.org>2015-09-29 13:31:00 +0300
committerSergey Popov <pinkbyte@gentoo.org>2015-09-29 13:31:00 +0300
commitf4799d94d2e95a1c0303375b4bfe068481e5386a (patch)
treecc6d431ccc16b68c611661e8afd26fb7ebd8faba /net-proxy/squidguard
parentsys-fs/lvm2: amd64 stable wrt bug #559910 (diff)
downloadgentoo-f4799d94d2e95a1c0303375b4bfe068481e5386a.tar.gz
gentoo-f4799d94d2e95a1c0303375b4bfe068481e5386a.tar.bz2
gentoo-f4799d94d2e95a1c0303375b4bfe068481e5386a.zip
net-proxy/squidguard: revision bump
Add patch to work correctly with Squid 3.4 and above Add support for user patches Package-Manager: portage-2.2.20
Diffstat (limited to 'net-proxy/squidguard')
-rw-r--r--net-proxy/squidguard/files/squidguard-1.5_beta-protocol.patch130
-rw-r--r--net-proxy/squidguard/squidguard-1.5_beta-r1.ebuild78
2 files changed, 208 insertions, 0 deletions
diff --git a/net-proxy/squidguard/files/squidguard-1.5_beta-protocol.patch b/net-proxy/squidguard/files/squidguard-1.5_beta-protocol.patch
new file mode 100644
index 000000000000..289fc7563b72
--- /dev/null
+++ b/net-proxy/squidguard/files/squidguard-1.5_beta-protocol.patch
@@ -0,0 +1,130 @@
+Patch for compatibility with new(>=3.4) Squid helper protocol
+
+Bugreport: http://bugs.squid-cache.org/show_bug.cgi?id=3978
+
+diff -ur squidGuard-1.5-beta.orig/src/main.c squidGuard-1.5-beta/src/main.c
+--- squidGuard-1.5-beta.orig/src/main.c 2013-12-12 11:47:31.000000000 +1300
++++ squidGuard-1.5-beta/src/main.c 2013-12-12 11:50:38.000000000 +1300
+@@ -185,7 +185,7 @@
+ sgReloadConfig();
+ }
+ if(failsafe_mode) {
+- puts("");
++ puts("ERR message=\"squidGuard failsafe mode\"");
+ fflush(stdout);
+ if(sig_hup){
+ sgReloadConfig();
+@@ -194,7 +194,7 @@
+ }
+ if(parseLine(buf,&squidInfo) != 1){
+ sgLogError("ERROR: Error parsing squid line: %s",buf);
+- puts("");
++ puts("BH message=\"squidGuard error parsing squid line\"");
+ }
+ else {
+ src = Source;
+@@ -206,14 +206,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 {
+@@ -228,6 +228,10 @@
+ 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);
+ /* sgLogDebug("DEBUG: %s %s/%s %s %s\n",redirect,squidInfo.src,squidInfo.srcDomain,squidInfo.ident,squidInfo.method); */
+ break;
+ }
+diff -ur squidGuard-1.5-beta.orig/src/main.c.in squidGuard-1.5-beta/src/main.c.in
+--- squidGuard-1.5-beta.orig/src/main.c.in 2013-12-12 11:47:31.000000000 +1300
++++ squidGuard-1.5-beta/src/main.c.in 2013-12-12 11:53:18.000000000 +1300
+@@ -185,7 +185,7 @@
+ sgReloadConfig();
+ }
+ if(failsafe_mode) {
+- puts("");
++ puts("ERR message=\"squidGuard failsafe mode\"");
+ fflush(stdout);
+ if(sig_hup){
+ sgReloadConfig();
+@@ -194,7 +194,7 @@
+ }
+ if(parseLine(buf,&squidInfo) != 1){
+ sgLogError("ERROR: Error parsing squid line: %s",buf);
+- puts("");
++ puts("BH message=\"squidGuard error parsing squid line\"");
+ }
+ else {
+ src = Source;
+@@ -206,14 +206,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 {
+@@ -225,9 +225,11 @@
+ 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);
++
+ /* sgLogDebug("DEBUG: %s %s/%s %s %s\n",redirect,squidInfo.src,squidInfo.srcDomain,squidInfo.ident,squidInfo.method); */
+ break;
+ }
+diff -ur squidGuard-1.5-beta.orig/src/sgDiv.c squidGuard-1.5-beta/src/sgDiv.c
+--- squidGuard-1.5-beta.orig/src/sgDiv.c 2013-12-12 11:47:31.000000000 +1300
++++ squidGuard-1.5-beta/src/sgDiv.c 2013-12-12 11:48:36.000000000 +1300
+@@ -782,7 +782,7 @@
+ }
+ sgLogError("ERROR: Going into emergency mode");
+ while(fgets(buf, MAX_BUF, stdin) != NULL){
+- puts("");
++ puts("ERR");
+ fflush(stdout);
+ }
+ sgLogError("ERROR: Ending emergency mode, stdin empty");
+diff -ur squidGuard-1.5-beta.orig/src/sgDiv.c.in squidGuard-1.5-beta/src/sgDiv.c.in
+--- squidGuard-1.5-beta.orig/src/sgDiv.c.in 2013-12-12 11:47:31.000000000 +1300
++++ squidGuard-1.5-beta/src/sgDiv.c.in 2013-12-12 11:48:36.000000000 +1300
+@@ -782,7 +782,7 @@
+ }
+ sgLogError("ERROR: Going into emergency mode");
+ while(fgets(buf, MAX_BUF, stdin) != NULL){
+- puts("");
++ puts("ERR");
+ fflush(stdout);
+ }
+ sgLogError("ERROR: Ending emergency mode, stdin empty");
diff --git a/net-proxy/squidguard/squidguard-1.5_beta-r1.ebuild b/net-proxy/squidguard/squidguard-1.5_beta-r1.ebuild
new file mode 100644
index 000000000000..917df472986f
--- /dev/null
+++ b/net-proxy/squidguard/squidguard-1.5_beta-r1.ebuild
@@ -0,0 +1,78 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="5"
+
+WANT_AUTOMAKE=none
+
+inherit eutils autotools user
+
+MY_P="squidGuard-${PV/_/-}"
+
+DESCRIPTION="Combined filter, redirector and access controller plugin for Squid"
+HOMEPAGE="http://www.squidguard.org"
+SRC_URI="http://www.squidguard.org/Downloads/Devel/${MY_P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~ppc ~ppc64 ~sparc ~x86"
+
+IUSE="ldap"
+
+RDEPEND=">=sys-libs/db-2
+ ldap? ( net-nds/openldap:0 )"
+
+DEPEND="${RDEPEND}
+ sys-devel/bison:0
+ sys-devel/flex:0"
+
+S="${WORKDIR}/${MY_P}"
+
+pkg_setup() {
+ enewgroup squid
+ enewuser squid -1 -1 /var/cache/squid squid
+}
+
+src_prepare() {
+ mv configure.in configure.ac || die
+ epatch \
+ "${FILESDIR}/${P}-gentoo.patch" \
+ "${FILESDIR}/${P}-protocol.patch"
+
+ epatch_user
+ eautoreconf
+}
+
+src_configure() {
+ econf \
+ $(use_with ldap) \
+ --with-sg-config=/etc/squidGuard/squidGuard.conf \
+ --with-sg-logdir=/var/log/squidGuard
+}
+
+src_install() {
+ emake prefix="/usr" INSTDIR="${D}" install
+
+ keepdir /var/log/squidGuard
+ fowners squid:squid /var/log/squidGuard
+
+ insinto /etc/squidGuard/sample
+ doins "${FILESDIR}"/squidGuard.conf.*
+ insinto /etc/squidGuard/sample/db
+ doins "${FILESDIR}"/blockedsites
+
+ dodoc ANNOUNCE CHANGELOG README
+ dohtml doc/*.html
+ docinto text
+ dodoc doc/*.txt
+}
+
+pkg_postinst() {
+ einfo "To enable squidGuard, add the following lines to /etc/squid/squid.conf:"
+ einfo " url_rewrite_program /usr/bin/squidGuard"
+ einfo " url_rewrite_children 10"
+ einfo ""
+ einfo "Remember to edit /etc/squidGuard/squidGuard.conf first!"
+ einfo "Examples can be found in /etc/squidGuard/sample/"
+}