Fossil SCM

Use hostname in stead of proxy name in certificate handling. Attempt to fix the problem described here: [https://www.mail-archive.com/[email protected]/msg13898.html]

jan.nijtmans 2014-02-05 14:59 UTC jan-httpsproxytunnel
Commit 6673f163ea4f1c4ef9aaeeaa319226c514b54eb7
1 file changed +5 -5
+5 -5
--- src/http_ssl.c
+++ src/http_ssl.c
@@ -357,11 +357,11 @@
357357
" certificates list\n\n"
358358
"If you are not expecting this message, answer no and "
359359
"contact your server\nadministrator.\n\n"
360360
"Accept certificate for host %s (a=always/y/N)? ",
361361
X509_verify_cert_error_string(e), desc, warning,
362
- pUrlData->name);
362
+ pUrlData->useProxy?pUrlData->hostname:pUrlData->name);
363363
BIO_free(mem);
364364
365365
prompt_user(prompt, &ans);
366366
free(prompt);
367367
cReply = blob_str(&ans)[0];
@@ -407,14 +407,14 @@
407407
408408
mem = BIO_new(BIO_s_mem());
409409
PEM_write_bio_X509(mem, cert);
410410
BIO_write(mem, "", 1); /* nul-terminate mem buffer */
411411
BIO_get_mem_data(mem, &zCert);
412
- zHost = mprintf("cert:%s", pUrlData->name);
412
+ zHost = mprintf("cert:%s", pUrlData->useProxy?pUrlData->hostname:pUrlData->name);
413413
db_set(zHost, zCert, 1);
414414
free(zHost);
415
- zHost = mprintf("trusted:%s", pUrlData->name);
415
+ zHost = mprintf("trusted:%s", pUrlData->useProxy?pUrlData->hostname:pUrlData->name);
416416
db_set_int(zHost, trusted, 1);
417417
free(zHost);
418418
BIO_free(mem);
419419
}
420420
@@ -425,18 +425,18 @@
425425
X509 *ssl_get_certificate(UrlData *pUrlData, int *pTrusted){
426426
char *zHost, *zCert;
427427
BIO *mem;
428428
X509 *cert;
429429
430
- zHost = mprintf("cert:%s", pUrlData->name);
430
+ zHost = mprintf("cert:%s", pUrlData->useProxy?pUrlData->hostname:pUrlData->name);
431431
zCert = db_get(zHost, NULL);
432432
free(zHost);
433433
if ( zCert==NULL )
434434
return NULL;
435435
436436
if ( pTrusted!=0 ){
437
- zHost = mprintf("trusted:%s", pUrlData->name);
437
+ zHost = mprintf("trusted:%s", pUrlData->useProxy?pUrlData->hostname:pUrlData->name);
438438
*pTrusted = db_get_int(zHost, 0);
439439
free(zHost);
440440
}
441441
442442
mem = BIO_new(BIO_s_mem());
443443
--- src/http_ssl.c
+++ src/http_ssl.c
@@ -357,11 +357,11 @@
357 " certificates list\n\n"
358 "If you are not expecting this message, answer no and "
359 "contact your server\nadministrator.\n\n"
360 "Accept certificate for host %s (a=always/y/N)? ",
361 X509_verify_cert_error_string(e), desc, warning,
362 pUrlData->name);
363 BIO_free(mem);
364
365 prompt_user(prompt, &ans);
366 free(prompt);
367 cReply = blob_str(&ans)[0];
@@ -407,14 +407,14 @@
407
408 mem = BIO_new(BIO_s_mem());
409 PEM_write_bio_X509(mem, cert);
410 BIO_write(mem, "", 1); /* nul-terminate mem buffer */
411 BIO_get_mem_data(mem, &zCert);
412 zHost = mprintf("cert:%s", pUrlData->name);
413 db_set(zHost, zCert, 1);
414 free(zHost);
415 zHost = mprintf("trusted:%s", pUrlData->name);
416 db_set_int(zHost, trusted, 1);
417 free(zHost);
418 BIO_free(mem);
419 }
420
@@ -425,18 +425,18 @@
425 X509 *ssl_get_certificate(UrlData *pUrlData, int *pTrusted){
426 char *zHost, *zCert;
427 BIO *mem;
428 X509 *cert;
429
430 zHost = mprintf("cert:%s", pUrlData->name);
431 zCert = db_get(zHost, NULL);
432 free(zHost);
433 if ( zCert==NULL )
434 return NULL;
435
436 if ( pTrusted!=0 ){
437 zHost = mprintf("trusted:%s", pUrlData->name);
438 *pTrusted = db_get_int(zHost, 0);
439 free(zHost);
440 }
441
442 mem = BIO_new(BIO_s_mem());
443
--- src/http_ssl.c
+++ src/http_ssl.c
@@ -357,11 +357,11 @@
357 " certificates list\n\n"
358 "If you are not expecting this message, answer no and "
359 "contact your server\nadministrator.\n\n"
360 "Accept certificate for host %s (a=always/y/N)? ",
361 X509_verify_cert_error_string(e), desc, warning,
362 pUrlData->useProxy?pUrlData->hostname:pUrlData->name);
363 BIO_free(mem);
364
365 prompt_user(prompt, &ans);
366 free(prompt);
367 cReply = blob_str(&ans)[0];
@@ -407,14 +407,14 @@
407
408 mem = BIO_new(BIO_s_mem());
409 PEM_write_bio_X509(mem, cert);
410 BIO_write(mem, "", 1); /* nul-terminate mem buffer */
411 BIO_get_mem_data(mem, &zCert);
412 zHost = mprintf("cert:%s", pUrlData->useProxy?pUrlData->hostname:pUrlData->name);
413 db_set(zHost, zCert, 1);
414 free(zHost);
415 zHost = mprintf("trusted:%s", pUrlData->useProxy?pUrlData->hostname:pUrlData->name);
416 db_set_int(zHost, trusted, 1);
417 free(zHost);
418 BIO_free(mem);
419 }
420
@@ -425,18 +425,18 @@
425 X509 *ssl_get_certificate(UrlData *pUrlData, int *pTrusted){
426 char *zHost, *zCert;
427 BIO *mem;
428 X509 *cert;
429
430 zHost = mprintf("cert:%s", pUrlData->useProxy?pUrlData->hostname:pUrlData->name);
431 zCert = db_get(zHost, NULL);
432 free(zHost);
433 if ( zCert==NULL )
434 return NULL;
435
436 if ( pTrusted!=0 ){
437 zHost = mprintf("trusted:%s", pUrlData->useProxy?pUrlData->hostname:pUrlData->name);
438 *pTrusted = db_get_int(zHost, 0);
439 free(zHost);
440 }
441
442 mem = BIO_new(BIO_s_mem());
443

Keyboard Shortcuts

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