diff options
author | Alexander M Pickering <alex@cogarr.net> | 2024-11-21 13:46:49 -0600 |
---|---|---|
committer | Alexander M Pickering <alex@cogarr.net> | 2024-11-21 13:46:49 -0600 |
commit | 29ca81d1e6dd3b10370559898f60089b012e94ad (patch) | |
tree | 2d66f20f8a6397f20982cd63cc2f158f0aad9e46 | |
parent | fa9d3193045dac3cd2931241243f6c36ffd6dd38 (diff) | |
download | busybox-w32-packaging-29ca81d1e6dd3b10370559898f60089b012e94ad.tar.gz busybox-w32-packaging-29ca81d1e6dd3b10370559898f60089b012e94ad.tar.bz2 busybox-w32-packaging-29ca81d1e6dd3b10370559898f60089b012e94ad.zip |
Try creating a temp file manually.
-rw-r--r-- | libressl.patch | 33 |
1 files changed, 20 insertions, 13 deletions
diff --git a/libressl.patch b/libressl.patch index d86d449..037d989 100644 --- a/libressl.patch +++ b/libressl.patch | |||
@@ -102,7 +102,7 @@ index 9f1dd67ec..60e1afe99 100644 | |||
102 | static void tls_xwrite(tls_state_t *tls, int len) | 102 | static void tls_xwrite(tls_state_t *tls, int len) |
103 | { | 103 | { |
104 | diff --git a/networking/wget.c b/networking/wget.c | 104 | diff --git a/networking/wget.c b/networking/wget.c |
105 | index 6a64836fb..7c68435c0 100644 | 105 | index 6a64836fb..21b8ce649 100644 |
106 | --- a/networking/wget.c | 106 | --- a/networking/wget.c |
107 | +++ b/networking/wget.c | 107 | +++ b/networking/wget.c |
108 | @@ -1,4 +1,3 @@ | 108 | @@ -1,4 +1,3 @@ |
@@ -120,7 +120,7 @@ index 6a64836fb..7c68435c0 100644 | |||
120 | #if ENABLE_FEATURE_WGET_TIMEOUT | 120 | #if ENABLE_FEATURE_WGET_TIMEOUT |
121 | unsigned timeout_seconds; | 121 | unsigned timeout_seconds; |
122 | smallint die_if_timed_out; | 122 | smallint die_if_timed_out; |
123 | @@ -460,6 +462,59 @@ static FILE *open_socket(len_and_sockaddr *lsa) | 123 | @@ -460,6 +462,66 @@ static FILE *open_socket(len_and_sockaddr *lsa) |
124 | return fp; | 124 | return fp; |
125 | } | 125 | } |
126 | 126 | ||
@@ -135,7 +135,13 @@ index 6a64836fb..7c68435c0 100644 | |||
135 | +char* gather_certificates(struct tls_config *cfg) | 135 | +char* gather_certificates(struct tls_config *cfg) |
136 | +{ | 136 | +{ |
137 | + FILE *pemfile; | 137 | + FILE *pemfile; |
138 | + /* | ||
138 | + pemfile = tmpfile(); | 139 | + pemfile = tmpfile(); |
140 | + */ | ||
141 | + char *tmpfilename = tmpnam(NULL); | ||
142 | + if(tmpfilename == NULL) | ||
143 | + bb_error_msg_and_die("Failed to get a temp file name."); | ||
144 | + pemfile = fopen(tmpfilename, "w+"); | ||
139 | + if(pemfile == NULL) | 145 | + if(pemfile == NULL) |
140 | + bb_error_msg_and_die("Failed to open pem tempfile: %s", strerror(errno)); | 146 | + bb_error_msg_and_die("Failed to open pem tempfile: %s", strerror(errno)); |
141 | + HCERTSTORE dstore; | 147 | + HCERTSTORE dstore; |
@@ -174,13 +180,14 @@ index 6a64836fb..7c68435c0 100644 | |||
174 | + bb_error_msg_and_die("Failed to read temp ca pem file"); | 180 | + bb_error_msg_and_die("Failed to read temp ca pem file"); |
175 | + tls_config_set_ca_mem(cfg, pemmem, pemsize); | 181 | + tls_config_set_ca_mem(cfg, pemmem, pemsize); |
176 | + fclose(pemfile); | 182 | + fclose(pemfile); |
183 | + DeleteFile(tmpfilename); | ||
177 | +} | 184 | +} |
178 | +#endif | 185 | +#endif |
179 | + | 186 | + |
180 | /* We balk at any control chars in other side's messages. | 187 | /* We balk at any control chars in other side's messages. |
181 | * This prevents nasty surprises (e.g. ESC sequences) in "Location:" URLs | 188 | * This prevents nasty surprises (e.g. ESC sequences) in "Location:" URLs |
182 | * and error messages. | 189 | * and error messages. |
183 | @@ -689,6 +744,7 @@ static void reset_beg_range_to_zero(void) | 190 | @@ -689,6 +751,7 @@ static void reset_beg_range_to_zero(void) |
184 | } | 191 | } |
185 | 192 | ||
186 | #if ENABLE_FEATURE_WGET_OPENSSL | 193 | #if ENABLE_FEATURE_WGET_OPENSSL |
@@ -188,7 +195,7 @@ index 6a64836fb..7c68435c0 100644 | |||
188 | static int spawn_https_helper_openssl(const char *host, unsigned port) | 195 | static int spawn_https_helper_openssl(const char *host, unsigned port) |
189 | { | 196 | { |
190 | char *allocated = NULL; | 197 | char *allocated = NULL; |
191 | @@ -698,7 +754,7 @@ static int spawn_https_helper_openssl(const char *host, unsigned port) | 198 | @@ -698,7 +761,7 @@ static int spawn_https_helper_openssl(const char *host, unsigned port) |
192 | IF_FEATURE_WGET_HTTPS(volatile int child_failed = 0;) | 199 | IF_FEATURE_WGET_HTTPS(volatile int child_failed = 0;) |
193 | 200 | ||
194 | if (socketpair(AF_UNIX, SOCK_STREAM, 0, sp) != 0) | 201 | if (socketpair(AF_UNIX, SOCK_STREAM, 0, sp) != 0) |
@@ -197,7 +204,7 @@ index 6a64836fb..7c68435c0 100644 | |||
197 | bb_simple_perror_msg_and_die("socketpair"); | 204 | bb_simple_perror_msg_and_die("socketpair"); |
198 | 205 | ||
199 | if (!strchr(host, ':')) | 206 | if (!strchr(host, ':')) |
200 | @@ -709,18 +765,18 @@ static int spawn_https_helper_openssl(const char *host, unsigned port) | 207 | @@ -709,18 +772,18 @@ static int spawn_https_helper_openssl(const char *host, unsigned port) |
201 | fflush_all(); | 208 | fflush_all(); |
202 | pid = xvfork(); | 209 | pid = xvfork(); |
203 | if (pid == 0) { | 210 | if (pid == 0) { |
@@ -222,7 +229,7 @@ index 6a64836fb..7c68435c0 100644 | |||
222 | xmove_fd(2, 3); | 229 | xmove_fd(2, 3); |
223 | xopen("/dev/null", O_RDWR); | 230 | xopen("/dev/null", O_RDWR); |
224 | memset(&argv, 0, sizeof(argv)); | 231 | memset(&argv, 0, sizeof(argv)); |
225 | @@ -729,18 +785,18 @@ static int spawn_https_helper_openssl(const char *host, unsigned port) | 232 | @@ -729,18 +792,18 @@ static int spawn_https_helper_openssl(const char *host, unsigned port) |
226 | argv[2] = (char*)"-quiet"; | 233 | argv[2] = (char*)"-quiet"; |
227 | argv[3] = (char*)"-connect"; | 234 | argv[3] = (char*)"-connect"; |
228 | argv[4] = (char*)host; | 235 | argv[4] = (char*)host; |
@@ -247,7 +254,7 @@ index 6a64836fb..7c68435c0 100644 | |||
247 | *argp++ = (char*)"-verify"; //[7] | 254 | *argp++ = (char*)"-verify"; //[7] |
248 | *argp++ = (char*)"100"; //[8] | 255 | *argp++ = (char*)"100"; //[8] |
249 | *argp++ = (char*)"-verify_return_error"; //[9] | 256 | *argp++ = (char*)"-verify_return_error"; //[9] |
250 | @@ -762,10 +818,10 @@ static int spawn_https_helper_openssl(const char *host, unsigned port) | 257 | @@ -762,10 +825,10 @@ static int spawn_https_helper_openssl(const char *host, unsigned port) |
251 | # else | 258 | # else |
252 | bb_perror_msg_and_die("can't execute '%s'", argv[0]); | 259 | bb_perror_msg_and_die("can't execute '%s'", argv[0]); |
253 | # endif | 260 | # endif |
@@ -260,7 +267,7 @@ index 6a64836fb..7c68435c0 100644 | |||
260 | free(servername); | 267 | free(servername); |
261 | free(allocated); | 268 | free(allocated); |
262 | close(sp[1]); | 269 | close(sp[1]); |
263 | @@ -777,6 +833,7 @@ static int spawn_https_helper_openssl(const char *host, unsigned port) | 270 | @@ -777,6 +840,7 @@ static int spawn_https_helper_openssl(const char *host, unsigned port) |
264 | # endif | 271 | # endif |
265 | return sp[0]; | 272 | return sp[0]; |
266 | } | 273 | } |
@@ -268,7 +275,7 @@ index 6a64836fb..7c68435c0 100644 | |||
268 | #endif | 275 | #endif |
269 | 276 | ||
270 | #if ENABLE_FEATURE_WGET_HTTPS | 277 | #if ENABLE_FEATURE_WGET_HTTPS |
271 | @@ -1151,6 +1208,9 @@ static void download_one_url(const char *url) | 278 | @@ -1151,6 +1215,9 @@ static void download_one_url(const char *url) |
272 | server.user = NULL; | 279 | server.user = NULL; |
273 | target.user = NULL; | 280 | target.user = NULL; |
274 | 281 | ||
@@ -278,7 +285,7 @@ index 6a64836fb..7c68435c0 100644 | |||
278 | parse_url(url, &target); | 285 | parse_url(url, &target); |
279 | 286 | ||
280 | /* Use the proxy if necessary */ | 287 | /* Use the proxy if necessary */ |
281 | @@ -1234,22 +1294,39 @@ static void download_one_url(const char *url) | 288 | @@ -1234,22 +1301,39 @@ static void download_one_url(const char *url) |
282 | /* openssl-based helper | 289 | /* openssl-based helper |
283 | * Inconvenient API since we can't give it an open fd | 290 | * Inconvenient API since we can't give it an open fd |
284 | */ | 291 | */ |
@@ -328,7 +335,7 @@ index 6a64836fb..7c68435c0 100644 | |||
328 | socket_opened: | 335 | socket_opened: |
329 | #elif ENABLE_FEATURE_WGET_HTTPS | 336 | #elif ENABLE_FEATURE_WGET_HTTPS |
330 | /* Only internal TLS support is configured */ | 337 | /* Only internal TLS support is configured */ |
331 | @@ -1353,7 +1430,39 @@ static void download_one_url(const char *url) | 338 | @@ -1353,7 +1437,39 @@ static void download_one_url(const char *url) |
332 | shutdown(fileno(sfp), SHUT_WR); | 339 | shutdown(fileno(sfp), SHUT_WR); |
333 | } | 340 | } |
334 | #endif | 341 | #endif |
@@ -369,7 +376,7 @@ index 6a64836fb..7c68435c0 100644 | |||
369 | /* | 376 | /* |
370 | * Retrieve HTTP response line and check for "200" status code. | 377 | * Retrieve HTTP response line and check for "200" status code. |
371 | */ | 378 | */ |
372 | @@ -1536,6 +1645,8 @@ However, in real world it was observed that some web servers | 379 | @@ -1536,6 +1652,8 @@ However, in real world it was observed that some web servers |
373 | /* ftpcmd("QUIT", NULL, sfp); - why bother? */ | 380 | /* ftpcmd("QUIT", NULL, sfp); - why bother? */ |
374 | } | 381 | } |
375 | #endif | 382 | #endif |
@@ -378,7 +385,7 @@ index 6a64836fb..7c68435c0 100644 | |||
378 | fclose(sfp); | 385 | fclose(sfp); |
379 | 386 | ||
380 | free(server.allocated); | 387 | free(server.allocated); |
381 | @@ -1691,9 +1802,17 @@ IF_DESKTOP( "no-parent\0" No_argument "\xf0") | 388 | @@ -1691,9 +1809,17 @@ IF_DESKTOP( "no-parent\0" No_argument "\xf0") |
382 | } | 389 | } |
383 | } | 390 | } |
384 | 391 | ||