Fossil

Check-in [8a4ad5cb]
Login

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

Overview
Comment:Use the BIO_ADDR_hostname_string() function from OpenSSL to obtain the IP address of the remote side, if that function is available.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 8a4ad5cb547518dc75118c510b6e5c50ec1ced5671626c5ef490cb3d9e4cbcf7
User & Date: drh 2019-03-25 11:31:08.457
Context
2019-03-25
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)
11:31
Use the BIO_ADDR_hostname_string() function from OpenSSL to obtain the IP address of the remote side, if that function is available. ... (check-in: 8a4ad5cb user: drh tags: trunk)
06:18
Typo fix, reported in the forum: administator. ... (check-in: 1614c9b5 user: stephan tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/http_ssl.c.
385
386
387
388
389
390
391

392
393

394





395
396
397
398
399
400
401
  }

  /* 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.
  */
  {

    /* IPv4 only code */
    const unsigned char *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]);





  }

  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
408
  }

  /* 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;
}

/*