TLS_SESS_STATE *tls_proxy_context_receive(VSTREAM *proxy_stream) { TLS_SESS_STATE *tls_context; tls_context = (TLS_SESS_STATE *) mymalloc(sizeof(*tls_context)); if (attr_scan(proxy_stream, ATTR_FLAG_STRICT, ATTR_TYPE_FUNC, tls_proxy_context_scan, (char *) tls_context, ATTR_TYPE_END) != 1) { tls_proxy_context_free(tls_context); return (0); } else { return (tls_context); } }
void smtp_session_free(SMTP_SESSION *session) { #ifdef USE_TLS if (session->stream) { vstream_fflush(session->stream); } if (session->tls_context) { if (session->features & (SMTP_FEATURE_FROM_CACHE | SMTP_FEATURE_FROM_PROXY)) tls_proxy_context_free(session->tls_context); else tls_client_stop(smtp_tls_ctx, session->stream, var_smtp_starttls_tmout, 0, session->tls_context); } #endif if (session->stream) vstream_fclose(session->stream); myfree(session->namaddr); myfree(session->namaddrport); if (session->helo) myfree(session->helo); vstring_free(session->buffer); vstring_free(session->scratch); vstring_free(session->scratch2); if (session->history) smtp_chat_reset(session); if (session->mime_state) mime_state_free(session->mime_state); #ifdef USE_SASL_AUTH smtp_sasl_cleanup(session); #endif debug_peer_restore(); myfree((void *) session); }