aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--networking/wget.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/networking/wget.c b/networking/wget.c
index 6a8c08324..ea60c18b2 100644
--- a/networking/wget.c
+++ b/networking/wget.c
@@ -673,7 +673,8 @@ static int spawn_https_helper_openssl(const char *host, unsigned port)
673 pid = xvfork(); 673 pid = xvfork();
674 if (pid == 0) { 674 if (pid == 0) {
675 /* Child */ 675 /* Child */
676 char *argv[9]; 676 char *argv[13];
677 char **argp;
677 678
678 close(sp[0]); 679 close(sp[0]);
679 xmove_fd(sp[1], 0); 680 xmove_fd(sp[1], 0);
@@ -696,13 +697,25 @@ static int spawn_https_helper_openssl(const char *host, unsigned port)
696 * TLS server_name (SNI) field are FQDNs (DNS hostnames). 697 * TLS server_name (SNI) field are FQDNs (DNS hostnames).
697 * IPv4 and IPv6 addresses, port numbers are not allowed. 698 * IPv4 and IPv6 addresses, port numbers are not allowed.
698 */ 699 */
700 argp = &argv[5];
699 if (!is_ip_address(servername)) { 701 if (!is_ip_address(servername)) {
700 argv[5] = (char*)"-servername"; 702 *argp++ = (char*)"-servername"; //[5]
701 argv[6] = (char*)servername; 703 *argp++ = (char*)servername; //[6]
702 } 704 }
703 if (!(option_mask32 & WGET_OPT_NO_CHECK_CERT)) { 705 if (!(option_mask32 & WGET_OPT_NO_CHECK_CERT)) {
704 argv[7] = (char*)"-verify_return_error"; 706 /* Abort on bad server certificate */
707 *argp++ = (char*)"-verify"; //[7]
708 *argp++ = (char*)"100"; //[8]
709 *argp++ = (char*)"-verify_return_error"; //[9]
710 if (!is_ip_address(servername)) {
711 *argp++ = (char*)"-verify_hostname"; //[10]
712 *argp++ = (char*)servername; //[11]
713 } else {
714 *argp++ = (char*)"-verify_ip"; //[10]
715 *argp++ = (char*)host; //[11]
716 }
705 } 717 }
718 //[12] (or earlier) is NULL terminator
706 719
707 BB_EXECVP(argv[0], argv); 720 BB_EXECVP(argv[0], argv);
708 xmove_fd(3, 2); 721 xmove_fd(3, 2);