Gentoo Archives: gentoo-commits

From: Aaron Bauman <bman@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: net-proxy/tinyproxy/files/
Date: Sat, 09 Feb 2019 19:56:06
Message-Id: 1549742102.fbea84f6a9cecf01c644a59f022ae89b77383790.bman@gentoo
1 commit: fbea84f6a9cecf01c644a59f022ae89b77383790
2 Author: Michael Mair-Keimberger <m.mairkeimberger <AT> gmail <DOT> com>
3 AuthorDate: Fri Jan 11 17:56:46 2019 +0000
4 Commit: Aaron Bauman <bman <AT> gentoo <DOT> org>
5 CommitDate: Sat Feb 9 19:55:02 2019 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=fbea84f6
7
8 net-proxy/tinyproxy: remove unused patches
9
10 Signed-off-by: Michael Mair-Keimberger <m.mairkeimberger <AT> gmail.com>
11 Signed-off-by: Aaron Bauman <bman <AT> gentoo.org>
12
13 .../tinyproxy/files/tinyproxy-1.8.1-ldflags.patch | 11 --
14 .../tinyproxy/files/tinyproxy-1.8.1-minimal.patch | 10 --
15 .../files/tinyproxy-1.8.3-r2-DoS-Prevention.patch | 183 ---------------------
16 net-proxy/tinyproxy/files/tinyproxy-1.8.3-r2.initd | 40 -----
17 4 files changed, 244 deletions(-)
18
19 diff --git a/net-proxy/tinyproxy/files/tinyproxy-1.8.1-ldflags.patch b/net-proxy/tinyproxy/files/tinyproxy-1.8.1-ldflags.patch
20 deleted file mode 100644
21 index bd40ec33e31..00000000000
22 --- a/net-proxy/tinyproxy/files/tinyproxy-1.8.1-ldflags.patch
23 +++ /dev/null
24 @@ -1,11 +0,0 @@
25 ---- a/configure.ac 2010-03-09 12:41:45.000000000 +0100
26 -+++ b/configure.ac 2010-05-17 23:07:39.000000000 +0200
27 -@@ -222,7 +222,7 @@
28 - CFLAGS="-DNDEBUG $CFLAGS"
29 - fi
30 -
31 --LDFLAGS="-Wl,-z,defs"
32 -+LDFLAGS="$LDFLAGS -Wl,-z,defs"
33 -
34 - dnl
35 - dnl Make sure we can actually handle the "--with-*" and "--enable-*" stuff.
36
37 diff --git a/net-proxy/tinyproxy/files/tinyproxy-1.8.1-minimal.patch b/net-proxy/tinyproxy/files/tinyproxy-1.8.1-minimal.patch
38 deleted file mode 100644
39 index 82793a8894d..00000000000
40 --- a/net-proxy/tinyproxy/files/tinyproxy-1.8.1-minimal.patch
41 +++ /dev/null
42 @@ -1,10 +0,0 @@
43 ---- a/Makefile.am
44 -+++ b/Makefile.am
45 -@@ -2,7 +2,6 @@
46 - src \
47 - data \
48 - etc \
49 -- docs \
50 - m4macros \
51 - tests
52 -
53
54 diff --git a/net-proxy/tinyproxy/files/tinyproxy-1.8.3-r2-DoS-Prevention.patch b/net-proxy/tinyproxy/files/tinyproxy-1.8.3-r2-DoS-Prevention.patch
55 deleted file mode 100644
56 index 059f178c1ee..00000000000
57 --- a/net-proxy/tinyproxy/files/tinyproxy-1.8.3-r2-DoS-Prevention.patch
58 +++ /dev/null
59 @@ -1,183 +0,0 @@
60 -https://banu.com/bugzilla/show_bug.cgi?id=110#c4
61 -
62 -From 526215dbb4abb1cff9a170343fa50dbda9492eb1 Mon Sep 17 00:00:00 2001
63 -From: Michael Adam <obnox@×××××.org>
64 -Date: Fri, 15 Mar 2013 12:34:01 +0100
65 -Subject: [PATCH 1/2] [BB#110] secure the hashmaps by adding a seed
66 -
67 -Based on patch provided by gpernot@×××××××.org on bugzilla.
68 -
69 -Signed-off-by: Michael Adam <obnox@×××××.org>
70 ----
71 - configure.ac | 2 ++
72 - src/child.c | 1 +
73 - src/hashmap.c | 14 ++++++++------
74 - 3 files changed, 11 insertions(+), 6 deletions(-)
75 -
76 -diff --git a/configure.ac b/configure.ac
77 -index ecbcba0..cc40e85 100644
78 ---- a/configure.ac
79 -+++ b/configure.ac
80 -@@ -205,6 +205,8 @@ AC_CHECK_FUNCS([gethostname inet_ntoa memchr memset select socket strcasecmp \
81 - AC_CHECK_FUNCS([isascii memcpy setrlimit ftruncate regcomp regexec])
82 - AC_CHECK_FUNCS([strlcpy strlcat])
83 -
84 -+AC_CHECK_FUNCS([time rand srand])
85 -+
86 -
87 - dnl Enable extra warnings
88 - DESIRED_FLAGS="-fdiagnostics-show-option -Wall -Wextra -Wno-unused-parameter -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations -Wfloat-equal -Wundef -Wformat=2 -Wlogical-op -Wmissing-include-dirs -Wformat-nonliteral -Wold-style-definition -Wpointer-arith -Waggregate-return -Winit-self -Wpacked --std=c89 -ansi -pedantic -Wno-overlength-strings -Wc++-compat -Wno-long-long -Wno-overlength-strings -Wdeclaration-after-statement -Wredundant-decls -Wmissing-noreturn -Wshadow -Wendif-labels -Wcast-qual -Wcast-align -Wwrite-strings -Wp,-D_FORTIFY_SOURCE=2 -fno-common"
89 -diff --git a/src/child.c b/src/child.c
90 -index 34e20e0..0d778d9 100644
91 ---- a/src/child.c
92 -+++ b/src/child.c
93 -@@ -196,6 +196,7 @@ static void child_main (struct child_s *ptr)
94 - }
95 -
96 - ptr->connects = 0;
97 -+ srand(time(NULL));
98 -
99 - while (!config.quit) {
100 - ptr->status = T_WAITING;
101 -diff --git a/src/hashmap.c b/src/hashmap.c
102 -index f46fdcb..8cf7c6b 100644
103 ---- a/src/hashmap.c
104 -+++ b/src/hashmap.c
105 -@@ -50,6 +50,7 @@ struct hashbucket_s {
106 - };
107 -
108 - struct hashmap_s {
109 -+ uint32_t seed;
110 - unsigned int size;
111 - hashmap_iter end_iterator;
112 -
113 -@@ -65,7 +66,7 @@ struct hashmap_s {
114 - *
115 - * If any of the arguments are invalid a negative number is returned.
116 - */
117 --static int hashfunc (const char *key, unsigned int size)
118 -+static int hashfunc (const char *key, unsigned int size, uint32_t seed)
119 - {
120 - uint32_t hash;
121 -
122 -@@ -74,7 +75,7 @@ static int hashfunc (const char *key, unsigned int size)
123 - if (size == 0)
124 - return -ERANGE;
125 -
126 -- for (hash = tolower (*key++); *key != '\0'; key++) {
127 -+ for (hash = seed; *key != '\0'; key++) {
128 - uint32_t bit = (hash & 1) ? (1 << (sizeof (uint32_t) - 1)) : 0;
129 -
130 - hash >>= 1;
131 -@@ -104,6 +105,7 @@ hashmap_t hashmap_create (unsigned int nbuckets)
132 - if (!ptr)
133 - return NULL;
134 -
135 -+ ptr->seed = (uint32_t)rand();
136 - ptr->size = nbuckets;
137 - ptr->buckets = (struct hashbucket_s *) safecalloc (nbuckets,
138 - sizeof (struct
139 -@@ -201,7 +203,7 @@ hashmap_insert (hashmap_t map, const char *key, const void *data, size_t len)
140 - if (!data || len < 1)
141 - return -ERANGE;
142 -
143 -- hash = hashfunc (key, map->size);
144 -+ hash = hashfunc (key, map->size, map->seed);
145 - if (hash < 0)
146 - return hash;
147 -
148 -@@ -382,7 +384,7 @@ ssize_t hashmap_search (hashmap_t map, const char *key)
149 - if (map == NULL || key == NULL)
150 - return -EINVAL;
151 -
152 -- hash = hashfunc (key, map->size);
153 -+ hash = hashfunc (key, map->size, map->seed);
154 - if (hash < 0)
155 - return hash;
156 -
157 -@@ -416,7 +418,7 @@ ssize_t hashmap_entry_by_key (hashmap_t map, const char *key, void **data)
158 - if (!map || !key || !data)
159 - return -EINVAL;
160 -
161 -- hash = hashfunc (key, map->size);
162 -+ hash = hashfunc (key, map->size, map->seed);
163 - if (hash < 0)
164 - return hash;
165 -
166 -@@ -451,7 +453,7 @@ ssize_t hashmap_remove (hashmap_t map, const char *key)
167 - if (map == NULL || key == NULL)
168 - return -EINVAL;
169 -
170 -- hash = hashfunc (key, map->size);
171 -+ hash = hashfunc (key, map->size, map->seed);
172 - if (hash < 0)
173 - return hash;
174 -
175 ---
176 -1.7.9.5
177 -
178 -https://banu.com/bugzilla/show_bug.cgi?id=110#c5
179 -
180 -From f1189daec6866efeb44f24073cd19d7ece86e537 Mon Sep 17 00:00:00 2001
181 -From: Michael Adam <obnox@×××××.org>
182 -Date: Fri, 15 Mar 2013 13:10:01 +0100
183 -Subject: [PATCH 2/2] [BB#110] limit the number of headers per request to
184 - prevent DoS
185 -
186 -Based on patch provided by gpernot@×××××××.org on bugzilla.
187 -
188 -Signed-off-by: Michael Adam <obnox@×××××.org>
189 ----
190 - src/reqs.c | 17 ++++++++++++++++-
191 - 1 file changed, 16 insertions(+), 1 deletion(-)
192 -
193 -diff --git a/src/reqs.c b/src/reqs.c
194 -index 2de43a8..af014ba 100644
195 ---- a/src/reqs.c
196 -+++ b/src/reqs.c
197 -@@ -611,12 +611,19 @@ add_header_to_connection (hashmap_t hashofheaders, char *header, size_t len)
198 - }
199 -
200 - /*
201 -+ * define max number of headers.
202 -+ * big enough to handle legitimate cases, but limited to avoid DoS
203 -+ */
204 -+#define MAX_HEADERS 10000
205 -+
206 -+/*
207 - * Read all the headers from the stream
208 - */
209 - static int get_all_headers (int fd, hashmap_t hashofheaders)
210 - {
211 - char *line = NULL;
212 - char *header = NULL;
213 -+ int count;
214 - char *tmp;
215 - ssize_t linelen;
216 - ssize_t len = 0;
217 -@@ -625,7 +632,7 @@ static int get_all_headers (int fd, hashmap_t hashofheaders)
218 - assert (fd >= 0);
219 - assert (hashofheaders != NULL);
220 -
221 -- for (;;) {
222 -+ for (count = 0; count < MAX_HEADERS; count++) {
223 - if ((linelen = readline (fd, &line)) <= 0) {
224 - safefree (header);
225 - safefree (line);
226 -@@ -691,6 +698,14 @@ static int get_all_headers (int fd, hashmap_t hashofheaders)
227 -
228 - safefree (line);
229 - }
230 -+
231 -+ /*
232 -+ * if we get there, this is we reached MAX_HEADERS count
233 -+ * bail out with error
234 -+ */
235 -+ safefree (header);
236 -+ safefree (line);
237 -+ return -1;
238 - }
239 -
240 - /*
241 ---
242 -1.7.9.5
243
244 diff --git a/net-proxy/tinyproxy/files/tinyproxy-1.8.3-r2.initd b/net-proxy/tinyproxy/files/tinyproxy-1.8.3-r2.initd
245 deleted file mode 100644
246 index 0d6618b69a9..00000000000
247 --- a/net-proxy/tinyproxy/files/tinyproxy-1.8.3-r2.initd
248 +++ /dev/null
249 @@ -1,40 +0,0 @@
250 -#!/sbin/openrc-run
251 -# Copyright 1999-2018 Gentoo Authors
252 -# Distributed under the terms of the GNU General Public License v2
253 -
254 -get_config() {
255 - res=$(awk '$1 == "'$1'" { s=$2 } END { print s }' "$CONFFILE")
256 -
257 - if [ "x$res" = "x" ]; then
258 - echo "$2"
259 - else
260 - eval echo "$res"
261 - fi
262 -}
263 -
264 -: ${CONFFILE:="/etc/${SVCNAME}.conf"}
265 -
266 -command=/usr/sbin/tinyproxy
267 -command_args="-c ${CONFFILE}"
268 -pidfile=$(get_config PidFile /run/tinyproxy/${SVCNAME}.pid)
269 -
270 -depend() {
271 - config "$CONFFILE"
272 -
273 - use dns
274 -
275 - [ "$(get_config Syslog Off)" = "On" ] && \
276 - use logger
277 -}
278 -
279 -start_pre() {
280 - piddir=$(dirname ${pidfile})
281 -
282 - if [ "${piddir}" = "/run" ]; then
283 - eerror "Please change your PidFile settings to be within the"
284 - eerror "/run/tinyproxy directory"
285 - eend 1
286 - else
287 - checkpath -d -o $(get_config User tinyproxy):$(get_config Group tinyproxy) ${piddir}
288 - fi
289 -}