Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)

tcp-wrappers: patch up crufty code, fix w/musl

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