tangled
alpha
login
or
join now
tjh.dev
/
nixpkgs
Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
0
fork
atom
overview
issues
pulls
pipelines
tcp-wrappers: patch up crufty code, fix w/musl
Will Dietz
7 years ago
40be5dd2
092a4fff
+334
3 changed files
expand all
collapse all
unified
split
pkgs
os-specific
linux
tcp-wrappers
cdecls.patch
default.nix
tcp-wrappers-7.6-headers.patch
+31
pkgs/os-specific/linux/tcp-wrappers/cdecls.patch
···
1
1
+
__BEGIN_DECLS/__END_DECLS are BSD specific and not defined in musl
2
2
+
glibc and uclibc had sys/cdefs.h doing it.
3
3
+
4
4
+
Upstream-Status: Pending
5
5
+
Signed-off-by: Khem Raj <raj.khem@gmail.com>
6
6
+
7
7
+
Index: tcp_wrappers_7.6/tcpd.h
8
8
+
===================================================================
9
9
+
--- tcp_wrappers_7.6.orig/tcpd.h
10
10
+
+++ tcp_wrappers_7.6/tcpd.h
11
11
+
@@ -11,7 +11,9 @@
12
12
+
#include <netinet/in.h>
13
13
+
#include <stdio.h>
14
14
+
15
15
+
-__BEGIN_DECLS
16
16
+
+#ifdef __cplusplus
17
17
+
+extern "C" {
18
18
+
+#endif
19
19
+
20
20
+
/* Structure to describe one communications endpoint. */
21
21
+
22
22
+
@@ -252,6 +254,8 @@ extern char *fix_strtok();
23
23
+
extern char *my_strtok();
24
24
+
#endif
25
25
+
26
26
+
-__END_DECLS
27
27
+
+#ifdef __cplusplus
28
28
+
+}
29
29
+
+#endif
30
30
+
31
31
+
#endif
+8
pkgs/os-specific/linux/tcp-wrappers/default.nix
···
25
25
substituteInPlace debian/patches/13_shlib_weaksym --replace STRINGS STRINGDEFS
26
26
'';
27
27
28
28
+
# Fix __BEGIN_DECLS usage (even if it wasn't non-standard, this doesn't include sys/cdefs.h)
29
29
+
patches = [ ./cdecls.patch ];
30
30
+
31
31
+
postPatch = stdenv.lib.optionalString stdenv.hostPlatform.isMusl ''
32
32
+
substituteInPlace Makefile \
33
33
+
--replace '-DNETGROUP' '-DUSE_GETDOMAIN'
34
34
+
'';
35
35
+
28
36
buildInputs = [ libnsl ];
29
37
30
38
makeFlags = [ "REAL_DAEMON_DIR=$(out)/bin" "linux" ];
+295
pkgs/os-specific/linux/tcp-wrappers/tcp-wrappers-7.6-headers.patch
···
1
1
+
--- a/options.c
2
2
+
+++ b/options.c
3
3
+
@@ -34,6 +34,8 @@
4
4
+
5
5
+
/* System libraries. */
6
6
+
7
7
+
+#include <unistd.h>
8
8
+
+#include <stdlib.h>
9
9
+
#include <sys/types.h>
10
10
+
#include <sys/param.h>
11
11
+
#include <sys/socket.h>
12
12
+
--- a/safe_finger.c
13
13
+
+++ b/safe_finger.c
14
14
+
@@ -20,6 +20,11 @@
15
15
+
16
16
+
/* System libraries */
17
17
+
18
18
+
+#include <unistd.h>
19
19
+
+#include <fcntl.h>
20
20
+
+#include <stdlib.h>
21
21
+
+#include <sys/wait.h>
22
22
+
+#include <grp.h>
23
23
+
#include <sys/types.h>
24
24
+
#include <sys/stat.h>
25
25
+
#include <signal.h>
26
26
+
@@ -27,7 +31,7 @@
27
27
+
#include <ctype.h>
28
28
+
#include <pwd.h>
29
29
+
30
30
+
-extern void exit();
31
31
+
+int pipe_stdin(char **argv);
32
32
+
33
33
+
/* Local stuff */
34
34
+
35
35
+
--- a/scaffold.c
36
36
+
+++ b/scaffold.c
37
37
+
@@ -10,6 +10,7 @@
38
38
+
39
39
+
/* System libraries. */
40
40
+
41
41
+
+#include <stdlib.h>
42
42
+
#include <sys/types.h>
43
43
+
#include <sys/stat.h>
44
44
+
#include <sys/socket.h>
45
45
+
@@ -27,7 +27,4 @@
46
46
+
#endif
47
47
+
48
48
+
-#ifndef INET6
49
49
+
-extern char *malloc();
50
50
+
-#endif
51
51
+
52
52
+
/* Application-specific. */
53
53
+
--- a/shell_cmd.c
54
54
+
+++ b/shell_cmd.c
55
55
+
@@ -14,6 +14,10 @@
56
56
+
57
57
+
/* System libraries. */
58
58
+
59
59
+
+#include <unistd.h>
60
60
+
+#include <stdlib.h>
61
61
+
+#include <fcntl.h>
62
62
+
+#include <sys/wait.h>
63
63
+
#include <sys/types.h>
64
64
+
#include <sys/param.h>
65
65
+
#include <signal.h>
66
66
+
@@ -25,8 +25,6 @@
67
67
+
#include <syslog.h>
68
68
+
#include <string.h>
69
69
+
70
70
+
-extern void exit();
71
71
+
-
72
72
+
/* Local stuff. */
73
73
+
74
74
+
#include "tcpd.h"
75
75
+
--- a/tcpdchk.c
76
76
+
+++ b/tcpdchk.c
77
77
+
@@ -20,6 +20,8 @@
78
78
+
79
79
+
/* System libraries. */
80
80
+
81
81
+
+#include <unistd.h>
82
82
+
+#include <stdlib.h>
83
83
+
#include <sys/types.h>
84
84
+
#include <sys/stat.h>
85
85
+
#ifdef INET6
86
86
+
@@ -35,10 +36,7 @@
87
87
+
#include <netdb.h>
88
88
+
#include <string.h>
89
89
+
90
90
+
-extern int errno;
91
91
+
-extern void exit();
92
92
+
-extern int optind;
93
93
+
-extern char *optarg;
94
94
+
+int cidr_mask_addr(char *str);
95
95
+
96
96
+
#ifndef INADDR_NONE
97
97
+
#define INADDR_NONE (-1) /* XXX should be 0xffffffff */
98
98
+
--- a/clean_exit.c
99
99
+
+++ b/clean_exit.c
100
100
+
@@ -13,8 +13,8 @@
101
101
+
#endif
102
102
+
103
103
+
#include <stdio.h>
104
104
+
-
105
105
+
-extern void exit();
106
106
+
+#include <unistd.h>
107
107
+
+#include <stdlib.h>
108
108
+
109
109
+
#include "tcpd.h"
110
110
+
111
111
+
--- a/hosts_access.c
112
112
+
+++ b/hosts_access.c
113
113
+
@@ -23,6 +23,7 @@
114
114
+
115
115
+
/* System libraries. */
116
116
+
117
117
+
+#include <stdlib.h>
118
118
+
#include <sys/types.h>
119
119
+
#ifdef INT32_T
120
120
+
typedef uint32_t u_int32_t;
121
121
+
@@ -43,8 +44,8 @@
122
122
+
#include <netdb.h>
123
123
+
#endif
124
124
+
125
125
+
-extern char *fgets();
126
126
+
-extern int errno;
127
127
+
+static int match_pattern_ylo(const char *s, const char *pattern);
128
128
+
+int cidr_mask_addr(char *str);
129
129
+
130
130
+
#ifndef INADDR_NONE
131
131
+
#define INADDR_NONE (-1) /* XXX should be 0xffffffff */
132
132
+
--- a/inetcf.c
133
133
+
+++ b/inetcf.c
134
134
+
@@ -9,15 +9,14 @@
135
135
+
static char sccsid[] = "@(#) inetcf.c 1.7 97/02/12 02:13:23";
136
136
+
#endif
137
137
+
138
138
+
+#include <stdlib.h>
139
139
+
#include <sys/types.h>
140
140
+
#include <sys/stat.h>
141
141
+
#include <stdio.h>
142
142
+
#include <errno.h>
143
143
+
#include <string.h>
144
144
+
145
145
+
-extern int errno;
146
146
+
-extern void exit();
147
147
+
-
148
148
+
+#include "scaffold.h"
149
149
+
#include "tcpd.h"
150
150
+
#include "inetcf.h"
151
151
+
152
152
+
--- a/percent_x.c
153
153
+
+++ b/percent_x.c
154
154
+
@@ -16,12 +16,12 @@
155
155
+
156
156
+
/* System libraries. */
157
157
+
158
158
+
+#include <unistd.h>
159
159
+
+#include <stdlib.h>
160
160
+
#include <stdio.h>
161
161
+
#include <syslog.h>
162
162
+
#include <string.h>
163
163
+
164
164
+
-extern void exit();
165
165
+
-
166
166
+
/* Local stuff. */
167
167
+
168
168
+
#include "tcpd.h"
169
169
+
--- a/rfc931.c
170
170
+
+++ b/rfc931.c
171
171
+
@@ -15,6 +15,7 @@
172
172
+
173
173
+
/* System libraries. */
174
174
+
175
175
+
+#include <unistd.h>
176
176
+
#include <stdio.h>
177
177
+
#include <syslog.h>
178
178
+
#include <sys/types.h>
179
179
+
--- a/tcpd.c
180
180
+
+++ b/tcpd.c
181
181
+
@@ -16,6 +16,7 @@
182
182
+
183
183
+
/* System libraries. */
184
184
+
185
185
+
+#include <unistd.h>
186
186
+
#include <sys/types.h>
187
187
+
#include <sys/param.h>
188
188
+
#include <sys/stat.h>
189
189
+
@@ -39,6 +39,8 @@
190
190
+
#include "patchlevel.h"
191
191
+
#include "tcpd.h"
192
192
+
193
193
+
+void fix_options(struct request_info *request);
194
194
+
+
195
195
+
int allow_severity = SEVERITY; /* run-time adjustable */
196
196
+
int deny_severity = LOG_WARNING; /* ditto */
197
197
+
198
198
+
--- a/tcpdmatch.c
199
199
+
+++ b/tcpdmatch.c
200
200
+
@@ -19,6 +19,8 @@
201
201
+
202
202
+
/* System libraries. */
203
203
+
204
204
+
+#include <unistd.h>
205
205
+
+#include <stdlib.h>
206
206
+
#include <sys/types.h>
207
207
+
#include <sys/stat.h>
208
208
+
#include <sys/socket.h>
209
209
+
@@ -30,9 +32,6 @@
210
210
+
#include <setjmp.h>
211
211
+
#include <string.h>
212
212
+
213
213
+
-extern void exit();
214
214
+
-extern int optind;
215
215
+
-extern char *optarg;
216
216
+
217
217
+
#ifndef INADDR_NONE
218
218
+
#define INADDR_NONE (-1) /* XXX should be 0xffffffff */
219
219
+
--- a/update.c
220
220
+
+++ b/update.c
221
221
+
@@ -19,6 +19,7 @@
222
222
+
223
223
+
/* System libraries */
224
224
+
225
225
+
+#include <unistd.h>
226
226
+
#include <stdio.h>
227
227
+
#include <syslog.h>
228
228
+
#include <string.h>
229
229
+
--- a/misc.c
230
230
+
+++ b/misc.c
231
231
+
@@ -14,11 +14,10 @@
232
232
+
#include <arpa/inet.h>
233
233
+
#include <stdio.h>
234
234
+
#include <string.h>
235
235
+
+#include <stdlib.h>
236
236
+
237
237
+
#include "tcpd.h"
238
238
+
239
239
+
-extern char *fgets();
240
240
+
-
241
241
+
#ifndef INADDR_NONE
242
242
+
#define INADDR_NONE (-1) /* XXX should be 0xffffffff */
243
243
+
#endif
244
244
+
--- a/fix_options.c
245
245
+
+++ b/fix_options.c
246
246
+
@@ -32,6 +32,7 @@
247
247
+
248
248
+
/* fix_options - get rid of IP-level socket options */
249
249
+
250
250
+
+void
251
251
+
fix_options(request)
252
252
+
struct request_info *request;
253
253
+
{
254
254
+
@@ -38,11 +38,8 @@
255
255
+
#ifdef IP_OPTIONS
256
256
+
unsigned char optbuf[BUFFER_SIZE / 3], *cp;
257
257
+
char lbuf[BUFFER_SIZE], *lp;
258
258
+
-#ifdef __GLIBC__
259
259
+
- size_t optsize = sizeof(optbuf), ipproto;
260
260
+
-#else
261
261
+
- int optsize = sizeof(optbuf), ipproto;
262
262
+
-#endif
263
263
+
+ socklen_t optsize = sizeof(optbuf);
264
264
+
+ int ipproto;
265
265
+
struct protoent *ip;
266
266
+
int fd = request->fd;
267
267
+
unsigned int opt;
268
268
+
--- a/socket.c
269
269
+
+++ b/socket.c
270
270
+
@@ -95,11 +95,7 @@
271
271
+
static struct sockaddr_in client;
272
272
+
static struct sockaddr_in server;
273
273
+
#endif
274
274
+
-#ifdef __GLIBC__
275
275
+
- size_t len;
276
276
+
-#else
277
277
+
- int len;
278
278
+
-#endif
279
279
+
+ socklen_t len;
280
280
+
char buf[BUFSIZ];
281
281
+
int fd = request->fd;
282
282
+
283
283
+
@@ -430,11 +426,7 @@
284
284
+
#else
285
285
+
struct sockaddr_in sin;
286
286
+
#endif
287
287
+
-#ifdef __GLIBC__
288
288
+
- size_t size = sizeof(sin);
289
289
+
-#else
290
290
+
- int size = sizeof(sin);
291
291
+
-#endif
292
292
+
+ socklen_t size;
293
293
+
294
294
+
/*
295
295
+
* Eat up the not-yet received datagram. Some systems insist on a