[email protected] (Jérémie Courrèges-Anglas) writes:
> Alex Wilson <[email protected]> writes:
>
> [...]
>
>> This patch seems to fix it, with some quick testing (with and without
>> proxy).
>
> Thanks for your patch, which looks fine. Here's a tweaked version that
> allocates and frees sslhost in both proxy and non-proxy cases.
>
> ok?
Refreshed after last commit to fetch.c
Index: fetch.c
===================================================================
RCS file: /cvs/src/usr.bin/ftp/fetch.c,v
retrieving revision 1.127
diff -u -p -p -u -r1.127 fetch.c
--- fetch.c 21 Aug 2014 16:46:48 -0000 1.127
+++ fetch.c 21 Aug 2014 17:10:27 -0000
@@ -343,6 +343,10 @@ noslash:
}
path = newline;
+ } else if (ishttpsurl) {
+ sslhost = strdup(host);
+ if (sslhost == NULL)
+ errx(1, "Can't allocate memory for https path/host.");
}
if (isfileurl) {
@@ -604,7 +608,7 @@ again:
ressl_error(ssl));
goto cleanup_url_get;
}
- if (ressl_connect_socket(ssl, s, host) != 0) {
+ if (ressl_connect_socket(ssl, s, sslhost) != 0) {
fprintf(ttyout, "SSL failure: %s\n", ressl_error(ssl));
goto cleanup_url_get;
}
@@ -975,6 +979,7 @@ cleanup_url_get:
ressl_free(ssl);
}
free(full_host);
+ free(sslhost);
#endif /* !SMALL */
if (fin != NULL)
fclose(fin);
--
jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF DDCC 0DFA 74AE 1524 E7EE