Fossil SCM

(cherry-pick): Clean up the detection of BIO_ADDR_hostname_string by removing redundant definitions; apparently autosetup has a feature which automatically creates a define with HAVE_ prepended for whatever function is intended to be detected.

jan.nijtmans 2019-04-18 14:05 branch-2.8
Commit 9ef58dcff25637a0eba742f2db5887ddd6d34d50212a0ff96358ee5490089e98
2 files changed +1 +8 -1
+1
--- auto.def
+++ auto.def
@@ -376,10 +376,11 @@
376376
if {[string match *-darwin* [get-define host]]} {
377377
if {[cctest -cflags {-Wdeprecated-declarations}]} {
378378
define-append EXTRA_CFLAGS -Wdeprecated-declarations
379379
}
380380
}
381
+ cc-check-function-in-lib BIO_ADDR_hostname_string ssl
381382
} else {
382383
user-error "OpenSSL not found. Consider --with-openssl=none to disable HTTPS support"
383384
}
384385
} else {
385386
if {[info exists ::zlib_lib]} {
386387
--- auto.def
+++ auto.def
@@ -376,10 +376,11 @@
376 if {[string match *-darwin* [get-define host]]} {
377 if {[cctest -cflags {-Wdeprecated-declarations}]} {
378 define-append EXTRA_CFLAGS -Wdeprecated-declarations
379 }
380 }
 
381 } else {
382 user-error "OpenSSL not found. Consider --with-openssl=none to disable HTTPS support"
383 }
384 } else {
385 if {[info exists ::zlib_lib]} {
386
--- auto.def
+++ auto.def
@@ -376,10 +376,11 @@
376 if {[string match *-darwin* [get-define host]]} {
377 if {[cctest -cflags {-Wdeprecated-declarations}]} {
378 define-append EXTRA_CFLAGS -Wdeprecated-declarations
379 }
380 }
381 cc-check-function-in-lib BIO_ADDR_hostname_string ssl
382 } else {
383 user-error "OpenSSL not found. Consider --with-openssl=none to disable HTTPS support"
384 }
385 } else {
386 if {[info exists ::zlib_lib]} {
387
+8 -1
--- src/http_ssl.c
+++ src/http_ssl.c
@@ -387,13 +387,20 @@
387387
/* Set the Global.zIpAddr variable to the server we are talking to.
388388
** This is used to populate the ipaddr column of the rcvfrom table,
389389
** if any files are received from the server.
390390
*/
391391
{
392
+#ifdef HAVE_BIO_ADDR_HOSTNAME_STRING
393
+ char *ip = BIO_ADDR_hostname_string(BIO_get_conn_address(iBio),1);
394
+ g.zIpAddr = mprintf("%s", ip);
395
+ OPENSSL_free(ip);
396
+#else
392397
/* IPv4 only code */
393
- const unsigned char *ip = (const unsigned char *) BIO_ptr_ctrl(iBio,BIO_C_GET_CONNECT,2);
398
+ const unsigned char *ip;
399
+ ip = (const unsigned char*)BIO_ptr_ctrl(iBio,BIO_C_GET_CONNECT,2);
394400
g.zIpAddr = mprintf("%d.%d.%d.%d", ip[0], ip[1], ip[2], ip[3]);
401
+#endif
395402
}
396403
397404
X509_free(cert);
398405
return 0;
399406
}
400407
--- src/http_ssl.c
+++ src/http_ssl.c
@@ -387,13 +387,20 @@
387 /* Set the Global.zIpAddr variable to the server we are talking to.
388 ** This is used to populate the ipaddr column of the rcvfrom table,
389 ** if any files are received from the server.
390 */
391 {
 
 
 
 
 
392 /* IPv4 only code */
393 const unsigned char *ip = (const unsigned char *) BIO_ptr_ctrl(iBio,BIO_C_GET_CONNECT,2);
 
394 g.zIpAddr = mprintf("%d.%d.%d.%d", ip[0], ip[1], ip[2], ip[3]);
 
395 }
396
397 X509_free(cert);
398 return 0;
399 }
400
--- src/http_ssl.c
+++ src/http_ssl.c
@@ -387,13 +387,20 @@
387 /* Set the Global.zIpAddr variable to the server we are talking to.
388 ** This is used to populate the ipaddr column of the rcvfrom table,
389 ** if any files are received from the server.
390 */
391 {
392 #ifdef HAVE_BIO_ADDR_HOSTNAME_STRING
393 char *ip = BIO_ADDR_hostname_string(BIO_get_conn_address(iBio),1);
394 g.zIpAddr = mprintf("%s", ip);
395 OPENSSL_free(ip);
396 #else
397 /* IPv4 only code */
398 const unsigned char *ip;
399 ip = (const unsigned char*)BIO_ptr_ctrl(iBio,BIO_C_GET_CONNECT,2);
400 g.zIpAddr = mprintf("%d.%d.%d.%d", ip[0], ip[1], ip[2], ip[3]);
401 #endif
402 }
403
404 X509_free(cert);
405 return 0;
406 }
407

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button