diff options
Diffstat (limited to 'qmail-remote.c')
| -rw-r--r-- | qmail-remote.c | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/qmail-remote.c b/qmail-remote.c index 4227718..ece335d 100644 --- a/qmail-remote.c +++ b/qmail-remote.c | |||
| @@ -425,29 +425,30 @@ int tls_init() | |||
| 425 | } | 425 | } |
| 426 | } | 426 | } |
| 427 | 427 | ||
| 428 | /* DANE starts here */ | 428 | /* DANE: starts here */ |
| 429 | int dane_retval = VAL_DANE_INTERNAL_ERROR; | 429 | int dane_retval = VAL_DANE_INTERNAL_ERROR; |
| 430 | int tls_required = (smtps || servercert != NULL); | 430 | int tls_required = (smtps || servercert != NULL); |
| 431 | 431 | ||
| 432 | if (partner_fqdn && !servercert && !dane_context_failed) { | 432 | if (partner_fqdn && !servercert && !dane_context_failed) { |
| 433 | if (val_create_context(NULL, &dane_context) != VAL_NO_ERROR) { | 433 | if (val_create_context(NULL, &dane_context) == VAL_NO_ERROR) { |
| 434 | dane_context_failed = 1; | 434 | /* DANE: lookup TLSA records */ |
| 435 | out("lUnable to initialize libval context\n"); | ||
| 436 | zeroflush(); | ||
| 437 | } | ||
| 438 | |||
| 439 | /* DANE lookup TLSA records */ | ||
| 440 | if (dane_context) { | ||
| 441 | if (dane_status != NULL) | ||
| 442 | val_free_dane(dane_status); | ||
| 443 | struct val_daneparams dane_params = { | 435 | struct val_daneparams dane_params = { |
| 444 | .port = smtp_port, | 436 | .port = smtp_port, |
| 445 | .proto = DANE_PARAM_PROTO_TCP | 437 | .proto = DANE_PARAM_PROTO_TCP |
| 446 | }; | 438 | }; |
| 439 | if (dane_status != NULL) | ||
| 440 | val_free_dane(dane_status); | ||
| 447 | dane_retval = val_getdaneinfo(dane_context, partner_fqdn, &dane_params, &dane_status); | 441 | dane_retval = val_getdaneinfo(dane_context, partner_fqdn, &dane_params, &dane_status); |
| 448 | if (dane_retval == VAL_DANE_NOERROR) | 442 | if (dane_status == NULL) // insecure domain without TLSA RR will return VAL_DANE_NOERROR |
| 443 | dane_retval = VAL_DANE_CHECK_FAILED; | ||
| 444 | else if (dane_retval == VAL_DANE_NOERROR) | ||
| 449 | tls_required = 1; | 445 | tls_required = 1; |
| 450 | } | 446 | } |
| 447 | else { | ||
| 448 | dane_context_failed = 1; | ||
| 449 | out("lUnable to initialize libval context\n"); | ||
| 450 | zeroflush(); | ||
| 451 | } | ||
| 451 | } | 452 | } |
| 452 | 453 | ||
| 453 | if (!smtps) { | 454 | if (!smtps) { |
| @@ -596,7 +597,7 @@ int tls_init() | |||
| 596 | 597 | ||
| 597 | X509_free(peercert); | 598 | X509_free(peercert); |
| 598 | } | 599 | } |
| 599 | /* DANE verify tls connection */ | 600 | /* DANE: verify tls connection */ |
| 600 | else if (dane_retval == VAL_DANE_NOERROR) { | 601 | else if (dane_retval == VAL_DANE_NOERROR) { |
| 601 | int do_certcheck = 0; // ignored. DANE SMTP doesn't do any PKIX checks | 602 | int do_certcheck = 0; // ignored. DANE SMTP doesn't do any PKIX checks |
| 602 | dane_retval = val_dane_check(dane_context, ssl, dane_status, &do_certcheck); | 603 | dane_retval = val_dane_check(dane_context, ssl, dane_status, &do_certcheck); |
