1 |
commit: 4a5864922232c7df550c21f2a7b77fe6f8ffc6d6 |
2 |
Author: Aric Belsito <lluixhi <AT> gmail <DOT> com> |
3 |
AuthorDate: Sun Jun 18 16:13:24 2017 +0000 |
4 |
Commit: Aric Belsito <lluixhi <AT> gmail <DOT> com> |
5 |
CommitDate: Sun Jun 18 16:13:24 2017 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/musl.git/commit/?id=4a586492 |
7 |
|
8 |
net-analyzer/openbsd-netcat: add most recent |
9 |
|
10 |
musl doesn't have b64_ntop() |
11 |
|
12 |
net-analyzer/openbsd-netcat/Manifest | 6 + |
13 |
.../files/openbsd-netcat-1.105-b64_ntop.patch | 349 +++++++++++++++++++++ |
14 |
.../files/openbsd-netcat-1.105-darwin.patch | 86 +++++ |
15 |
net-analyzer/openbsd-netcat/metadata.xml | 11 + |
16 |
.../openbsd-netcat/openbsd-netcat-1.105-r1.ebuild | 55 ++++ |
17 |
5 files changed, 507 insertions(+) |
18 |
|
19 |
diff --git a/net-analyzer/openbsd-netcat/Manifest b/net-analyzer/openbsd-netcat/Manifest |
20 |
new file mode 100644 |
21 |
index 0000000..82a4c2a |
22 |
--- /dev/null |
23 |
+++ b/net-analyzer/openbsd-netcat/Manifest |
24 |
@@ -0,0 +1,6 @@ |
25 |
+AUX openbsd-netcat-1.105-b64_ntop.patch 12296 SHA256 acba50e3a0394a473457eeb01f1d981b26c3aff6244a6f4a64f95a0cabc789da SHA512 65f00cbcef90d55967a2af70a963d8851292bf13affe4c69f02a508c1e9189591dd9b4d115b73337a46089c81b8503d5cf3281b113160c161b06a38b03421ce3 WHIRLPOOL 5269c4b8af349627f017e47cedf46cf6a0bb954b65979859cee710bf1cc3622ce08c5b93a9699ebbf314ff23ae5e382ef40fd4971ebc2c8414098f74d69b96e6 |
26 |
+AUX openbsd-netcat-1.105-darwin.patch 1591 SHA256 267677822a034f755563699f6055abb2cc44a676030724bee90c225aa7c46f4d SHA512 12a36f277b5a88491bcd8b3cb1c564bf9e3251c2a2b0f113ee425aa554bbb29b5cd2a87cdf0f67ad6b9cf3bc9a56d8a175d73ce4cb86fb4c531fd146b85b0ee9 WHIRLPOOL 333014699d5824b8efb7901f63722a32df3ace3823ad06e87620a2df604a7d6fedf05f0a58a1b3da440c1097a33b49b096d65d3670e5e775d66d2cf41ef68e04 |
27 |
+DIST netcat-openbsd_1.105-7.debian.tar.gz 31843 SHA256 eee759327ffea293e81d0dde67921b7fcfcad279ffd7a2c9d037bbc8f882b363 SHA512 ec507c858a9f0e75f5a8d6ee8e60eef5200428e55091e831a7acba6c61d70f97af01103c9b65354b0ce773214b0758d957852af793debb70be8aab5b5900b3f6 WHIRLPOOL 62878c51077b26578626f45e1282f2c1f16ae869714b355ef1797ec2911b8773ef07c81468e35bae02087f9f061b828be39200333c204e77b0bdb1ac9eceb957 |
28 |
+DIST netcat-openbsd_1.105.orig.tar.gz 14891 SHA256 40653fe66c1516876b61b07e093d826e2a5463c5d994f1b7e6ce328f3edb211e SHA512 1e515b5af83a12c6f270d6e8bede6406cc7c9f83ca0e316816508dfe2e2c49cda3fffb6b24a3922bf9908dc8b70d540eb8cc49e9cbfe867e49133c004d3f4703 WHIRLPOOL 7e80dde953575b5fc21399ef1d1d40c8cd6b40a5d6cd81d8a606d14b35ce8432c304d3e1bdaf9fb4697cf6dffc017b565cd60033ec0700d2442bc3ea3ca6aa9a |
29 |
+EBUILD openbsd-netcat-1.105-r1.ebuild 1483 SHA256 c3364f6bb1157ccac72d60fdf7b6d78744db1d848309ed7182e56559599e2c2d SHA512 040e55864d10d6ca9d1f90b58f8c570b388af571c3737c719e9dc44b987e8dba34b4d3ecc1028abd91a72f06f0c9522011302c9a0f1edb60c101944cd9b9953f WHIRLPOOL 0476d80ac48cfbbb14134fd58d5ecdcddf3fb85ac6d561b842e2455be95f8b541f81ee52808102170912f6797213e923266888a97bd56ff687eaf72f11568968 |
30 |
+MISC metadata.xml 351 SHA256 2eb8aa0bc9e25838e1e4e73c7d8049b1cd23bea91ba969511f107253c23efbcb SHA512 80bf423a6e8309ff117540ce0d2e29eeea89f3de4c4e4aea161ba37675ff0415a4f5a8cc37cb2ffe841e702de66a324888509a2f66df9576b76e774febfc8936 WHIRLPOOL d61c9621485ebea6404a82dc86c2d1a69f92bf842ec2774b421ef0f5e6946570523c78f1502acfeb64d1c093253ca317701f69ab4ba6a8927a6d29988e17ffa3 |
31 |
|
32 |
diff --git a/net-analyzer/openbsd-netcat/files/openbsd-netcat-1.105-b64_ntop.patch b/net-analyzer/openbsd-netcat/files/openbsd-netcat-1.105-b64_ntop.patch |
33 |
new file mode 100644 |
34 |
index 0000000..a9603b3 |
35 |
--- /dev/null |
36 |
+++ b/net-analyzer/openbsd-netcat/files/openbsd-netcat-1.105-b64_ntop.patch |
37 |
@@ -0,0 +1,349 @@ |
38 |
+diff -Naur netcat-openbsd-1.105.orig/Makefile netcat-openbsd-1.105/Makefile |
39 |
+--- netcat-openbsd-1.105.orig/Makefile 2017-06-18 09:01:44.293852659 -0700 |
40 |
++++ netcat-openbsd-1.105/Makefile 2017-06-18 09:04:35.566687655 -0700 |
41 |
+@@ -1,7 +1,7 @@ |
42 |
+ # $OpenBSD: Makefile,v 1.6 2001/09/02 18:45:41 jakob Exp $ |
43 |
+ |
44 |
+ PROG= nc |
45 |
+-SRCS= netcat.c atomicio.c socks.c |
46 |
++SRCS= netcat.c atomicio.c socks.c compat/base64.c |
47 |
+ |
48 |
+ LIBS= `pkg-config --libs libbsd` -lresolv |
49 |
+ OBJS= $(SRCS:.c=.o) |
50 |
+diff -Naur netcat-openbsd-1.105.orig/compat/base64.c netcat-openbsd-1.105/compat/base64.c |
51 |
+--- netcat-openbsd-1.105.orig/compat/base64.c 1969-12-31 16:00:00.000000000 -0800 |
52 |
++++ netcat-openbsd-1.105/compat/base64.c 2017-06-18 09:01:31.288700637 -0700 |
53 |
+@@ -0,0 +1,315 @@ |
54 |
++/* $OpenBSD: base64.c,v 1.8 2015/01/16 16:48:51 deraadt Exp $ */ |
55 |
++ |
56 |
++/* |
57 |
++ * Copyright (c) 1996 by Internet Software Consortium. |
58 |
++ * |
59 |
++ * Permission to use, copy, modify, and distribute this software for any |
60 |
++ * purpose with or without fee is hereby granted, provided that the above |
61 |
++ * copyright notice and this permission notice appear in all copies. |
62 |
++ * |
63 |
++ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS |
64 |
++ * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES |
65 |
++ * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE |
66 |
++ * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL |
67 |
++ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR |
68 |
++ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS |
69 |
++ * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS |
70 |
++ * SOFTWARE. |
71 |
++ */ |
72 |
++ |
73 |
++/* |
74 |
++ * Portions Copyright (c) 1995 by International Business Machines, Inc. |
75 |
++ * |
76 |
++ * International Business Machines, Inc. (hereinafter called IBM) grants |
77 |
++ * permission under its copyrights to use, copy, modify, and distribute this |
78 |
++ * Software with or without fee, provided that the above copyright notice and |
79 |
++ * all paragraphs of this notice appear in all copies, and that the name of IBM |
80 |
++ * not be used in connection with the marketing of any product incorporating |
81 |
++ * the Software or modifications thereof, without specific, written prior |
82 |
++ * permission. |
83 |
++ * |
84 |
++ * To the extent it has a right to do so, IBM grants an immunity from suit |
85 |
++ * under its patents, if any, for the use, sale or manufacture of products to |
86 |
++ * the extent that such products are used for performing Domain Name System |
87 |
++ * dynamic updates in TCP/IP networks by means of the Software. No immunity is |
88 |
++ * granted for any product per se or for any other function of any product. |
89 |
++ * |
90 |
++ * THE SOFTWARE IS PROVIDED "AS IS", AND IBM DISCLAIMS ALL WARRANTIES, |
91 |
++ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A |
92 |
++ * PARTICULAR PURPOSE. IN NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL, |
93 |
++ * DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER ARISING |
94 |
++ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE, EVEN |
95 |
++ * IF IBM IS APPRISED OF THE POSSIBILITY OF SUCH DAMAGES. |
96 |
++ */ |
97 |
++ |
98 |
++#include <sys/types.h> |
99 |
++#include <sys/socket.h> |
100 |
++#include <netinet/in.h> |
101 |
++#include <arpa/inet.h> |
102 |
++#include <arpa/nameser.h> |
103 |
++ |
104 |
++#include <ctype.h> |
105 |
++#include <resolv.h> |
106 |
++#include <stdio.h> |
107 |
++ |
108 |
++#include <stdlib.h> |
109 |
++#include <string.h> |
110 |
++ |
111 |
++static const char Base64[] = |
112 |
++ "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; |
113 |
++static const char Pad64 = '='; |
114 |
++ |
115 |
++/* (From RFC1521 and draft-ietf-dnssec-secext-03.txt) |
116 |
++ The following encoding technique is taken from RFC 1521 by Borenstein |
117 |
++ and Freed. It is reproduced here in a slightly edited form for |
118 |
++ convenience. |
119 |
++ |
120 |
++ A 65-character subset of US-ASCII is used, enabling 6 bits to be |
121 |
++ represented per printable character. (The extra 65th character, "=", |
122 |
++ is used to signify a special processing function.) |
123 |
++ |
124 |
++ The encoding process represents 24-bit groups of input bits as output |
125 |
++ strings of 4 encoded characters. Proceeding from left to right, a |
126 |
++ 24-bit input group is formed by concatenating 3 8-bit input groups. |
127 |
++ These 24 bits are then treated as 4 concatenated 6-bit groups, each |
128 |
++ of which is translated into a single digit in the base64 alphabet. |
129 |
++ |
130 |
++ Each 6-bit group is used as an index into an array of 64 printable |
131 |
++ characters. The character referenced by the index is placed in the |
132 |
++ output string. |
133 |
++ |
134 |
++ Table 1: The Base64 Alphabet |
135 |
++ |
136 |
++ Value Encoding Value Encoding Value Encoding Value Encoding |
137 |
++ 0 A 17 R 34 i 51 z |
138 |
++ 1 B 18 S 35 j 52 0 |
139 |
++ 2 C 19 T 36 k 53 1 |
140 |
++ 3 D 20 U 37 l 54 2 |
141 |
++ 4 E 21 V 38 m 55 3 |
142 |
++ 5 F 22 W 39 n 56 4 |
143 |
++ 6 G 23 X 40 o 57 5 |
144 |
++ 7 H 24 Y 41 p 58 6 |
145 |
++ 8 I 25 Z 42 q 59 7 |
146 |
++ 9 J 26 a 43 r 60 8 |
147 |
++ 10 K 27 b 44 s 61 9 |
148 |
++ 11 L 28 c 45 t 62 + |
149 |
++ 12 M 29 d 46 u 63 / |
150 |
++ 13 N 30 e 47 v |
151 |
++ 14 O 31 f 48 w (pad) = |
152 |
++ 15 P 32 g 49 x |
153 |
++ 16 Q 33 h 50 y |
154 |
++ |
155 |
++ Special processing is performed if fewer than 24 bits are available |
156 |
++ at the end of the data being encoded. A full encoding quantum is |
157 |
++ always completed at the end of a quantity. When fewer than 24 input |
158 |
++ bits are available in an input group, zero bits are added (on the |
159 |
++ right) to form an integral number of 6-bit groups. Padding at the |
160 |
++ end of the data is performed using the '=' character. |
161 |
++ |
162 |
++ Since all base64 input is an integral number of octets, only the |
163 |
++ ------------------------------------------------- |
164 |
++ following cases can arise: |
165 |
++ |
166 |
++ (1) the final quantum of encoding input is an integral |
167 |
++ multiple of 24 bits; here, the final unit of encoded |
168 |
++ output will be an integral multiple of 4 characters |
169 |
++ with no "=" padding, |
170 |
++ (2) the final quantum of encoding input is exactly 8 bits; |
171 |
++ here, the final unit of encoded output will be two |
172 |
++ characters followed by two "=" padding characters, or |
173 |
++ (3) the final quantum of encoding input is exactly 16 bits; |
174 |
++ here, the final unit of encoded output will be three |
175 |
++ characters followed by one "=" padding character. |
176 |
++ */ |
177 |
++ |
178 |
++int |
179 |
++b64_ntop(src, srclength, target, targsize) |
180 |
++ u_char const *src; |
181 |
++ size_t srclength; |
182 |
++ char *target; |
183 |
++ size_t targsize; |
184 |
++{ |
185 |
++ size_t datalength = 0; |
186 |
++ u_char input[3]; |
187 |
++ u_char output[4]; |
188 |
++ int i; |
189 |
++ |
190 |
++ while (2 < srclength) { |
191 |
++ input[0] = *src++; |
192 |
++ input[1] = *src++; |
193 |
++ input[2] = *src++; |
194 |
++ srclength -= 3; |
195 |
++ |
196 |
++ output[0] = input[0] >> 2; |
197 |
++ output[1] = ((input[0] & 0x03) << 4) + (input[1] >> 4); |
198 |
++ output[2] = ((input[1] & 0x0f) << 2) + (input[2] >> 6); |
199 |
++ output[3] = input[2] & 0x3f; |
200 |
++ |
201 |
++ if (datalength + 4 > targsize) |
202 |
++ return (-1); |
203 |
++ target[datalength++] = Base64[output[0]]; |
204 |
++ target[datalength++] = Base64[output[1]]; |
205 |
++ target[datalength++] = Base64[output[2]]; |
206 |
++ target[datalength++] = Base64[output[3]]; |
207 |
++ } |
208 |
++ |
209 |
++ /* Now we worry about padding. */ |
210 |
++ if (0 != srclength) { |
211 |
++ /* Get what's left. */ |
212 |
++ input[0] = input[1] = input[2] = '\0'; |
213 |
++ for (i = 0; i < srclength; i++) |
214 |
++ input[i] = *src++; |
215 |
++ |
216 |
++ output[0] = input[0] >> 2; |
217 |
++ output[1] = ((input[0] & 0x03) << 4) + (input[1] >> 4); |
218 |
++ output[2] = ((input[1] & 0x0f) << 2) + (input[2] >> 6); |
219 |
++ |
220 |
++ if (datalength + 4 > targsize) |
221 |
++ return (-1); |
222 |
++ target[datalength++] = Base64[output[0]]; |
223 |
++ target[datalength++] = Base64[output[1]]; |
224 |
++ if (srclength == 1) |
225 |
++ target[datalength++] = Pad64; |
226 |
++ else |
227 |
++ target[datalength++] = Base64[output[2]]; |
228 |
++ target[datalength++] = Pad64; |
229 |
++ } |
230 |
++ if (datalength >= targsize) |
231 |
++ return (-1); |
232 |
++ target[datalength] = '\0'; /* Returned value doesn't count \0. */ |
233 |
++ return (datalength); |
234 |
++} |
235 |
++ |
236 |
++/* skips all whitespace anywhere. |
237 |
++ converts characters, four at a time, starting at (or after) |
238 |
++ src from base - 64 numbers into three 8 bit bytes in the target area. |
239 |
++ it returns the number of data bytes stored at the target, or -1 on error. |
240 |
++ */ |
241 |
++ |
242 |
++int |
243 |
++b64_pton(src, target, targsize) |
244 |
++ char const *src; |
245 |
++ u_char *target; |
246 |
++ size_t targsize; |
247 |
++{ |
248 |
++ int tarindex, state, ch; |
249 |
++ u_char nextbyte; |
250 |
++ char *pos; |
251 |
++ |
252 |
++ state = 0; |
253 |
++ tarindex = 0; |
254 |
++ |
255 |
++ while ((ch = (unsigned char)*src++) != '\0') { |
256 |
++ if (isspace(ch)) /* Skip whitespace anywhere. */ |
257 |
++ continue; |
258 |
++ |
259 |
++ if (ch == Pad64) |
260 |
++ break; |
261 |
++ |
262 |
++ pos = strchr(Base64, ch); |
263 |
++ if (pos == 0) /* A non-base64 character. */ |
264 |
++ return (-1); |
265 |
++ |
266 |
++ switch (state) { |
267 |
++ case 0: |
268 |
++ if (target) { |
269 |
++ if (tarindex >= targsize) |
270 |
++ return (-1); |
271 |
++ target[tarindex] = (pos - Base64) << 2; |
272 |
++ } |
273 |
++ state = 1; |
274 |
++ break; |
275 |
++ case 1: |
276 |
++ if (target) { |
277 |
++ if (tarindex >= targsize) |
278 |
++ return (-1); |
279 |
++ target[tarindex] |= (pos - Base64) >> 4; |
280 |
++ nextbyte = ((pos - Base64) & 0x0f) << 4; |
281 |
++ if (tarindex + 1 < targsize) |
282 |
++ target[tarindex+1] = nextbyte; |
283 |
++ else if (nextbyte) |
284 |
++ return (-1); |
285 |
++ } |
286 |
++ tarindex++; |
287 |
++ state = 2; |
288 |
++ break; |
289 |
++ case 2: |
290 |
++ if (target) { |
291 |
++ if (tarindex >= targsize) |
292 |
++ return (-1); |
293 |
++ target[tarindex] |= (pos - Base64) >> 2; |
294 |
++ nextbyte = ((pos - Base64) & 0x03) << 6; |
295 |
++ if (tarindex + 1 < targsize) |
296 |
++ target[tarindex+1] = nextbyte; |
297 |
++ else if (nextbyte) |
298 |
++ return (-1); |
299 |
++ } |
300 |
++ tarindex++; |
301 |
++ state = 3; |
302 |
++ break; |
303 |
++ case 3: |
304 |
++ if (target) { |
305 |
++ if (tarindex >= targsize) |
306 |
++ return (-1); |
307 |
++ target[tarindex] |= (pos - Base64); |
308 |
++ } |
309 |
++ tarindex++; |
310 |
++ state = 0; |
311 |
++ break; |
312 |
++ } |
313 |
++ } |
314 |
++ |
315 |
++ /* |
316 |
++ * We are done decoding Base-64 chars. Let's see if we ended |
317 |
++ * on a byte boundary, and/or with erroneous trailing characters. |
318 |
++ */ |
319 |
++ |
320 |
++ if (ch == Pad64) { /* We got a pad char. */ |
321 |
++ ch = (unsigned char)*src++; /* Skip it, get next. */ |
322 |
++ switch (state) { |
323 |
++ case 0: /* Invalid = in first position */ |
324 |
++ case 1: /* Invalid = in second position */ |
325 |
++ return (-1); |
326 |
++ |
327 |
++ case 2: /* Valid, means one byte of info */ |
328 |
++ /* Skip any number of spaces. */ |
329 |
++ for (; ch != '\0'; ch = (unsigned char)*src++) |
330 |
++ if (!isspace(ch)) |
331 |
++ break; |
332 |
++ /* Make sure there is another trailing = sign. */ |
333 |
++ if (ch != Pad64) |
334 |
++ return (-1); |
335 |
++ ch = (unsigned char)*src++; /* Skip the = */ |
336 |
++ /* Fall through to "single trailing =" case. */ |
337 |
++ /* FALLTHROUGH */ |
338 |
++ |
339 |
++ case 3: /* Valid, means two bytes of info */ |
340 |
++ /* |
341 |
++ * We know this char is an =. Is there anything but |
342 |
++ * whitespace after it? |
343 |
++ */ |
344 |
++ for (; ch != '\0'; ch = (unsigned char)*src++) |
345 |
++ if (!isspace(ch)) |
346 |
++ return (-1); |
347 |
++ |
348 |
++ /* |
349 |
++ * Now make sure for cases 2 and 3 that the "extra" |
350 |
++ * bits that slopped past the last full byte were |
351 |
++ * zeros. If we don't check them, they become a |
352 |
++ * subliminal channel. |
353 |
++ */ |
354 |
++ if (target && tarindex < targsize && |
355 |
++ target[tarindex] != 0) |
356 |
++ return (-1); |
357 |
++ } |
358 |
++ } else { |
359 |
++ /* |
360 |
++ * We ended by seeing the end of the string. Make sure we |
361 |
++ * have no partial bytes lying around. |
362 |
++ */ |
363 |
++ if (state != 0) |
364 |
++ return (-1); |
365 |
++ } |
366 |
++ |
367 |
++ return (tarindex); |
368 |
++} |
369 |
+diff -Naur netcat-openbsd-1.105.orig/compat/base64.h netcat-openbsd-1.105/compat/base64.h |
370 |
+--- netcat-openbsd-1.105.orig/compat/base64.h 1969-12-31 16:00:00.000000000 -0800 |
371 |
++++ netcat-openbsd-1.105/compat/base64.h 2017-06-18 09:09:02.057554167 -0700 |
372 |
+@@ -0,0 +1,3 @@ |
373 |
++#include <sys/types.h> |
374 |
++int b64_ntop(u_char const* src, size_t srclength, char *target, size_t targsize); |
375 |
++int b64_pton(char const* src, u_char *target, size_t targsize); |
376 |
+diff -Naur netcat-openbsd-1.105.orig/socks.c netcat-openbsd-1.105/socks.c |
377 |
+--- netcat-openbsd-1.105.orig/socks.c 2017-06-18 09:01:44.293852659 -0700 |
378 |
++++ netcat-openbsd-1.105/socks.c 2017-06-18 09:09:21.105757665 -0700 |
379 |
+@@ -40,6 +40,7 @@ |
380 |
+ #include <resolv.h> |
381 |
+ #include <bsd/readpassphrase.h> |
382 |
+ #include "atomicio.h" |
383 |
++#include "compat/base64.h" |
384 |
+ |
385 |
+ #define SOCKS_PORT "1080" |
386 |
+ #define HTTP_PROXY_PORT "3128" |
387 |
|
388 |
diff --git a/net-analyzer/openbsd-netcat/files/openbsd-netcat-1.105-darwin.patch b/net-analyzer/openbsd-netcat/files/openbsd-netcat-1.105-darwin.patch |
389 |
new file mode 100644 |
390 |
index 0000000..8c68a66 |
391 |
--- /dev/null |
392 |
+++ b/net-analyzer/openbsd-netcat/files/openbsd-netcat-1.105-darwin.patch |
393 |
@@ -0,0 +1,86 @@ |
394 |
+Allow compilation on Darwin |
395 |
+ |
396 |
+--- netcat.c |
397 |
++++ netcat.c |
398 |
+@@ -43,11 +43,13 @@ |
399 |
+ #include <arpa/telnet.h> |
400 |
+ #include <arpa/inet.h> |
401 |
+ |
402 |
++#ifndef IPTOS_LOWCOST |
403 |
++# define IPTOS_LOWCOST 0x02 |
404 |
++#endif |
405 |
+ #ifndef IPTOS_LOWDELAY |
406 |
+ # define IPTOS_LOWDELAY 0x10 |
407 |
+ # define IPTOS_THROUGHPUT 0x08 |
408 |
+ # define IPTOS_RELIABILITY 0x04 |
409 |
+-# define IPTOS_LOWCOST 0x02 |
410 |
+ # define IPTOS_MINCOST IPTOS_LOWCOST |
411 |
+ #endif /* IPTOS_LOWDELAY */ |
412 |
+ |
413 |
+@@ -96,8 +98,9 @@ |
414 |
+ #include <unistd.h> |
415 |
+ #include <fcntl.h> |
416 |
+ #include <limits.h> |
417 |
+-#include <bsd/stdlib.h> |
418 |
+-#include <bsd/string.h> |
419 |
++#include <stdlib.h> |
420 |
++#include <string.h> |
421 |
++#include <ctype.h> |
422 |
+ #include "atomicio.h" |
423 |
+ |
424 |
+ #ifndef SUN_LEN |
425 |
+@@ -169,6 +172,43 @@ |
426 |
+ socklen_t salen, int ctimeout); |
427 |
+ static void quit(); |
428 |
+ |
429 |
++static char* strtonumerrs[] = { |
430 |
++ "too large", |
431 |
++ "too small", |
432 |
++ "invalid" |
433 |
++}; |
434 |
++ |
435 |
++static long long |
436 |
++strtonum( |
437 |
++ const char *nptr, |
438 |
++ long long minval, |
439 |
++ long long maxval, |
440 |
++ const char **errstr) |
441 |
++{ |
442 |
++ long long val; |
443 |
++ |
444 |
++ while (*nptr != '\0' && isspace(*nptr)) |
445 |
++ nptr++; |
446 |
++ if (*nptr == '\0') { |
447 |
++ if (errstr != NULL) |
448 |
++ *errstr = strtonumerrs[2]; |
449 |
++ return 0; |
450 |
++ } |
451 |
++ val = atoll(nptr); |
452 |
++ if (val < minval) { |
453 |
++ if (errstr != NULL) |
454 |
++ *errstr = strtonumerrs[1]; |
455 |
++ return 0; |
456 |
++ } |
457 |
++ if (val > maxval) { |
458 |
++ if (errstr != NULL) |
459 |
++ *errstr = strtonumerrs[0]; |
460 |
++ return 0; |
461 |
++ } |
462 |
++ *errstr = NULL; |
463 |
++ return val; |
464 |
++} |
465 |
++ |
466 |
+ int |
467 |
+ main(int argc, char *argv[]) |
468 |
+ { |
469 |
+--- socks.c |
470 |
++++ socks.c |
471 |
+@@ -38,7 +38,7 @@ |
472 |
+ #include <string.h> |
473 |
+ #include <unistd.h> |
474 |
+ #include <resolv.h> |
475 |
+-#include <bsd/readpassphrase.h> |
476 |
++#include <readpassphrase.h> |
477 |
+ #include "atomicio.h" |
478 |
+ |
479 |
+ #define SOCKS_PORT "1080" |
480 |
|
481 |
diff --git a/net-analyzer/openbsd-netcat/metadata.xml b/net-analyzer/openbsd-netcat/metadata.xml |
482 |
new file mode 100644 |
483 |
index 0000000..e6b017e |
484 |
--- /dev/null |
485 |
+++ b/net-analyzer/openbsd-netcat/metadata.xml |
486 |
@@ -0,0 +1,11 @@ |
487 |
+<?xml version="1.0" encoding="UTF-8"?> |
488 |
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> |
489 |
+<pkgmetadata> |
490 |
+<maintainer type="person"> |
491 |
+ <email>heroxbd@g.o</email> |
492 |
+ <name>Benda Xu</name> |
493 |
+</maintainer> |
494 |
+<longdescription lang="en"> |
495 |
+ This package provides the openbsd linux port of netcat. |
496 |
+</longdescription> |
497 |
+</pkgmetadata> |
498 |
|
499 |
diff --git a/net-analyzer/openbsd-netcat/openbsd-netcat-1.105-r1.ebuild b/net-analyzer/openbsd-netcat/openbsd-netcat-1.105-r1.ebuild |
500 |
new file mode 100644 |
501 |
index 0000000..4d246ad |
502 |
--- /dev/null |
503 |
+++ b/net-analyzer/openbsd-netcat/openbsd-netcat-1.105-r1.ebuild |
504 |
@@ -0,0 +1,55 @@ |
505 |
+# Copyright 1999-2016 Gentoo Foundation |
506 |
+# Distributed under the terms of the GNU General Public License v2 |
507 |
+ |
508 |
+EAPI=6 |
509 |
+ |
510 |
+inherit toolchain-funcs eutils |
511 |
+ |
512 |
+DESCRIPTION="The OpenBSD network swiss army knife" |
513 |
+HOMEPAGE="http://www.openbsd.org/cgi-bin/cvsweb/src/usr.bin/nc/" |
514 |
+SRC_URI="http://http.debian.net/debian/pool/main/n/netcat-openbsd/netcat-openbsd_${PV}.orig.tar.gz |
515 |
+ http://http.debian.net/debian/pool/main/n/netcat-openbsd/netcat-openbsd_${PV}-7.debian.tar.gz" |
516 |
+LICENSE="BSD" |
517 |
+SLOT="0" |
518 |
+IUSE="elibc_Darwin" |
519 |
+ |
520 |
+KEYWORDS="~amd64 ~x86 ~amd64-linux ~x64-macos" |
521 |
+ |
522 |
+DEPEND="virtual/pkgconfig" |
523 |
+RDEPEND="!elibc_Darwin? ( dev-libs/libbsd ) |
524 |
+ !net-analyzer/netcat |
525 |
+ !net-analyzer/netcat6 |
526 |
+" |
527 |
+ |
528 |
+S=${WORKDIR}/netcat-openbsd-${PV} |
529 |
+ |
530 |
+PATCHES=( "${WORKDIR}/debian/patches" ) |
531 |
+ |
532 |
+src_prepare() { |
533 |
+ default |
534 |
+ if [[ ${CHOST} == *-darwin* ]] ; then |
535 |
+ # this undoes some of the Debian/Linux changes |
536 |
+ epatch "${FILESDIR}"/${P}-darwin.patch |
537 |
+ fi |
538 |
+ use elibc_musl && epatch "${FILESDIR}"/${P}-b64_ntop.patch |
539 |
+} |
540 |
+ |
541 |
+src_compile() { |
542 |
+ emake CC=$(tc-getCC) CFLAGS="${CFLAGS}" LDFLAGS="${LDFLAGS}" || die |
543 |
+} |
544 |
+ |
545 |
+src_install() { |
546 |
+ dobin nc |
547 |
+ doman nc.1 |
548 |
+ cd "${WORKDIR}/debian" |
549 |
+ newdoc netcat-openbsd.README.Debian README |
550 |
+ dodoc -r examples |
551 |
+} |
552 |
+ |
553 |
+pkg_postinst() { |
554 |
+ if [[ ${KERNEL} = "linux" ]]; then |
555 |
+ ewarn "FO_REUSEPORT is introduced in linux 3.9. If your running kernel is older" |
556 |
+ ewarn "and kernel header is newer, nc will not listen correctly. Matching the header" |
557 |
+ ewarn "to the running kernel will do. See bug #490246 for details." |
558 |
+ fi |
559 |
+} |