1 /*************************************************
2 * Exim - an Internet mail transport agent *
3 *************************************************/
5 /* Copyright (c) The Exim Maintainers 2020 - 2022 */
6 /* Copyright (c) University of Cambridge 1995 - 2018 */
7 /* See the file NOTICE for conditions of use and distribution. */
8 /* SPDX-License-Identifier: GPL-2.0-or-later */
10 #define DELIVER_BUFFER_SIZE 4096
13 #define PENDING_DEFER (PENDING + DEFER)
14 #define PENDING_OK (PENDING + OK)
18 /* Flags structure for validity of TLS configuration */
21 BOOL conn_certs:1; /* certificates etc. loaded */
22 BOOL cabundle:1; /* CA certificates loaded */
23 BOOL crl:1; /* CRL loaded */
24 BOOL pri_string:1; /* cipher priority-string cache loaded */
25 BOOL dh:1; /* Diffie-Helman params loaded */
26 BOOL ecdh:1; /* EC Diffie-Helman params loaded */
28 BOOL ca_rdn_emulate:1; /* do not advertise usable-cert list */
29 BOOL ocsp_hook:1; /* need hshake callback on session */
31 void * libdata0; /* library-dependent preloaded data */
32 void * libdata1; /* library-dependent preloaded data */
37 /* Private structure for the private options and other private data. */
41 uschar *fallback_hosts;
43 host_item *fallback_hostlist;
44 uschar *authenticated_sender;
50 uschar *serialize_hosts;
51 uschar *hosts_try_auth;
52 uschar *hosts_require_alpn;
53 uschar *hosts_require_auth;
54 uschar *hosts_try_chunking;
56 uschar *hosts_try_dane;
57 uschar *hosts_require_dane;
58 uschar *dane_require_tls_ciphers;
60 uschar *hosts_try_fastopen;
62 uschar *hosts_try_prdr;
65 uschar *hosts_request_ocsp;
66 uschar *hosts_require_ocsp;
68 uschar *hosts_require_tls;
69 uschar *hosts_avoid_tls;
70 uschar *hosts_verify_avoid_tls;
71 uschar *hosts_avoid_pipelining;
72 #ifndef DISABLE_PIPE_CONNECT
73 uschar *hosts_pipe_connect;
75 uschar *hosts_avoid_esmtp;
77 uschar *hosts_nopass_tls;
78 uschar *hosts_noproxy_tls;
86 int hosts_max_try_hardlimit;
87 int message_linelength_limit;
88 BOOL address_retry_include_sender;
90 BOOL authenticated_sender_force;
92 BOOL dns_qualify_single;
93 BOOL dns_search_parents;
94 dnssec_domains dnssec;
95 BOOL delay_after_cutoff;
99 BOOL lmtp_ignore_quota;
100 uschar *expand_retry_include_ip_address;
101 BOOL retry_include_ip_address;
107 uschar *tls_certificate;
109 uschar *tls_privatekey;
110 uschar *tls_require_ciphers;
111 # ifndef DISABLE_TLS_RESUME
112 uschar *host_name_extract;
113 uschar *tls_resumption_hosts;
115 const uschar *tls_sni;
116 uschar *tls_verify_certificates;
118 BOOL tls_tempfail_tryclear;
119 uschar *tls_verify_hosts;
120 uschar *tls_try_verify_hosts;
121 uschar *tls_verify_cert_hostnames;
124 uschar *utf8_downconvert;
129 #ifdef EXPERIMENTAL_ARC
133 exim_tlslib_state tls_preload;
135 } smtp_transport_options_block;
137 #define SOB (smtp_transport_options_block *)
140 /* smtp connect context */
143 address_item * addrlist;
145 smtp_connect_args conn_args;
153 #ifndef DISABLE_PIPE_CONNECT
154 BOOL early_pipe_ok:1;
155 BOOL early_pipe_active:1;
159 BOOL pipelining_used:1;
166 BOOL dsn_all_lasthop:1;
167 #if !defined(DISABLE_TLS) && defined(SUPPORT_DANE)
168 BOOL dane_required:1;
170 #ifndef DISABLE_PIPE_CONNECT
171 BOOL pending_BANNER:1;
178 #ifdef EXPERIMENTAL_ESMTP_LIMITS
179 BOOL single_rcpt_domain:1;
181 BOOL completed_addr:1;
184 BOOL send_tlsclose:1;
186 unsigned peer_offered;
187 #ifdef EXPERIMENTAL_ESMTP_LIMITS
188 unsigned peer_limit_mail;
189 unsigned peer_limit_rcpt;
190 unsigned peer_limit_rcptdom;
197 unsigned avoid_option;
200 #ifdef EXPERIMENTAL_DSN_INFO
201 uschar * smtp_greeting;
202 uschar * helo_response;
204 #ifndef DISABLE_PIPE_CONNECT
205 /* Info about the EHLO response stored to / retrieved from cache. When
206 operating early-pipe, we use the cached values. For each of plaintext and
207 crypted we store bitmaps for ESMTP features and AUTH methods. If the LIMITS
208 extension is built and usable them at least one of the limits values cached
209 is nonzero, and we use the values to constrain the connection. */
210 ehlo_resp_precis ehlo_resp;
213 struct timeval delivery_start;
214 address_item * first_addr;
215 address_item * next_addr;
216 address_item * sync_addr;
218 client_conn_ctx cctx;
219 smtp_inblock inblock;
220 smtp_outblock outblock;
221 uschar buffer[DELIVER_BUFFER_SIZE];
222 uschar inbuffer[4096];
223 uschar outbuffer[4096];
226 extern int smtp_setup_conn(smtp_context *, BOOL);
227 extern int smtp_write_mail_and_rcpt_cmds(smtp_context *, int *);
228 extern int smtp_reap_early_pipe(smtp_context *, int *);
231 /* Data for reading the private options. */
233 extern optionlist smtp_transport_options[];
234 extern int smtp_transport_options_count;
236 /* Block containing default values. */
238 extern smtp_transport_options_block smtp_transport_option_defaults;
240 /* The main, init, and closedown entry points for the transport */
242 extern BOOL smtp_transport_entry(transport_instance *, address_item *);
243 extern void smtp_transport_init(transport_instance *);
244 extern void smtp_transport_closedown(transport_instance *);
249 extern int socks_sock_connect(host_item *, int, int, uschar *,
250 transport_instance *, int);
253 /* End of transports/smtp.h */