summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander M Pickering <alex@cogarr.net>2024-11-08 17:24:20 -0600
committerAlexander M Pickering <alex@cogarr.net>2024-11-08 17:24:20 -0600
commit715149e2011bd89f30440c8e62d7cff8e5968ad4 (patch)
tree787a2f4d95ea8839d411699b79cc223b56a47eae
parent079fb995bbfbfeb6ed61584bbc565293e73a15da (diff)
downloadbusybox-w32-packaging-715149e2011bd89f30440c8e62d7cff8e5968ad4.tar.gz
busybox-w32-packaging-715149e2011bd89f30440c8e62d7cff8e5968ad4.tar.bz2
busybox-w32-packaging-715149e2011bd89f30440c8e62d7cff8e5968ad4.zip
more debugging
-rw-r--r--libressl.patch85
1 files changed, 61 insertions, 24 deletions
diff --git a/libressl.patch b/libressl.patch
index b359476..24963ac 100644
--- a/libressl.patch
+++ b/libressl.patch
@@ -135,7 +135,7 @@ index 9f1dd67ec..7e8da6df2 100644
135 static void tls_xwrite(tls_state_t *tls, int len) 135 static void tls_xwrite(tls_state_t *tls, int len)
136 { 136 {
137diff --git a/networking/wget.c b/networking/wget.c 137diff --git a/networking/wget.c b/networking/wget.c
138index 6a64836fb..39a69d0b7 100644 138index 6a64836fb..96ebc298b 100644
139--- a/networking/wget.c 139--- a/networking/wget.c
140+++ b/networking/wget.c 140+++ b/networking/wget.c
141@@ -169,7 +169,8 @@ 141@@ -169,7 +169,8 @@
@@ -148,7 +148,44 @@ index 6a64836fb..39a69d0b7 100644
148 #if 0 148 #if 0
149 # define log_io(...) bb_error_msg(__VA_ARGS__) 149 # define log_io(...) bb_error_msg(__VA_ARGS__)
150 # define SENDFMT(fp, fmt, ...) \ 150 # define SENDFMT(fp, fmt, ...) \
151@@ -689,6 +690,7 @@ static void reset_beg_range_to_zero(void) 151@@ -488,26 +489,35 @@ static char fgets_trim_sanitize(FILE *fp, const char *fmt)
152 char c;
153 char *buf_ptr;
154
155+ printf("wget fgets_trim_sanitize 1\n");
156 set_alarm();
157- if (fgets(G.wget_buf, sizeof(G.wget_buf), fp) == NULL)
158+ printf("wget fgets_trim_sanitize 2\n");
159+ if (fgets(G.wget_buf, sizeof(G.wget_buf), fp) == NULL){
160 bb_simple_perror_msg_and_die("error getting response");
161+ }
162 clear_alarm();
163
164+ printf("wget fgets_trim_sanitize 3\n");
165 buf_ptr = strchrnul(G.wget_buf, '\n');
166+ printf("wget fgets_trim_sanitize 4\n");
167 c = *buf_ptr;
168 #if 1
169 /* Disallow any control chars: trim at first char < 0x20 */
170+ printf("wget fgets_trim_sanitize 5\n");
171 sanitize_string(G.wget_buf);
172+ printf("wget fgets_trim_sanitize 6\n");
173 #else
174 *buf_ptr = '\0';
175 buf_ptr = strchrnul(G.wget_buf, '\r');
176 *buf_ptr = '\0';
177 #endif
178
179+ printf("wget fgets_trim_sanitize 7\n");
180 log_io("< %s", G.wget_buf);
181
182 if (fmt && (option_mask32 & WGET_OPT_SERVER_RESPONSE))
183 fprintf(stderr, fmt, G.wget_buf);
184+ printf("wget fgets_trim_sanitize 8\n");
185
186 return c;
187 }
188@@ -689,6 +699,7 @@ static void reset_beg_range_to_zero(void)
152 } 189 }
153 190
154 #if ENABLE_FEATURE_WGET_OPENSSL 191 #if ENABLE_FEATURE_WGET_OPENSSL
@@ -156,7 +193,7 @@ index 6a64836fb..39a69d0b7 100644
156 static int spawn_https_helper_openssl(const char *host, unsigned port) 193 static int spawn_https_helper_openssl(const char *host, unsigned port)
157 { 194 {
158 char *allocated = NULL; 195 char *allocated = NULL;
159@@ -777,6 +779,33 @@ static int spawn_https_helper_openssl(const char *host, unsigned port) 196@@ -777,6 +788,33 @@ static int spawn_https_helper_openssl(const char *host, unsigned port)
160 # endif 197 # endif
161 return sp[0]; 198 return sp[0];
162 } 199 }
@@ -190,7 +227,7 @@ index 6a64836fb..39a69d0b7 100644
190 #endif 227 #endif
191 228
192 #if ENABLE_FEATURE_WGET_HTTPS 229 #if ENABLE_FEATURE_WGET_HTTPS
193@@ -1151,6 +1180,7 @@ static void download_one_url(const char *url) 230@@ -1151,6 +1189,7 @@ static void download_one_url(const char *url)
194 server.user = NULL; 231 server.user = NULL;
195 target.user = NULL; 232 target.user = NULL;
196 233
@@ -198,7 +235,7 @@ index 6a64836fb..39a69d0b7 100644
198 parse_url(url, &target); 235 parse_url(url, &target);
199 236
200 /* Use the proxy if necessary */ 237 /* Use the proxy if necessary */
201@@ -1172,6 +1202,7 @@ static void download_one_url(const char *url) 238@@ -1172,6 +1211,7 @@ static void download_one_url(const char *url)
202 server.host = target.host; 239 server.host = target.host;
203 } 240 }
204 } 241 }
@@ -206,7 +243,7 @@ index 6a64836fb..39a69d0b7 100644
206 243
207 if (ENABLE_FEATURE_IPV6) 244 if (ENABLE_FEATURE_IPV6)
208 strip_ipv6_scope_id(target.host); 245 strip_ipv6_scope_id(target.host);
209@@ -1191,6 +1222,7 @@ static void download_one_url(const char *url) 246@@ -1191,6 +1231,7 @@ static void download_one_url(const char *url)
210 G.fname_out = fname_out_alloc = xstrdup(G.fname_out); 247 G.fname_out = fname_out_alloc = xstrdup(G.fname_out);
211 } 248 }
212 } 249 }
@@ -214,7 +251,7 @@ index 6a64836fb..39a69d0b7 100644
214 #if ENABLE_FEATURE_WGET_STATUSBAR 251 #if ENABLE_FEATURE_WGET_STATUSBAR
215 G.curfile = bb_get_last_path_component_nostrip(G.fname_out); 252 G.curfile = bb_get_last_path_component_nostrip(G.fname_out);
216 #endif 253 #endif
217@@ -1206,15 +1238,19 @@ static void download_one_url(const char *url) 254@@ -1206,15 +1247,19 @@ static void download_one_url(const char *url)
218 * We are not sure it exists on remote side */ 255 * We are not sure it exists on remote side */
219 } 256 }
220 257
@@ -234,7 +271,7 @@ index 6a64836fb..39a69d0b7 100644
234 /*G.content_len = 0; - redundant, got_clen = 0 is enough */ 271 /*G.content_len = 0; - redundant, got_clen = 0 is enough */
235 G.got_clen = 0; 272 G.got_clen = 0;
236 G.chunked = 0; 273 G.chunked = 0;
237@@ -1229,37 +1265,49 @@ static void download_one_url(const char *url) 274@@ -1229,37 +1274,49 @@ static void download_one_url(const char *url)
238 275
239 /* Open socket to http(s) server */ 276 /* Open socket to http(s) server */
240 #if ENABLE_FEATURE_WGET_OPENSSL 277 #if ENABLE_FEATURE_WGET_OPENSSL
@@ -286,7 +323,7 @@ index 6a64836fb..39a69d0b7 100644
286 /* Send HTTP request */ 323 /* Send HTTP request */
287 if (use_proxy) { 324 if (use_proxy) {
288 SENDFMT(sfp, "GET %s://%s/%s HTTP/1.1\r\n", 325 SENDFMT(sfp, "GET %s://%s/%s HTTP/1.1\r\n",
289@@ -1270,6 +1318,7 @@ static void download_one_url(const char *url) 326@@ -1270,6 +1327,7 @@ static void download_one_url(const char *url)
290 (option_mask32 & WGET_OPT_POST) ? "POST" : "GET", 327 (option_mask32 & WGET_OPT_POST) ? "POST" : "GET",
291 target.path); 328 target.path);
292 } 329 }
@@ -294,7 +331,7 @@ index 6a64836fb..39a69d0b7 100644
294 if (!USR_HEADER_HOST) 331 if (!USR_HEADER_HOST)
295 SENDFMT(sfp, "Host: %s\r\n", target.host); 332 SENDFMT(sfp, "Host: %s\r\n", target.host);
296 if (!USR_HEADER_USER_AGENT) 333 if (!USR_HEADER_USER_AGENT)
297@@ -1280,6 +1329,7 @@ static void download_one_url(const char *url) 334@@ -1280,6 +1338,7 @@ static void download_one_url(const char *url)
298 */ 335 */
299 SENDFMT(sfp, "Connection: close\r\n"); 336 SENDFMT(sfp, "Connection: close\r\n");
300 337
@@ -302,7 +339,7 @@ index 6a64836fb..39a69d0b7 100644
302 #if ENABLE_FEATURE_WGET_AUTHENTICATION 339 #if ENABLE_FEATURE_WGET_AUTHENTICATION
303 if (target.user && !USR_HEADER_AUTH) { 340 if (target.user && !USR_HEADER_AUTH) {
304 SENDFMT(sfp, "Proxy-Authorization: Basic %s\r\n"+6, 341 SENDFMT(sfp, "Proxy-Authorization: Basic %s\r\n"+6,
305@@ -1291,6 +1341,7 @@ static void download_one_url(const char *url) 342@@ -1291,6 +1350,7 @@ static void download_one_url(const char *url)
306 } 343 }
307 #endif 344 #endif
308 345
@@ -310,7 +347,7 @@ index 6a64836fb..39a69d0b7 100644
310 if (G.beg_range != 0 && !USR_HEADER_RANGE) 347 if (G.beg_range != 0 && !USR_HEADER_RANGE)
311 SENDFMT(sfp, "Range: bytes=%"OFF_FMT"u-\r\n", G.beg_range); 348 SENDFMT(sfp, "Range: bytes=%"OFF_FMT"u-\r\n", G.beg_range);
312 349
313@@ -1300,6 +1351,7 @@ static void download_one_url(const char *url) 350@@ -1300,6 +1360,7 @@ static void download_one_url(const char *url)
314 fputs(G.extra_headers, sfp); 351 fputs(G.extra_headers, sfp);
315 } 352 }
316 353
@@ -318,7 +355,7 @@ index 6a64836fb..39a69d0b7 100644
318 if (option_mask32 & WGET_OPT_POST_FILE) { 355 if (option_mask32 & WGET_OPT_POST_FILE) {
319 int fd = xopen_stdin(G.post_file); 356 int fd = xopen_stdin(G.post_file);
320 G.post_data = xmalloc_read(fd, NULL); 357 G.post_data = xmalloc_read(fd, NULL);
321@@ -1314,15 +1366,18 @@ static void download_one_url(const char *url) 358@@ -1314,15 +1375,18 @@ static void download_one_url(const char *url)
322 ); 359 );
323 } 360 }
324 # if ENABLE_PLATFORM_MINGW32 361 # if ENABLE_PLATFORM_MINGW32
@@ -337,7 +374,7 @@ index 6a64836fb..39a69d0b7 100644
337 } else 374 } else
338 # else 375 # else
339 SENDFMT(sfp, 376 SENDFMT(sfp,
340@@ -1338,6 +1393,7 @@ static void download_one_url(const char *url) 377@@ -1338,6 +1402,7 @@ static void download_one_url(const char *url)
341 SENDFMT(sfp, "\r\n"); 378 SENDFMT(sfp, "\r\n");
342 } 379 }
343 380
@@ -345,7 +382,7 @@ index 6a64836fb..39a69d0b7 100644
345 fflush(sfp); 382 fflush(sfp);
346 383
347 /* Tried doing this unconditionally. 384 /* Tried doing this unconditionally.
348@@ -1358,14 +1414,21 @@ static void download_one_url(const char *url) 385@@ -1358,14 +1423,21 @@ static void download_one_url(const char *url)
349 * Retrieve HTTP response line and check for "200" status code. 386 * Retrieve HTTP response line and check for "200" status code.
350 */ 387 */
351 read_response: 388 read_response:
@@ -367,7 +404,7 @@ index 6a64836fb..39a69d0b7 100644
367 switch (status) { 404 switch (status) {
368 case 0: 405 case 0:
369 case 100: 406 case 100:
370@@ -1441,6 +1504,7 @@ However, in real world it was observed that some web servers 407@@ -1441,6 +1513,7 @@ However, in real world it was observed that some web servers
371 /* 408 /*
372 * Retrieve HTTP headers. 409 * Retrieve HTTP headers.
373 */ 410 */
@@ -375,7 +412,7 @@ index 6a64836fb..39a69d0b7 100644
375 while ((str = get_sanitized_hdr(sfp)) != NULL) { 412 while ((str = get_sanitized_hdr(sfp)) != NULL) {
376 static const char keywords[] ALIGN1 = 413 static const char keywords[] ALIGN1 =
377 "content-length\0""transfer-encoding\0""location\0"; 414 "content-length\0""transfer-encoding\0""location\0";
378@@ -1497,6 +1561,7 @@ However, in real world it was observed that some web servers 415@@ -1497,6 +1570,7 @@ However, in real world it was observed that some web servers
379 goto establish_session; 416 goto establish_session;
380 } 417 }
381 } 418 }
@@ -383,7 +420,7 @@ index 6a64836fb..39a69d0b7 100644
383 // if (status >= 300) 420 // if (status >= 300)
384 // bb_error_msg_and_die("bad redirection (no Location: header from server)"); 421 // bb_error_msg_and_die("bad redirection (no Location: header from server)");
385 422
386@@ -1514,6 +1579,7 @@ However, in real world it was observed that some web servers 423@@ -1514,6 +1588,7 @@ However, in real world it was observed that some web servers
387 424
388 free(lsa); 425 free(lsa);
389 426
@@ -391,7 +428,7 @@ index 6a64836fb..39a69d0b7 100644
391 if (!(option_mask32 & WGET_OPT_SPIDER)) { 428 if (!(option_mask32 & WGET_OPT_SPIDER)) {
392 if (G.output_fd < 0) 429 if (G.output_fd < 0)
393 G.output_fd = xopen(G.fname_out, G.o_flags); 430 G.output_fd = xopen(G.fname_out, G.o_flags);
394@@ -1536,6 +1602,7 @@ However, in real world it was observed that some web servers 431@@ -1536,6 +1611,7 @@ However, in real world it was observed that some web servers
395 /* ftpcmd("QUIT", NULL, sfp); - why bother? */ 432 /* ftpcmd("QUIT", NULL, sfp); - why bother? */
396 } 433 }
397 #endif 434 #endif
@@ -399,7 +436,7 @@ index 6a64836fb..39a69d0b7 100644
399 fclose(sfp); 436 fclose(sfp);
400 437
401 free(server.allocated); 438 free(server.allocated);
402@@ -1544,11 +1611,13 @@ However, in real world it was observed that some web servers 439@@ -1544,11 +1620,13 @@ However, in real world it was observed that some web servers
403 free(target.user); 440 free(target.user);
404 free(fname_out_alloc); 441 free(fname_out_alloc);
405 free(redirected_path); 442 free(redirected_path);
@@ -413,7 +450,7 @@ index 6a64836fb..39a69d0b7 100644
413 #if ENABLE_FEATURE_WGET_LONG_OPTIONS 450 #if ENABLE_FEATURE_WGET_LONG_OPTIONS
414 static const char wget_longopts[] ALIGN1 = 451 static const char wget_longopts[] ALIGN1 =
415 /* name, has_arg, val */ 452 /* name, has_arg, val */
416@@ -1590,6 +1659,7 @@ IF_DESKTOP( "no-parent\0" No_argument "\xf0") 453@@ -1590,6 +1668,7 @@ IF_DESKTOP( "no-parent\0" No_argument "\xf0")
417 #endif 454 #endif
418 455
419 INIT_G(); 456 INIT_G();
@@ -421,7 +458,7 @@ index 6a64836fb..39a69d0b7 100644
421 458
422 #if ENABLE_FEATURE_WGET_TIMEOUT 459 #if ENABLE_FEATURE_WGET_TIMEOUT
423 G.timeout_seconds = 900; 460 G.timeout_seconds = 900;
424@@ -1626,6 +1696,8 @@ IF_DESKTOP( "no-parent\0" No_argument "\xf0") 461@@ -1626,6 +1705,8 @@ IF_DESKTOP( "no-parent\0" No_argument "\xf0")
425 IF_FEATURE_WGET_LONG_OPTIONS(, &G.post_data) 462 IF_FEATURE_WGET_LONG_OPTIONS(, &G.post_data)
426 IF_FEATURE_WGET_LONG_OPTIONS(, &G.post_file) 463 IF_FEATURE_WGET_LONG_OPTIONS(, &G.post_file)
427 ); 464 );
@@ -430,7 +467,7 @@ index 6a64836fb..39a69d0b7 100644
430 #if 0 /* option bits debug */ 467 #if 0 /* option bits debug */
431 if (option_mask32 & WGET_OPT_RETRIES) bb_error_msg("-t NUM"); 468 if (option_mask32 & WGET_OPT_RETRIES) bb_error_msg("-t NUM");
432 if (option_mask32 & WGET_OPT_nsomething) bb_error_msg("-nsomething"); 469 if (option_mask32 & WGET_OPT_nsomething) bb_error_msg("-nsomething");
433@@ -1670,6 +1742,7 @@ IF_DESKTOP( "no-parent\0" No_argument "\xf0") 470@@ -1670,6 +1751,7 @@ IF_DESKTOP( "no-parent\0" No_argument "\xf0")
434 } 471 }
435 #endif 472 #endif
436 473
@@ -438,7 +475,7 @@ index 6a64836fb..39a69d0b7 100644
438 G.output_fd = -1; 475 G.output_fd = -1;
439 G.o_flags = O_WRONLY | O_CREAT | O_TRUNC | O_EXCL; 476 G.o_flags = O_WRONLY | O_CREAT | O_TRUNC | O_EXCL;
440 if (G.fname_out) { /* -O FILE ? */ 477 if (G.fname_out) { /* -O FILE ? */
441@@ -1691,8 +1764,11 @@ IF_DESKTOP( "no-parent\0" No_argument "\xf0") 478@@ -1691,8 +1773,11 @@ IF_DESKTOP( "no-parent\0" No_argument "\xf0")
442 } 479 }
443 } 480 }
444 481