diff options
| author | Alexander M Pickering <alex@cogarr.net> | 2024-11-21 14:09:58 -0600 |
|---|---|---|
| committer | Alexander M Pickering <alex@cogarr.net> | 2024-11-21 14:09:58 -0600 |
| commit | 60e60b6ec1d676bca69a40a0470eae42a5cf26bf (patch) | |
| tree | 94ab63fb1c5ddfdeff33434288fcdf55ef3973fd | |
| parent | 29ca81d1e6dd3b10370559898f60089b012e94ad (diff) | |
| download | busybox-w32-packaging-60e60b6ec1d676bca69a40a0470eae42a5cf26bf.tar.gz busybox-w32-packaging-60e60b6ec1d676bca69a40a0470eae42a5cf26bf.tar.bz2 busybox-w32-packaging-60e60b6ec1d676bca69a40a0470eae42a5cf26bf.zip | |
use the ansi version of deletefile
| -rw-r--r-- | libressl.patch | 43 |
1 files changed, 27 insertions, 16 deletions
diff --git a/libressl.patch b/libressl.patch index 037d989..950e48e 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..21b8ce649 100644 | 105 | index 6a64836fb..0a9f364e0 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..21b8ce649 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,66 @@ static FILE *open_socket(len_and_sockaddr *lsa) | 123 | @@ -460,6 +462,67 @@ static FILE *open_socket(len_and_sockaddr *lsa) |
| 124 | return fp; | 124 | return fp; |
| 125 | } | 125 | } |
| 126 | 126 | ||
| @@ -132,6 +132,7 @@ index 6a64836fb..21b8ce649 100644 | |||
| 132 | +#include <tls.h> | 132 | +#include <tls.h> |
| 133 | +#include <winsock2.h> | 133 | +#include <winsock2.h> |
| 134 | +#include <windows.h> | 134 | +#include <windows.h> |
| 135 | +#include <fileapi.h> | ||
| 135 | +char* gather_certificates(struct tls_config *cfg) | 136 | +char* gather_certificates(struct tls_config *cfg) |
| 136 | +{ | 137 | +{ |
| 137 | + FILE *pemfile; | 138 | + FILE *pemfile; |
| @@ -180,14 +181,14 @@ index 6a64836fb..21b8ce649 100644 | |||
| 180 | + bb_error_msg_and_die("Failed to read temp ca pem file"); | 181 | + bb_error_msg_and_die("Failed to read temp ca pem file"); |
| 181 | + tls_config_set_ca_mem(cfg, pemmem, pemsize); | 182 | + tls_config_set_ca_mem(cfg, pemmem, pemsize); |
| 182 | + fclose(pemfile); | 183 | + fclose(pemfile); |
| 183 | + DeleteFile(tmpfilename); | 184 | + DeleteFileA(tmpfilename); |
| 184 | +} | 185 | +} |
| 185 | +#endif | 186 | +#endif |
| 186 | + | 187 | + |
| 187 | /* We balk at any control chars in other side's messages. | 188 | /* We balk at any control chars in other side's messages. |
| 188 | * This prevents nasty surprises (e.g. ESC sequences) in "Location:" URLs | 189 | * This prevents nasty surprises (e.g. ESC sequences) in "Location:" URLs |
| 189 | * and error messages. | 190 | * and error messages. |
| 190 | @@ -689,6 +751,7 @@ static void reset_beg_range_to_zero(void) | 191 | @@ -689,6 +752,7 @@ static void reset_beg_range_to_zero(void) |
| 191 | } | 192 | } |
| 192 | 193 | ||
| 193 | #if ENABLE_FEATURE_WGET_OPENSSL | 194 | #if ENABLE_FEATURE_WGET_OPENSSL |
| @@ -195,7 +196,7 @@ index 6a64836fb..21b8ce649 100644 | |||
| 195 | static int spawn_https_helper_openssl(const char *host, unsigned port) | 196 | static int spawn_https_helper_openssl(const char *host, unsigned port) |
| 196 | { | 197 | { |
| 197 | char *allocated = NULL; | 198 | char *allocated = NULL; |
| 198 | @@ -698,7 +761,7 @@ static int spawn_https_helper_openssl(const char *host, unsigned port) | 199 | @@ -698,7 +762,7 @@ static int spawn_https_helper_openssl(const char *host, unsigned port) |
| 199 | IF_FEATURE_WGET_HTTPS(volatile int child_failed = 0;) | 200 | IF_FEATURE_WGET_HTTPS(volatile int child_failed = 0;) |
| 200 | 201 | ||
| 201 | if (socketpair(AF_UNIX, SOCK_STREAM, 0, sp) != 0) | 202 | if (socketpair(AF_UNIX, SOCK_STREAM, 0, sp) != 0) |
| @@ -204,7 +205,7 @@ index 6a64836fb..21b8ce649 100644 | |||
| 204 | bb_simple_perror_msg_and_die("socketpair"); | 205 | bb_simple_perror_msg_and_die("socketpair"); |
| 205 | 206 | ||
| 206 | if (!strchr(host, ':')) | 207 | if (!strchr(host, ':')) |
| 207 | @@ -709,18 +772,18 @@ static int spawn_https_helper_openssl(const char *host, unsigned port) | 208 | @@ -709,18 +773,18 @@ static int spawn_https_helper_openssl(const char *host, unsigned port) |
| 208 | fflush_all(); | 209 | fflush_all(); |
| 209 | pid = xvfork(); | 210 | pid = xvfork(); |
| 210 | if (pid == 0) { | 211 | if (pid == 0) { |
| @@ -229,7 +230,7 @@ index 6a64836fb..21b8ce649 100644 | |||
| 229 | xmove_fd(2, 3); | 230 | xmove_fd(2, 3); |
| 230 | xopen("/dev/null", O_RDWR); | 231 | xopen("/dev/null", O_RDWR); |
| 231 | memset(&argv, 0, sizeof(argv)); | 232 | memset(&argv, 0, sizeof(argv)); |
| 232 | @@ -729,18 +792,18 @@ static int spawn_https_helper_openssl(const char *host, unsigned port) | 233 | @@ -729,18 +793,18 @@ static int spawn_https_helper_openssl(const char *host, unsigned port) |
| 233 | argv[2] = (char*)"-quiet"; | 234 | argv[2] = (char*)"-quiet"; |
| 234 | argv[3] = (char*)"-connect"; | 235 | argv[3] = (char*)"-connect"; |
| 235 | argv[4] = (char*)host; | 236 | argv[4] = (char*)host; |
| @@ -254,7 +255,7 @@ index 6a64836fb..21b8ce649 100644 | |||
| 254 | *argp++ = (char*)"-verify"; //[7] | 255 | *argp++ = (char*)"-verify"; //[7] |
| 255 | *argp++ = (char*)"100"; //[8] | 256 | *argp++ = (char*)"100"; //[8] |
| 256 | *argp++ = (char*)"-verify_return_error"; //[9] | 257 | *argp++ = (char*)"-verify_return_error"; //[9] |
| 257 | @@ -762,10 +825,10 @@ static int spawn_https_helper_openssl(const char *host, unsigned port) | 258 | @@ -762,10 +826,10 @@ static int spawn_https_helper_openssl(const char *host, unsigned port) |
| 258 | # else | 259 | # else |
| 259 | bb_perror_msg_and_die("can't execute '%s'", argv[0]); | 260 | bb_perror_msg_and_die("can't execute '%s'", argv[0]); |
| 260 | # endif | 261 | # endif |
| @@ -267,7 +268,7 @@ index 6a64836fb..21b8ce649 100644 | |||
| 267 | free(servername); | 268 | free(servername); |
| 268 | free(allocated); | 269 | free(allocated); |
| 269 | close(sp[1]); | 270 | close(sp[1]); |
| 270 | @@ -777,6 +840,7 @@ static int spawn_https_helper_openssl(const char *host, unsigned port) | 271 | @@ -777,6 +841,7 @@ static int spawn_https_helper_openssl(const char *host, unsigned port) |
| 271 | # endif | 272 | # endif |
| 272 | return sp[0]; | 273 | return sp[0]; |
| 273 | } | 274 | } |
| @@ -275,7 +276,7 @@ index 6a64836fb..21b8ce649 100644 | |||
| 275 | #endif | 276 | #endif |
| 276 | 277 | ||
| 277 | #if ENABLE_FEATURE_WGET_HTTPS | 278 | #if ENABLE_FEATURE_WGET_HTTPS |
| 278 | @@ -1151,6 +1215,9 @@ static void download_one_url(const char *url) | 279 | @@ -1151,6 +1216,9 @@ static void download_one_url(const char *url) |
| 279 | server.user = NULL; | 280 | server.user = NULL; |
| 280 | target.user = NULL; | 281 | target.user = NULL; |
| 281 | 282 | ||
| @@ -285,7 +286,7 @@ index 6a64836fb..21b8ce649 100644 | |||
| 285 | parse_url(url, &target); | 286 | parse_url(url, &target); |
| 286 | 287 | ||
| 287 | /* Use the proxy if necessary */ | 288 | /* Use the proxy if necessary */ |
| 288 | @@ -1234,22 +1301,39 @@ static void download_one_url(const char *url) | 289 | @@ -1234,22 +1302,39 @@ static void download_one_url(const char *url) |
| 289 | /* openssl-based helper | 290 | /* openssl-based helper |
| 290 | * Inconvenient API since we can't give it an open fd | 291 | * Inconvenient API since we can't give it an open fd |
| 291 | */ | 292 | */ |
| @@ -335,7 +336,7 @@ index 6a64836fb..21b8ce649 100644 | |||
| 335 | socket_opened: | 336 | socket_opened: |
| 336 | #elif ENABLE_FEATURE_WGET_HTTPS | 337 | #elif ENABLE_FEATURE_WGET_HTTPS |
| 337 | /* Only internal TLS support is configured */ | 338 | /* Only internal TLS support is configured */ |
| 338 | @@ -1353,7 +1437,39 @@ static void download_one_url(const char *url) | 339 | @@ -1353,7 +1438,39 @@ static void download_one_url(const char *url) |
| 339 | shutdown(fileno(sfp), SHUT_WR); | 340 | shutdown(fileno(sfp), SHUT_WR); |
| 340 | } | 341 | } |
| 341 | #endif | 342 | #endif |
| @@ -376,7 +377,7 @@ index 6a64836fb..21b8ce649 100644 | |||
| 376 | /* | 377 | /* |
| 377 | * Retrieve HTTP response line and check for "200" status code. | 378 | * Retrieve HTTP response line and check for "200" status code. |
| 378 | */ | 379 | */ |
| 379 | @@ -1536,6 +1652,8 @@ However, in real world it was observed that some web servers | 380 | @@ -1536,6 +1653,8 @@ However, in real world it was observed that some web servers |
| 380 | /* ftpcmd("QUIT", NULL, sfp); - why bother? */ | 381 | /* ftpcmd("QUIT", NULL, sfp); - why bother? */ |
| 381 | } | 382 | } |
| 382 | #endif | 383 | #endif |
| @@ -385,15 +386,17 @@ index 6a64836fb..21b8ce649 100644 | |||
| 385 | fclose(sfp); | 386 | fclose(sfp); |
| 386 | 387 | ||
| 387 | free(server.allocated); | 388 | free(server.allocated); |
| 388 | @@ -1691,9 +1809,17 @@ IF_DESKTOP( "no-parent\0" No_argument "\xf0") | 389 | @@ -1690,10 +1809,18 @@ IF_DESKTOP( "no-parent\0" No_argument "\xf0") |
| 390 | xdup2(G.log_fd, STDERR_FILENO); | ||
| 389 | } | 391 | } |
| 390 | } | 392 | } |
| 391 | 393 | - | |
| 394 | + printf("About to config certificates\n"); | ||
| 392 | + G.tlscfg = tls_config_new(); | 395 | + G.tlscfg = tls_config_new(); |
| 393 | + if(G.tlscfg == NULL) | 396 | + if(G.tlscfg == NULL) |
| 394 | + bb_error_msg_and_die("Out of memory 2"); | 397 | + bb_error_msg_and_die("Out of memory 2"); |
| 395 | + char *pemmem = gather_certificates(G.tlscfg); | 398 | + char *pemmem = gather_certificates(G.tlscfg); |
| 396 | + | 399 | + print("Got to downloading section\n"); |
| 397 | while (*argv) | 400 | while (*argv) |
| 398 | download_one_url(*argv++); | 401 | download_one_url(*argv++); |
| 399 | 402 | ||
| @@ -403,6 +406,14 @@ index 6a64836fb..21b8ce649 100644 | |||
| 403 | if (G.output_fd >= 0) | 406 | if (G.output_fd >= 0) |
| 404 | xclose(G.output_fd); | 407 | xclose(G.output_fd); |
| 405 | 408 | ||
| 409 | @@ -1704,6 +1831,6 @@ IF_DESKTOP( "no-parent\0" No_argument "\xf0") | ||
| 410 | free(G.extra_headers); | ||
| 411 | #endif | ||
| 412 | FINI_G(); | ||
| 413 | - | ||
| 414 | + printf("Exiting normally\n"); | ||
| 415 | return EXIT_SUCCESS; | ||
| 416 | } | ||
| 406 | diff --git a/scripts/trylink b/scripts/trylink | 417 | diff --git a/scripts/trylink b/scripts/trylink |
| 407 | index 2456252a3..6186284f1 100755 | 418 | index 2456252a3..6186284f1 100755 |
| 408 | --- a/scripts/trylink | 419 | --- a/scripts/trylink |
