1 /*************************************************
2 * Exim - an Internet mail transport agent *
3 *************************************************/
5 /* Copyright (c) University of Cambridge 1995 - 2018 */
6 /* Copyright (c) The Exim Maintainers 2020 */
7 /* See the file NOTICE for conditions of use and distribution. */
9 #define DELIVER_BUFFER_SIZE 4096
12 #define PENDING_DEFER (PENDING + DEFER)
13 #define PENDING_OK (PENDING + OK)
17 /* Flags structure for validity of TLS configuration */
20 BOOL conn_certs:1; /* certificates etc. loaded */
21 BOOL cabundle:1; /* CA certificates loaded */
22 BOOL crl:1; /* CRL loaded */
23 BOOL pri_string:1; /* cipher priority-string cache loaded */
24 BOOL dh:1; /* Diffie-Helman params loaded */
25 BOOL ecdh:1; /* EC Diffie-Helman params loaded */
27 BOOL ca_rdn_emulate:1; /* do not advertise usable-cert list */
28 BOOL ocsp_hook:1; /* need hshake callback on session */
30 void * libdata0; /* library-dependent preloaded data */
31 void * libdata1; /* library-dependent preloaded data */
36 /* Private structure for the private options and other private data. */
40 uschar *fallback_hosts;
42 host_item *fallback_hostlist;
43 uschar *authenticated_sender;
49 uschar *serialize_hosts;
50 uschar *hosts_try_auth;
51 uschar *hosts_require_alpn;
52 uschar *hosts_require_auth;
53 uschar *hosts_try_chunking;
55 uschar *hosts_try_dane;
56 uschar *hosts_require_dane;
57 uschar *dane_require_tls_ciphers;
59 uschar *hosts_try_fastopen;
61 uschar *hosts_try_prdr;
64 uschar *hosts_request_ocsp;
65 uschar *hosts_require_ocsp;
67 uschar *hosts_require_tls;
68 uschar *hosts_avoid_tls;
69 uschar *hosts_verify_avoid_tls;
70 uschar *hosts_avoid_pipelining;
71 #ifndef DISABLE_PIPE_CONNECT
72 uschar *hosts_pipe_connect;
74 uschar *hosts_avoid_esmtp;
76 uschar *hosts_nopass_tls;
77 uschar *hosts_noproxy_tls;
85 int hosts_max_try_hardlimit;
86 int message_linelength_limit;
87 BOOL address_retry_include_sender;
89 BOOL authenticated_sender_force;
91 BOOL dns_qualify_single;
92 BOOL dns_search_parents;
93 dnssec_domains dnssec;
94 BOOL delay_after_cutoff;
98 BOOL lmtp_ignore_quota;
99 uschar *expand_retry_include_ip_address;
100 BOOL retry_include_ip_address;
106 uschar *tls_certificate;
108 uschar *tls_privatekey;
109 uschar *tls_require_ciphers;
110 # ifndef DISABLE_TLS_RESUME
111 uschar *tls_resumption_hosts;
113 const uschar *tls_sni;
114 uschar *tls_verify_certificates;
116 BOOL tls_tempfail_tryclear;
117 uschar *tls_verify_hosts;
118 uschar *tls_try_verify_hosts;
119 uschar *tls_verify_cert_hostnames;
122 uschar *utf8_downconvert;
127 #ifdef EXPERIMENTAL_ARC
131 exim_tlslib_state tls_preload;
133 } smtp_transport_options_block;
135 #define SOB (smtp_transport_options_block *)
138 /* smtp connect context */
141 address_item * addrlist;
143 smtp_connect_args conn_args;
151 #ifndef DISABLE_PIPE_CONNECT
152 BOOL early_pipe_ok:1;
153 BOOL early_pipe_active:1;
157 BOOL pipelining_used:1;
164 BOOL dsn_all_lasthop:1;
165 #if !defined(DISABLE_TLS) && defined(SUPPORT_DANE)
166 BOOL dane_required:1;
168 #ifndef DISABLE_PIPE_CONNECT
169 BOOL pending_BANNER:1;
176 #ifdef EXPERIMENTAL_ESMTP_LIMITS
177 BOOL single_rcpt_domain:1;
179 BOOL completed_addr:1;
182 BOOL send_tlsclose:1;
184 unsigned peer_offered;
185 #ifdef EXPERIMENTAL_ESMTP_LIMITS
186 unsigned peer_limit_mail;
187 unsigned peer_limit_rcpt;
188 unsigned peer_limit_rcptdom;
195 unsigned avoid_option;
198 #ifdef EXPERIMENTAL_DSN_INFO
199 uschar * smtp_greeting;
200 uschar * helo_response;
202 #ifndef DISABLE_PIPE_CONNECT
203 /* Info about the EHLO response stored to / retrieved from cache. When
204 operating early-pipe, we use the cached values. For each of plaintext and
205 crypted we store bitmaps for ESMTP features and AUTH methods. If the LIMITS
206 extension is built and usable them at least one of the limits values cached
207 is nonzero, and we use the values to constrain the connection. */
208 ehlo_resp_precis ehlo_resp;
211 struct timeval delivery_start;
212 address_item * first_addr;
213 address_item * next_addr;
214 address_item * sync_addr;
216 client_conn_ctx cctx;
217 smtp_inblock inblock;
218 smtp_outblock outblock;
219 uschar buffer[DELIVER_BUFFER_SIZE];
220 uschar inbuffer[4096];
221 uschar outbuffer[4096];
224 extern int smtp_setup_conn(smtp_context *, BOOL);
225 extern int smtp_write_mail_and_rcpt_cmds(smtp_context *, int *);
226 extern int smtp_reap_early_pipe(smtp_context *, int *);
229 /* Data for reading the private options. */
231 extern optionlist smtp_transport_options[];
232 extern int smtp_transport_options_count;
234 /* Block containing default values. */
236 extern smtp_transport_options_block smtp_transport_option_defaults;
238 /* The main, init, and closedown entry points for the transport */
240 extern BOOL smtp_transport_entry(transport_instance *, address_item *);
241 extern void smtp_transport_init(transport_instance *);
242 extern void smtp_transport_closedown(transport_instance *);
247 extern int socks_sock_connect(host_item *, int, int, uschar *,
248 transport_instance *, int);
251 /* End of transports/smtp.h */