Fossil

Check-in [0ef9501c]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Check for the presence of BIO_ADDR_hostname_string before using it.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256:0ef9501cfa0edd49a00f949b665402d638b7ec5491d8bcd33fe70ff7703d9d9d
User & Date: andybradford 2019-03-25 14:02:50
Context
2019-03-25
18:43
Capture both SSL library requirements before attempting to build the code. check-in: f517cb7f user: andybradford tags: trunk
14:02
Check for the presence of BIO_ADDR_hostname_string before using it. check-in: 0ef9501c user: andybradford tags: trunk
12:13
If the login fails during a clone or sync, fail the command immediately rather than reprompting for a new password, as the sync is going to eventually fail anyhow. check-in: e4ca60cd user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to auto.def.

373
374
375
376
377
378
379




380
381
382
383
384
385
386
        msg-result "HTTPS support enabled"

        # Silence OpenSSL deprecation warnings on Mac OS X 10.7.
        if {[string match *-darwin* [get-define host]]} {
            if {[cctest -cflags {-Wdeprecated-declarations}]} {
                define-append EXTRA_CFLAGS -Wdeprecated-declarations
            }




        }
    } else {
        user-error "OpenSSL not found. Consider --with-openssl=none to disable HTTPS support"
    }
} else {
    if {[info exists ::zlib_lib]} {
        define-append LIBS $::zlib_lib







>
>
>
>







373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
        msg-result "HTTPS support enabled"

        # Silence OpenSSL deprecation warnings on Mac OS X 10.7.
        if {[string match *-darwin* [get-define host]]} {
            if {[cctest -cflags {-Wdeprecated-declarations}]} {
                define-append EXTRA_CFLAGS -Wdeprecated-declarations
            }
        }
        if {[cc-check-function-in-lib BIO_ADDR_hostname_string ssl]} {
            define HAVE_BIO_ADDR_HS 1
            msg-result "Using BIO_ADDR_hostname_string"
        }
    } else {
        user-error "OpenSSL not found. Consider --with-openssl=none to disable HTTPS support"
    }
} else {
    if {[info exists ::zlib_lib]} {
        define-append LIBS $::zlib_lib

Changes to src/http_ssl.c.

385
386
387
388
389
390
391
392




393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
  }

  /* Set the Global.zIpAddr variable to the server we are talking to.
  ** This is used to populate the ipaddr column of the rcvfrom table,
  ** if any files are received from the server.
  */
  {
#if OPENSSL_VERSION_NUMBER < 0x10100000




    /* IPv4 only code */
    const unsigned char *ip;
    ip = (const unsigned char*)BIO_ptr_ctrl(iBio,BIO_C_GET_CONNECT,2);
    g.zIpAddr = mprintf("%d.%d.%d.%d", ip[0], ip[1], ip[2], ip[3]);
#else
    char *ip = BIO_ADDR_hostname_string(BIO_get_conn_address(iBio),1);
    g.zIpAddr = mprintf("%s", ip);
    OPENSSL_free(ip);
#endif
  }

  X509_free(cert);
  return 0;
}








|
>
>
>
>




<
<
<
<







385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400




401
402
403
404
405
406
407
  }

  /* Set the Global.zIpAddr variable to the server we are talking to.
  ** This is used to populate the ipaddr column of the rcvfrom table,
  ** if any files are received from the server.
  */
  {
#ifdef HAVE_BIO_ADDR_HS
    char *ip = BIO_ADDR_hostname_string(BIO_get_conn_address(iBio),1);
    g.zIpAddr = mprintf("%s", ip);
    OPENSSL_free(ip);
#else
    /* IPv4 only code */
    const unsigned char *ip;
    ip = (const unsigned char*)BIO_ptr_ctrl(iBio,BIO_C_GET_CONNECT,2);
    g.zIpAddr = mprintf("%d.%d.%d.%d", ip[0], ip[1], ip[2], ip[3]);




#endif
  }

  X509_free(cert);
  return 0;
}