1 |
commit: f4799d94d2e95a1c0303375b4bfe068481e5386a |
2 |
Author: Sergey Popov <pinkbyte <AT> gentoo <DOT> org> |
3 |
AuthorDate: Tue Sep 29 10:31:00 2015 +0000 |
4 |
Commit: Sergey Popov <pinkbyte <AT> gentoo <DOT> org> |
5 |
CommitDate: Tue Sep 29 10:31:00 2015 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f4799d94 |
7 |
|
8 |
net-proxy/squidguard: revision bump |
9 |
|
10 |
Add patch to work correctly with Squid 3.4 and above |
11 |
Add support for user patches |
12 |
|
13 |
Package-Manager: portage-2.2.20 |
14 |
|
15 |
.../files/squidguard-1.5_beta-protocol.patch | 130 +++++++++++++++++++++ |
16 |
net-proxy/squidguard/squidguard-1.5_beta-r1.ebuild | 78 +++++++++++++ |
17 |
2 files changed, 208 insertions(+) |
18 |
|
19 |
diff --git a/net-proxy/squidguard/files/squidguard-1.5_beta-protocol.patch b/net-proxy/squidguard/files/squidguard-1.5_beta-protocol.patch |
20 |
new file mode 100644 |
21 |
index 0000000..289fc75 |
22 |
--- /dev/null |
23 |
+++ b/net-proxy/squidguard/files/squidguard-1.5_beta-protocol.patch |
24 |
@@ -0,0 +1,130 @@ |
25 |
+Patch for compatibility with new(>=3.4) Squid helper protocol |
26 |
+ |
27 |
+Bugreport: http://bugs.squid-cache.org/show_bug.cgi?id=3978 |
28 |
+ |
29 |
+diff -ur squidGuard-1.5-beta.orig/src/main.c squidGuard-1.5-beta/src/main.c |
30 |
+--- squidGuard-1.5-beta.orig/src/main.c 2013-12-12 11:47:31.000000000 +1300 |
31 |
++++ squidGuard-1.5-beta/src/main.c 2013-12-12 11:50:38.000000000 +1300 |
32 |
+@@ -185,7 +185,7 @@ |
33 |
+ sgReloadConfig(); |
34 |
+ } |
35 |
+ if(failsafe_mode) { |
36 |
+- puts(""); |
37 |
++ puts("ERR message=\"squidGuard failsafe mode\""); |
38 |
+ fflush(stdout); |
39 |
+ if(sig_hup){ |
40 |
+ sgReloadConfig(); |
41 |
+@@ -194,7 +194,7 @@ |
42 |
+ } |
43 |
+ if(parseLine(buf,&squidInfo) != 1){ |
44 |
+ sgLogError("ERROR: Error parsing squid line: %s",buf); |
45 |
+- puts(""); |
46 |
++ puts("BH message=\"squidGuard error parsing squid line\""); |
47 |
+ } |
48 |
+ else { |
49 |
+ src = Source; |
50 |
+@@ -206,14 +206,14 @@ |
51 |
+ acl = sgAclCheckSource(src); |
52 |
+ if((redirect = sgAclAccess(src,acl,&squidInfo)) == NULL){ |
53 |
+ if(src == NULL || src->cont_search == 0){ |
54 |
+- puts(""); |
55 |
++ puts("ERR"); |
56 |
+ break; |
57 |
+ } else |
58 |
+ if(src->next != NULL){ |
59 |
+ src = src->next; |
60 |
+ continue; |
61 |
+ } else { |
62 |
+- puts(""); |
63 |
++ puts("ERR"); |
64 |
+ break; |
65 |
+ } |
66 |
+ } else { |
67 |
+@@ -228,6 +228,10 @@ |
68 |
+ fprintf(stdout,"%s %s/%s %s %s\n",redirect,squidInfo.src, |
69 |
+ squidInfo.srcDomain,squidInfo.ident, |
70 |
+ squidInfo.method); |
71 |
++ if (isdigit(redirect[0]) && isdigit(redirect[1]) && isdigit(redirect[2]) && redirect[3]==':') { |
72 |
++ fprintf(stdout,"OK status=%c%c%c url=\"%s\"\n", redirect[0], redirect[1], redirect[2], &redirect[4]); |
73 |
++ } else |
74 |
++ fprintf(stdout,"OK rewrite-url=\"%s\"\n",redirect); |
75 |
+ /* sgLogDebug("DEBUG: %s %s/%s %s %s\n",redirect,squidInfo.src,squidInfo.srcDomain,squidInfo.ident,squidInfo.method); */ |
76 |
+ break; |
77 |
+ } |
78 |
+diff -ur squidGuard-1.5-beta.orig/src/main.c.in squidGuard-1.5-beta/src/main.c.in |
79 |
+--- squidGuard-1.5-beta.orig/src/main.c.in 2013-12-12 11:47:31.000000000 +1300 |
80 |
++++ squidGuard-1.5-beta/src/main.c.in 2013-12-12 11:53:18.000000000 +1300 |
81 |
+@@ -185,7 +185,7 @@ |
82 |
+ sgReloadConfig(); |
83 |
+ } |
84 |
+ if(failsafe_mode) { |
85 |
+- puts(""); |
86 |
++ puts("ERR message=\"squidGuard failsafe mode\""); |
87 |
+ fflush(stdout); |
88 |
+ if(sig_hup){ |
89 |
+ sgReloadConfig(); |
90 |
+@@ -194,7 +194,7 @@ |
91 |
+ } |
92 |
+ if(parseLine(buf,&squidInfo) != 1){ |
93 |
+ sgLogError("ERROR: Error parsing squid line: %s",buf); |
94 |
+- puts(""); |
95 |
++ puts("BH message=\"squidGuard error parsing squid line\""); |
96 |
+ } |
97 |
+ else { |
98 |
+ src = Source; |
99 |
+@@ -206,14 +206,14 @@ |
100 |
+ acl = sgAclCheckSource(src); |
101 |
+ if((redirect = sgAclAccess(src,acl,&squidInfo)) == NULL){ |
102 |
+ if(src == NULL || src->cont_search == 0){ |
103 |
+- puts(""); |
104 |
++ puts("ERR"); |
105 |
+ break; |
106 |
+ } else |
107 |
+ if(src->next != NULL){ |
108 |
+ src = src->next; |
109 |
+ continue; |
110 |
+ } else { |
111 |
+- puts(""); |
112 |
++ puts("ERR"); |
113 |
+ break; |
114 |
+ } |
115 |
+ } else { |
116 |
+@@ -225,9 +225,11 @@ |
117 |
+ squidInfo.ident[0] = '-'; |
118 |
+ squidInfo.ident[1] = '\0'; |
119 |
+ } |
120 |
+- fprintf(stdout,"%s %s/%s %s %s\n",redirect,squidInfo.src, |
121 |
+- squidInfo.srcDomain,squidInfo.ident, |
122 |
+- squidInfo.method); |
123 |
++ if (isdigit(redirect[0]) && isdigit(redirect[1]) && isdigit(redirect[2]) && redirect[3]==':') { |
124 |
++ fprintf(stdout,"OK status=%c%c%c url=\"%s\"\n", redirect[0], redirect[1], redirect[2], &redirect[4]); |
125 |
++ } else |
126 |
++ fprintf(stdout,"OK rewrite-url=\"%s\"\n",redirect); |
127 |
++ |
128 |
+ /* sgLogDebug("DEBUG: %s %s/%s %s %s\n",redirect,squidInfo.src,squidInfo.srcDomain,squidInfo.ident,squidInfo.method); */ |
129 |
+ break; |
130 |
+ } |
131 |
+diff -ur squidGuard-1.5-beta.orig/src/sgDiv.c squidGuard-1.5-beta/src/sgDiv.c |
132 |
+--- squidGuard-1.5-beta.orig/src/sgDiv.c 2013-12-12 11:47:31.000000000 +1300 |
133 |
++++ squidGuard-1.5-beta/src/sgDiv.c 2013-12-12 11:48:36.000000000 +1300 |
134 |
+@@ -782,7 +782,7 @@ |
135 |
+ } |
136 |
+ sgLogError("ERROR: Going into emergency mode"); |
137 |
+ while(fgets(buf, MAX_BUF, stdin) != NULL){ |
138 |
+- puts(""); |
139 |
++ puts("ERR"); |
140 |
+ fflush(stdout); |
141 |
+ } |
142 |
+ sgLogError("ERROR: Ending emergency mode, stdin empty"); |
143 |
+diff -ur squidGuard-1.5-beta.orig/src/sgDiv.c.in squidGuard-1.5-beta/src/sgDiv.c.in |
144 |
+--- squidGuard-1.5-beta.orig/src/sgDiv.c.in 2013-12-12 11:47:31.000000000 +1300 |
145 |
++++ squidGuard-1.5-beta/src/sgDiv.c.in 2013-12-12 11:48:36.000000000 +1300 |
146 |
+@@ -782,7 +782,7 @@ |
147 |
+ } |
148 |
+ sgLogError("ERROR: Going into emergency mode"); |
149 |
+ while(fgets(buf, MAX_BUF, stdin) != NULL){ |
150 |
+- puts(""); |
151 |
++ puts("ERR"); |
152 |
+ fflush(stdout); |
153 |
+ } |
154 |
+ sgLogError("ERROR: Ending emergency mode, stdin empty"); |
155 |
|
156 |
diff --git a/net-proxy/squidguard/squidguard-1.5_beta-r1.ebuild b/net-proxy/squidguard/squidguard-1.5_beta-r1.ebuild |
157 |
new file mode 100644 |
158 |
index 0000000..917df47 |
159 |
--- /dev/null |
160 |
+++ b/net-proxy/squidguard/squidguard-1.5_beta-r1.ebuild |
161 |
@@ -0,0 +1,78 @@ |
162 |
+# Copyright 1999-2015 Gentoo Foundation |
163 |
+# Distributed under the terms of the GNU General Public License v2 |
164 |
+# $Id$ |
165 |
+ |
166 |
+EAPI="5" |
167 |
+ |
168 |
+WANT_AUTOMAKE=none |
169 |
+ |
170 |
+inherit eutils autotools user |
171 |
+ |
172 |
+MY_P="squidGuard-${PV/_/-}" |
173 |
+ |
174 |
+DESCRIPTION="Combined filter, redirector and access controller plugin for Squid" |
175 |
+HOMEPAGE="http://www.squidguard.org" |
176 |
+SRC_URI="http://www.squidguard.org/Downloads/Devel/${MY_P}.tar.gz" |
177 |
+ |
178 |
+LICENSE="GPL-2" |
179 |
+SLOT="0" |
180 |
+KEYWORDS="~amd64 ~arm ~ppc ~ppc64 ~sparc ~x86" |
181 |
+ |
182 |
+IUSE="ldap" |
183 |
+ |
184 |
+RDEPEND=">=sys-libs/db-2 |
185 |
+ ldap? ( net-nds/openldap:0 )" |
186 |
+ |
187 |
+DEPEND="${RDEPEND} |
188 |
+ sys-devel/bison:0 |
189 |
+ sys-devel/flex:0" |
190 |
+ |
191 |
+S="${WORKDIR}/${MY_P}" |
192 |
+ |
193 |
+pkg_setup() { |
194 |
+ enewgroup squid |
195 |
+ enewuser squid -1 -1 /var/cache/squid squid |
196 |
+} |
197 |
+ |
198 |
+src_prepare() { |
199 |
+ mv configure.in configure.ac || die |
200 |
+ epatch \ |
201 |
+ "${FILESDIR}/${P}-gentoo.patch" \ |
202 |
+ "${FILESDIR}/${P}-protocol.patch" |
203 |
+ |
204 |
+ epatch_user |
205 |
+ eautoreconf |
206 |
+} |
207 |
+ |
208 |
+src_configure() { |
209 |
+ econf \ |
210 |
+ $(use_with ldap) \ |
211 |
+ --with-sg-config=/etc/squidGuard/squidGuard.conf \ |
212 |
+ --with-sg-logdir=/var/log/squidGuard |
213 |
+} |
214 |
+ |
215 |
+src_install() { |
216 |
+ emake prefix="/usr" INSTDIR="${D}" install |
217 |
+ |
218 |
+ keepdir /var/log/squidGuard |
219 |
+ fowners squid:squid /var/log/squidGuard |
220 |
+ |
221 |
+ insinto /etc/squidGuard/sample |
222 |
+ doins "${FILESDIR}"/squidGuard.conf.* |
223 |
+ insinto /etc/squidGuard/sample/db |
224 |
+ doins "${FILESDIR}"/blockedsites |
225 |
+ |
226 |
+ dodoc ANNOUNCE CHANGELOG README |
227 |
+ dohtml doc/*.html |
228 |
+ docinto text |
229 |
+ dodoc doc/*.txt |
230 |
+} |
231 |
+ |
232 |
+pkg_postinst() { |
233 |
+ einfo "To enable squidGuard, add the following lines to /etc/squid/squid.conf:" |
234 |
+ einfo " url_rewrite_program /usr/bin/squidGuard" |
235 |
+ einfo " url_rewrite_children 10" |
236 |
+ einfo "" |
237 |
+ einfo "Remember to edit /etc/squidGuard/squidGuard.conf first!" |
238 |
+ einfo "Examples can be found in /etc/squidGuard/sample/" |
239 |
+} |