X-Git-Url: https://git.exim.org/exim.git/blobdiff_plain/5056f6873ad9709279cdf8c5c8e1258e7a21f1e7..3d040d098384c48be39e47862d55cac1bc0c578c:/src/src/auths/dovecot.c?ds=sidebyside diff --git a/src/src/auths/dovecot.c b/src/src/auths/dovecot.c index 3331cb856..ca3d1bd1c 100644 --- a/src/src/auths/dovecot.c +++ b/src/src/auths/dovecot.c @@ -275,11 +275,20 @@ if (cctx.sock < 0) # ifndef DISABLE_TLS if (ob->server_tls) { - uschar * s; + union sockaddr_46 interface_sock; + EXIM_SOCKLEN_T size = sizeof(interface_sock); smtp_connect_args conn_args = { .host = &host }; - tls_support tls_dummy = {.sni=NULL}; + tls_support tls_dummy = { .sni = NULL }; uschar * errstr; + if (getsockname(cctx->sock, (struct sockaddr *) &interface_sock, &size) == 0) + conn_args.sending_ip_address = host_ntoa(-1, &interface_sock, NULL, NULL); + else + { + *errmsg = string_sprintf("getsockname failed: %s", strerror(errno)); + goto bad; + } + if (!tls_client_start(&cctx, &conn_args, NULL, &tls_dummy, &errstr)) { auth_defer_msg = string_sprintf("TLS connect failed: %s", errstr);