summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander M Pickering <alex@cogarr.net>2024-11-08 16:49:47 -0600
committerAlexander M Pickering <alex@cogarr.net>2024-11-08 16:49:47 -0600
commit0aaebb261332aab6c6bffc191e290a59bb324f51 (patch)
treeba319c4ee3e6dbbd47e39f2b73efbe89e9933f1f
parent41025a7f5b8b0f839d6515ff67dbb153a3e3f1b1 (diff)
downloadbusybox-w32-packaging-0aaebb261332aab6c6bffc191e290a59bb324f51.tar.gz
busybox-w32-packaging-0aaebb261332aab6c6bffc191e290a59bb324f51.tar.bz2
busybox-w32-packaging-0aaebb261332aab6c6bffc191e290a59bb324f51.zip
try a different way to open socket
-rw-r--r--libressl.patch39
1 files changed, 25 insertions, 14 deletions
diff --git a/libressl.patch b/libressl.patch
index cb233da..8f061e2 100644
--- a/libressl.patch
+++ b/libressl.patch
@@ -135,10 +135,20 @@ 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..7ca84e645 100644 138index 6a64836fb..a99bf8dcb 100644
139--- a/networking/wget.c 139--- a/networking/wget.c
140+++ b/networking/wget.c 140+++ b/networking/wget.c
141@@ -689,6 +689,7 @@ static void reset_beg_range_to_zero(void) 141@@ -169,7 +169,8 @@
142 //usage: "\n -Y on/off Use proxy"
143
144 #include "libbb.h"
145-
146+#include <string.h>
147+#include <errno.h>
148 #if 0
149 # define log_io(...) bb_error_msg(__VA_ARGS__)
150 # define SENDFMT(fp, fmt, ...) \
151@@ -689,6 +690,7 @@ static void reset_beg_range_to_zero(void)
142 } 152 }
143 153
144 #if ENABLE_FEATURE_WGET_OPENSSL 154 #if ENABLE_FEATURE_WGET_OPENSSL
@@ -146,7 +156,7 @@ index 6a64836fb..7ca84e645 100644
146 static int spawn_https_helper_openssl(const char *host, unsigned port) 156 static int spawn_https_helper_openssl(const char *host, unsigned port)
147 { 157 {
148 char *allocated = NULL; 158 char *allocated = NULL;
149@@ -777,6 +778,35 @@ static int spawn_https_helper_openssl(const char *host, unsigned port) 159@@ -777,6 +779,33 @@ static int spawn_https_helper_openssl(const char *host, unsigned port)
150 # endif 160 # endif
151 return sp[0]; 161 return sp[0];
152 } 162 }
@@ -156,7 +166,6 @@ index 6a64836fb..7ca84e645 100644
156+{ 166+{
157+ char* allocated = NULL; 167+ char* allocated = NULL;
158+ char *servername, *cmd; 168+ char *servername, *cmd;
159+ int sp[2];
160+ if(!strchr(host,":")) 169+ if(!strchr(host,":"))
161+ host = allocated = xasprintf("%s:%u",host,port); 170+ host = allocated = xasprintf("%s:%u",host,port);
162+ servername = xstrdup(host); 171+ servername = xstrdup(host);
@@ -170,19 +179,18 @@ index 6a64836fb..7ca84e645 100644
170+ bb_error_msg_and_die("Out of memory 2"); 179+ bb_error_msg_and_die("Out of memory 2");
171+ if(tls_configure(ctx,config) != 0) 180+ if(tls_configure(ctx,config) != 0)
172+ bb_error_msg_and_die("Failed to configure client"); 181+ bb_error_msg_and_die("Failed to configure client");
173+ tls_connect_fds(ctx,sp[0],sp[1],servername); 182+ int ret = tls_connect(ctx,servername,NULL);
174+ close(sp[1]);
175+ tls_config_free(config); 183+ tls_config_free(config);
176+ tls_free(ctx); 184+ tls_free(ctx);
177+ free(allocated); 185+ free(allocated);
178+ free(servername); 186+ free(servername);
179+ return sp[0]; 187+ return ret;
180+} 188+}
181+# endif 189+# endif
182 #endif 190 #endif
183 191
184 #if ENABLE_FEATURE_WGET_HTTPS 192 #if ENABLE_FEATURE_WGET_HTTPS
185@@ -1151,6 +1181,7 @@ static void download_one_url(const char *url) 193@@ -1151,6 +1180,7 @@ static void download_one_url(const char *url)
186 server.user = NULL; 194 server.user = NULL;
187 target.user = NULL; 195 target.user = NULL;
188 196
@@ -190,7 +198,7 @@ index 6a64836fb..7ca84e645 100644
190 parse_url(url, &target); 198 parse_url(url, &target);
191 199
192 /* Use the proxy if necessary */ 200 /* Use the proxy if necessary */
193@@ -1172,6 +1203,7 @@ static void download_one_url(const char *url) 201@@ -1172,6 +1202,7 @@ static void download_one_url(const char *url)
194 server.host = target.host; 202 server.host = target.host;
195 } 203 }
196 } 204 }
@@ -198,7 +206,7 @@ index 6a64836fb..7ca84e645 100644
198 206
199 if (ENABLE_FEATURE_IPV6) 207 if (ENABLE_FEATURE_IPV6)
200 strip_ipv6_scope_id(target.host); 208 strip_ipv6_scope_id(target.host);
201@@ -1191,6 +1223,7 @@ static void download_one_url(const char *url) 209@@ -1191,6 +1222,7 @@ static void download_one_url(const char *url)
202 G.fname_out = fname_out_alloc = xstrdup(G.fname_out); 210 G.fname_out = fname_out_alloc = xstrdup(G.fname_out);
203 } 211 }
204 } 212 }
@@ -206,7 +214,7 @@ index 6a64836fb..7ca84e645 100644
206 #if ENABLE_FEATURE_WGET_STATUSBAR 214 #if ENABLE_FEATURE_WGET_STATUSBAR
207 G.curfile = bb_get_last_path_component_nostrip(G.fname_out); 215 G.curfile = bb_get_last_path_component_nostrip(G.fname_out);
208 #endif 216 #endif
209@@ -1206,15 +1239,19 @@ static void download_one_url(const char *url) 217@@ -1206,15 +1238,19 @@ static void download_one_url(const char *url)
210 * We are not sure it exists on remote side */ 218 * We are not sure it exists on remote side */
211 } 219 }
212 220
@@ -226,7 +234,7 @@ index 6a64836fb..7ca84e645 100644
226 /*G.content_len = 0; - redundant, got_clen = 0 is enough */ 234 /*G.content_len = 0; - redundant, got_clen = 0 is enough */
227 G.got_clen = 0; 235 G.got_clen = 0;
228 G.chunked = 0; 236 G.chunked = 0;
229@@ -1229,37 +1266,48 @@ static void download_one_url(const char *url) 237@@ -1229,37 +1265,49 @@ static void download_one_url(const char *url)
230 238
231 /* Open socket to http(s) server */ 239 /* Open socket to http(s) server */
232 #if ENABLE_FEATURE_WGET_OPENSSL 240 #if ENABLE_FEATURE_WGET_OPENSSL
@@ -252,8 +260,11 @@ index 6a64836fb..7ca84e645 100644
252 # endif 260 # endif
253+ printf("wget download_one_url 13\n"); 261+ printf("wget download_one_url 13\n");
254 sfp = fdopen(fd, "r+"); 262 sfp = fdopen(fd, "r+");
255 if (!sfp) 263- if (!sfp)
256 bb_die_memory_exhausted(); 264- bb_die_memory_exhausted();
265+ if (!sfp){
266+ bb_error_msg_and_die("Error opening fd: %s",strerror(errno));
267+ }
257+ printf("wget download_one_url 14\n"); 268+ printf("wget download_one_url 14\n");
258 goto socket_opened; 269 goto socket_opened;
259 } 270 }