Logging-only patch for 8BITMIME; bug 817.
[exim.git] / src / src / globals.c
1 /*************************************************
2 *     Exim - an Internet mail transport agent    *
3 *************************************************/
4
5 /* Copyright (c) University of Cambridge 1995 - 2012 */
6 /* See the file NOTICE for conditions of use and distribution. */
7
8 /* All the global variables are defined together in this one module, so
9 that they are easy to find. */
10
11 #include "exim.h"
12
13
14 /* Generic options for auths, all of which live inside auth_instance
15 data blocks and hence have the opt_public flag set. */
16
17 optionlist optionlist_auths[] = {
18   { "client_condition", opt_stringptr | opt_public,
19                  (void *)(offsetof(auth_instance, client_condition)) },
20   { "driver",        opt_stringptr | opt_public,
21                  (void *)(offsetof(auth_instance, driver_name)) },
22   { "public_name",   opt_stringptr | opt_public,
23                  (void *)(offsetof(auth_instance, public_name)) },
24   { "server_advertise_condition", opt_stringptr | opt_public,
25                  (void *)(offsetof(auth_instance, advertise_condition))},
26   { "server_condition", opt_stringptr | opt_public,
27                  (void *)(offsetof(auth_instance, server_condition)) },
28   { "server_debug_print", opt_stringptr | opt_public,
29                  (void *)(offsetof(auth_instance, server_debug_string)) },
30   { "server_mail_auth_condition", opt_stringptr | opt_public,
31                  (void *)(offsetof(auth_instance, mail_auth_condition)) },
32   { "server_set_id", opt_stringptr | opt_public,
33                  (void *)(offsetof(auth_instance, set_id)) }
34 };
35
36 int     optionlist_auths_size = sizeof(optionlist_auths)/sizeof(optionlist);
37
38 /* An empty host aliases list. */
39
40 uschar *no_aliases             = NULL;
41
42
43 /* For comments on these variables, see globals.h. I'm too idle to
44 duplicate them here... */
45
46 #ifdef EXIM_PERL
47 uschar *opt_perl_startup       = NULL;
48 BOOL    opt_perl_at_start      = FALSE;
49 BOOL    opt_perl_started       = FALSE;
50 #endif
51
52 #ifdef EXPAND_DLFUNC
53 tree_node *dlobj_anchor        = NULL;
54 #endif
55
56 #ifdef LOOKUP_IBASE
57 uschar *ibase_servers          = NULL;
58 #endif
59
60 #ifdef LOOKUP_LDAP
61 uschar *eldap_ca_cert_dir      = NULL;
62 uschar *eldap_ca_cert_file     = NULL;
63 uschar *eldap_cert_file        = NULL;
64 uschar *eldap_cert_key         = NULL;
65 uschar *eldap_cipher_suite     = NULL;
66 uschar *eldap_default_servers  = NULL;
67 uschar *eldap_require_cert     = NULL;
68 int     eldap_version          = -1;
69 BOOL    eldap_start_tls        = FALSE;
70 #endif
71
72 #ifdef LOOKUP_MYSQL
73 uschar *mysql_servers          = NULL;
74 #endif
75
76 #ifdef LOOKUP_ORACLE
77 uschar *oracle_servers         = NULL;
78 #endif
79
80 #ifdef LOOKUP_PGSQL
81 uschar *pgsql_servers          = NULL;
82 #endif
83
84 #ifdef LOOKUP_SQLITE
85 int     sqlite_lock_timeout    = 5;
86 #endif
87
88 #ifdef SUPPORT_MOVE_FROZEN_MESSAGES
89 BOOL    move_frozen_messages   = FALSE;
90 #endif
91
92 /* These variables are outside the #ifdef because it keeps the code less
93 cluttered in several places (e.g. during logging) if we can always refer to
94 them. Also, the tls_ variables are now always visible. */
95
96 tls_support tls_in = {
97  -1,   /* tls_active */
98  0,    /* tls_bits */
99  FALSE,/* tls_certificate_verified */
100  NULL, /* tls_cipher */
101  FALSE,/* tls_on_connect */
102  NULL, /* tls_on_connect_ports */
103  NULL, /* tls_peerdn */
104  NULL  /* tls_sni */
105 };
106 tls_support tls_out = {
107  -1,   /* tls_active */
108  0,    /* tls_bits */
109  FALSE,/* tls_certificate_verified */
110  NULL, /* tls_cipher */
111  FALSE,/* tls_on_connect */
112  NULL, /* tls_on_connect_ports */
113  NULL, /* tls_peerdn */
114  NULL  /* tls_sni */
115 };
116
117
118 #ifdef SUPPORT_TLS
119 BOOL    gnutls_compat_mode     = FALSE;
120 BOOL    gnutls_enable_pkcs11   = FALSE;
121 uschar *gnutls_require_mac     = NULL;
122 uschar *gnutls_require_kx      = NULL;
123 uschar *gnutls_require_proto   = NULL;
124 uschar *openssl_options        = NULL;
125 const pcre *regex_STARTTLS     = NULL;
126 uschar *tls_advertise_hosts    = NULL;    /* This is deliberate */
127 uschar *tls_certificate        = NULL;
128 uschar *tls_crl                = NULL;
129 /* This default matches NSS DH_MAX_P_BITS value at current time (2012), because
130 that's the interop problem which has been observed: GnuTLS suggesting a higher
131 bit-count as "NORMAL" (2432) and Thunderbird dropping connection. */
132 int     tls_dh_max_bits        = 2236;
133 uschar *tls_dhparam            = NULL;
134 #if defined(EXPERIMENTAL_OCSP) && !defined(USE_GNUTLS)
135 uschar *tls_ocsp_file          = NULL;
136 #endif
137 BOOL    tls_offered            = FALSE;
138 uschar *tls_privatekey         = NULL;
139 BOOL    tls_remember_esmtp     = FALSE;
140 uschar *tls_require_ciphers    = NULL;
141 uschar *tls_try_verify_hosts   = NULL;
142 uschar *tls_verify_certificates= NULL;
143 uschar *tls_verify_hosts       = NULL;
144 #endif
145
146
147 /* Input-reading functions for messages, so we can use special ones for
148 incoming TCP/IP. The defaults use stdin. We never need these for any
149 stand-alone tests. */
150
151 #ifndef STAND_ALONE
152 int (*receive_getc)(void)      = stdin_getc;
153 int (*receive_ungetc)(int)     = stdin_ungetc;
154 int (*receive_feof)(void)      = stdin_feof;
155 int (*receive_ferror)(void)    = stdin_ferror;
156 BOOL (*receive_smtp_buffered)(void) = NULL;   /* Only used for SMTP */
157 #endif
158
159
160 /* List of per-address expansion variables for clearing and saving/restoring
161 when verifying one address while routing/verifying another. We have to have
162 the size explicit, because it is referenced from more than one module. */
163
164 uschar **address_expansions[ADDRESS_EXPANSIONS_COUNT] = {
165   &deliver_address_data,
166   &deliver_domain,
167   &deliver_domain_data,
168   &deliver_domain_orig,
169   &deliver_domain_parent,
170   &deliver_localpart,
171   &deliver_localpart_data,
172   &deliver_localpart_orig,
173   &deliver_localpart_parent,
174   &deliver_localpart_prefix,
175   &deliver_localpart_suffix,
176   (uschar **)(&deliver_recipients),
177   &deliver_host,
178   &deliver_home,
179   &address_file,
180   &address_pipe,
181   &self_hostname,
182   NULL };
183
184 int address_expansions_count = sizeof(address_expansions)/sizeof(uschar **);
185
186 /* General global variables */
187
188 header_line *acl_added_headers = NULL;
189 tree_node *acl_anchor          = NULL;
190 uschar *acl_arg[9]             = {NULL, NULL, NULL, NULL, NULL,
191                                   NULL, NULL, NULL, NULL};
192 int     acl_narg               = 0;
193
194 uschar *acl_not_smtp           = NULL;
195 #ifdef WITH_CONTENT_SCAN
196 uschar *acl_not_smtp_mime      = NULL;
197 #endif
198 uschar *acl_not_smtp_start     = NULL;
199 uschar *acl_removed_headers    = NULL;
200 uschar *acl_smtp_auth          = NULL;
201 uschar *acl_smtp_connect       = NULL;
202 uschar *acl_smtp_data          = NULL;
203 #ifndef DISABLE_DKIM
204 uschar *acl_smtp_dkim          = NULL;
205 #endif
206 uschar *acl_smtp_etrn          = NULL;
207 uschar *acl_smtp_expn          = NULL;
208 uschar *acl_smtp_helo          = NULL;
209 uschar *acl_smtp_mail          = NULL;
210 uschar *acl_smtp_mailauth      = NULL;
211 #ifdef WITH_CONTENT_SCAN
212 uschar *acl_smtp_mime          = NULL;
213 #endif
214 uschar *acl_smtp_notquit       = NULL;
215 uschar *acl_smtp_predata       = NULL;
216 uschar *acl_smtp_quit          = NULL;
217 uschar *acl_smtp_rcpt          = NULL;
218 uschar *acl_smtp_starttls      = NULL;
219 uschar *acl_smtp_vrfy          = NULL;
220
221 BOOL    acl_temp_details       = FALSE;
222 tree_node *acl_var_c           = NULL;
223 tree_node *acl_var_m           = NULL;
224 uschar *acl_verify_message     = NULL;
225 string_item *acl_warn_logged   = NULL;
226
227 /* Names of SMTP places for use in ACL error messages, and corresponding SMTP
228 error codes - keep in step with definitions of ACL_WHERE_xxxx in macros.h. */
229
230 uschar *acl_wherenames[]       = { US"RCPT",
231                                    US"MAIL",
232                                    US"PREDATA",
233                                    US"MIME",
234                                    US"DKIM",
235                                    US"DATA",
236                                    US"non-SMTP",
237                                    US"AUTH",
238                                    US"connection",
239                                    US"ETRN",
240                                    US"EXPN",
241                                    US"EHLO or HELO",
242                                    US"MAILAUTH",
243                                    US"non-SMTP-start",
244                                    US"NOTQUIT",
245                                    US"QUIT",
246                                    US"STARTTLS",
247                                    US"VRFY",
248                                    US"expansion"
249                                  };
250
251 uschar *acl_wherecodes[]       = { US"550",     /* RCPT */
252                                    US"550",     /* MAIL */
253                                    US"550",     /* PREDATA */
254                                    US"550",     /* MIME */
255                                    US"550",     /* DKIM */
256                                    US"550",     /* DATA */
257                                    US"0",       /* not SMTP; not relevant */
258                                    US"503",     /* AUTH */
259                                    US"550",     /* connect */
260                                    US"458",     /* ETRN */
261                                    US"550",     /* EXPN */
262                                    US"550",     /* HELO/EHLO */
263                                    US"0",       /* MAILAUTH; not relevant */
264                                    US"0",       /* not SMTP; not relevant */
265                                    US"0",       /* NOTQUIT; not relevant */
266                                    US"0",       /* QUIT; not relevant */
267                                    US"550",     /* STARTTLS */
268                                    US"252",     /* VRFY */
269                                    US"0"        /* unknown; not relevant */
270                                  };
271
272 BOOL    active_local_from_check = FALSE;
273 BOOL    active_local_sender_retain = FALSE;
274 int     body_8bitmime = 0;
275 BOOL    accept_8bitmime        = TRUE; /* deliberately not RFC compliant */
276 address_item  *addr_duplicate  = NULL;
277
278 address_item address_defaults = {
279   NULL,                 /* next */
280   NULL,                 /* parent */
281   NULL,                 /* first */
282   NULL,                 /* dupof */
283   NULL,                 /* start_router */
284   NULL,                 /* router */
285   NULL,                 /* transport */
286   NULL,                 /* host_list */
287   NULL,                 /* host_used */
288   NULL,                 /* fallback_hosts */
289   NULL,                 /* reply */
290   NULL,                 /* retries */
291   NULL,                 /* address */
292   NULL,                 /* unique */
293   NULL,                 /* cc_local_part */
294   NULL,                 /* lc_local_part */
295   NULL,                 /* local_part */
296   NULL,                 /* prefix */
297   NULL,                 /* suffix */
298   NULL,                 /* domain */
299   NULL,                 /* address_retry_key */
300   NULL,                 /* domain_retry_key */
301   NULL,                 /* current_dir */
302   NULL,                 /* home_dir */
303   NULL,                 /* message */
304   NULL,                 /* user_message */
305   NULL,                 /* onetime_parent */
306   NULL,                 /* pipe_expandn */
307   NULL,                 /* return_filename */
308   NULL,                 /* self_hostname */
309   NULL,                 /* shadow_message */
310   #ifdef SUPPORT_TLS
311   NULL,                 /* cipher */
312   NULL,                 /* peerdn */
313   #endif
314   (uid_t)(-1),          /* uid */
315   (gid_t)(-1),          /* gid */
316   0,                    /* flags */
317   { 0 },                /* domain_cache - any larger array should be zeroed */
318   { 0 },                /* localpart_cache - ditto */
319   -1,                   /* mode */
320   0,                    /* more_errno */
321   ERRNO_UNKNOWNERROR,   /* basic_errno */
322   0,                    /* child_count */
323   -1,                   /* return_file */
324   SPECIAL_NONE,         /* special_action */
325   DEFER,                /* transport_return */
326   {                     /* fields that are propagated to children */
327     NULL,               /* address_data */
328     NULL,               /* domain_data */
329     NULL,               /* localpart_data */
330     NULL,               /* errors_address */
331     NULL,               /* extra_headers */
332     NULL,               /* remove_headers */
333 #ifdef EXPERIMENTAL_SRS
334     NULL,               /* srs_sender */
335 #endif
336   }
337 };
338
339 uschar *address_file           = NULL;
340 uschar *address_pipe           = NULL;
341 BOOL    address_test_mode      = FALSE;
342 tree_node *addresslist_anchor  = NULL;
343 int     addresslist_count      = 0;
344 gid_t  *admin_groups           = NULL;
345 BOOL    admin_user             = FALSE;
346 BOOL    allow_auth_unadvertised= FALSE;
347 BOOL    allow_domain_literals  = FALSE;
348 BOOL    allow_mx_to_ip         = FALSE;
349 BOOL    allow_unqualified_recipient = TRUE;    /* For local messages */
350 BOOL    allow_unqualified_sender = TRUE;       /* Reset for SMTP */
351 BOOL    allow_utf8_domains     = FALSE;
352 uschar *authenticated_id       = NULL;
353 uschar *authenticated_sender   = NULL;
354 BOOL    authentication_failed  = FALSE;
355 auth_instance  *auths          = NULL;
356 uschar *auth_advertise_hosts   = US"*";
357 auth_instance auth_defaults    = {
358     NULL,                      /* chain pointer */
359     NULL,                      /* name */
360     NULL,                      /* info */
361     NULL,                      /* private options block pointer */
362     NULL,                      /* driver_name */
363     NULL,                      /* advertise_condition */
364     NULL,                      /* client_condition */
365     NULL,                      /* public_name */
366     NULL,                      /* set_id */
367     NULL,                      /* server_mail_auth_condition */
368     NULL,                      /* server_debug_string */
369     NULL,                      /* server_condition */
370     FALSE,                     /* client */
371     FALSE,                     /* server */
372     FALSE                      /* advertised */
373 };
374
375 uschar *auth_defer_msg         = US"reason not recorded";
376 uschar *auth_defer_user_msg    = US"";
377 uschar *auth_vars[AUTH_VARS];
378 int     auto_thaw              = 0;
379 #ifdef WITH_CONTENT_SCAN
380 BOOL    av_failed              = FALSE;
381 uschar *av_scanner             = US"sophie:/var/run/sophie";  /* AV scanner */
382 #endif
383
384 BOOL    background_daemon      = TRUE;
385
386 #if BASE_62 == 62
387 uschar *base62_chars=
388     US"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
389 #else
390 uschar *base62_chars= US"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
391 #endif
392
393 uschar *bi_command             = NULL;
394 uschar *big_buffer             = NULL;
395 int     big_buffer_size        = BIG_BUFFER_SIZE;
396 #ifdef EXPERIMENTAL_BRIGHTMAIL
397 uschar *bmi_alt_location       = NULL;
398 uschar *bmi_base64_tracker_verdict = NULL;
399 uschar *bmi_base64_verdict     = NULL;
400 uschar *bmi_config_file        = US"/opt/brightmail/etc/brightmail.cfg";
401 int     bmi_deliver            = 1;
402 int     bmi_run                = 0;
403 uschar *bmi_verdicts           = NULL;
404 #endif
405 int     body_linecount         = 0;
406 int     body_zerocount         = 0;
407 uschar *bounce_message_file    = NULL;
408 uschar *bounce_message_text    = NULL;
409 uschar *bounce_recipient       = NULL;
410 BOOL    bounce_return_body     = TRUE;
411 BOOL    bounce_return_message  = TRUE;
412 int     bounce_return_size_limit = 100*1024;
413 uschar *bounce_sender_authentication = NULL;
414 int     bsmtp_transaction_linecount = 0;
415
416 int     callout_cache_domain_positive_expire = 7*24*60*60;
417 int     callout_cache_domain_negative_expire = 3*60*60;
418 int     callout_cache_positive_expire = 24*60*60;
419 int     callout_cache_negative_expire = 2*60*60;
420 uschar *callout_random_local_part = US"$primary_hostname-$tod_epoch-testing";
421 uschar *check_dns_names_pattern= US"(?i)^(?>(?(1)\\.|())[^\\W](?>[a-z0-9/_-]*[^\\W])?)+(\\.?)$";
422 int     check_log_inodes       = 0;
423 int     check_log_space        = 0;
424 BOOL    check_rfc2047_length   = TRUE;
425 int     check_spool_inodes     = 0;
426 int     check_spool_space      = 0;
427 int     clmacro_count          = 0;
428 uschar *clmacros[MAX_CLMACROS];
429 BOOL    config_changed         = FALSE;
430 FILE   *config_file            = NULL;
431 uschar *config_filename        = NULL;
432 int     config_lineno          = 0;
433 #ifdef CONFIGURE_GROUP
434 gid_t   config_gid             = CONFIGURE_GROUP;
435 #endif
436 uschar *config_main_filelist   = US CONFIGURE_FILE
437                          "\0<-----------Space to patch configure_filename->";
438 uschar *config_main_filename   = NULL;
439
440 #ifdef CONFIGURE_OWNER
441 uid_t   config_uid             = CONFIGURE_OWNER;
442 #endif
443
444 int     connection_max_messages= -1;
445 uschar *continue_hostname      = NULL;
446 uschar *continue_host_address  = NULL;
447 BOOL    continue_more          = FALSE;
448 int     continue_sequence      = 1;
449 uschar *continue_transport     = NULL;
450
451 uschar *csa_status             = NULL;
452 BOOL    cutthrough_delivery    = FALSE;
453 int     cutthrough_fd          = -1;
454
455 BOOL    daemon_listen          = FALSE;
456 uschar *daemon_smtp_port       = US"smtp";
457 int     daemon_startup_retries = 9;
458 int     daemon_startup_sleep   = 30;
459
460 #ifdef EXPERIMENTAL_DCC
461 BOOL    dcc_direct_add_header  = FALSE;
462 uschar *dcc_header             = NULL;
463 uschar *dcc_result             = NULL;
464 uschar *dccifd_address         = US"/usr/local/dcc/var/dccifd";
465 uschar *dccifd_options         = US"header";
466 #endif
467
468 BOOL    debug_daemon           = FALSE;
469 int     debug_fd               = -1;
470 FILE   *debug_file             = NULL;
471 bit_table debug_options[]      = {
472   { US"acl",            D_acl },
473   { US"all",            D_all },
474   { US"auth",           D_auth },
475   { US"deliver",        D_deliver },
476   { US"dns",            D_dns },
477   { US"dnsbl",          D_dnsbl },
478   { US"exec",           D_exec },
479   { US"expand",         D_expand },
480   { US"filter",         D_filter },
481   { US"hints_lookup",   D_hints_lookup },
482   { US"host_lookup",    D_host_lookup },
483   { US"ident",          D_ident },
484   { US"interface",      D_interface },
485   { US"lists",          D_lists },
486   { US"load",           D_load },
487   { US"local_scan",     D_local_scan },
488   { US"lookup",         D_lookup },
489   { US"memory",         D_memory },
490   { US"pid",            D_pid },
491   { US"process_info",   D_process_info },
492   { US"queue_run",      D_queue_run },
493   { US"receive",        D_receive },
494   { US"resolver",       D_resolver },
495   { US"retry",          D_retry },
496   { US"rewrite",        D_rewrite },
497   { US"route",          D_route },
498   { US"timestamp",      D_timestamp },
499   { US"tls",            D_tls },
500   { US"transport",      D_transport },
501   { US"uid",            D_uid },
502   { US"verify",         D_verify }
503 };
504 int     debug_options_count    = sizeof(debug_options)/sizeof(bit_table);
505 unsigned int debug_selector    = 0;
506 int     delay_warning[DELAY_WARNING_SIZE] = { DELAY_WARNING_SIZE, 1, 24*60*60 };
507 uschar *delay_warning_condition=
508   US"${if or {"
509             "{ !eq{$h_list-id:$h_list-post:$h_list-subscribe:}{} }"
510             "{ match{$h_precedence:}{(?i)bulk|list|junk} }"
511             "{ match{$h_auto-submitted:}{(?i)auto-generated|auto-replied} }"
512             "} {no}{yes}}";
513 BOOL    delivery_date_remove   = TRUE;
514 uschar *deliver_address_data   = NULL;
515 int     deliver_datafile       = -1;
516 uschar *deliver_domain         = NULL;
517 uschar *deliver_domain_data    = NULL;
518 uschar *deliver_domain_orig    = NULL;
519 uschar *deliver_domain_parent  = NULL;
520 BOOL    deliver_drop_privilege = FALSE;
521 BOOL    deliver_firsttime      = FALSE;
522 BOOL    deliver_force          = FALSE;
523 BOOL    deliver_freeze         = FALSE;
524 int     deliver_frozen_at      = 0;
525 uschar *deliver_home           = NULL;
526 uschar *deliver_host           = NULL;
527 uschar *deliver_host_address   = NULL;
528 uschar *deliver_in_buffer      = NULL;
529 ino_t   deliver_inode          = 0;
530 uschar *deliver_localpart      = NULL;
531 uschar *deliver_localpart_data = NULL;
532 uschar *deliver_localpart_orig = NULL;
533 uschar *deliver_localpart_parent = NULL;
534 uschar *deliver_localpart_prefix = NULL;
535 uschar *deliver_localpart_suffix = NULL;
536 BOOL    deliver_force_thaw     = FALSE;
537 BOOL    deliver_manual_thaw    = FALSE;
538 uschar *deliver_out_buffer     = NULL;
539 int     deliver_queue_load_max = -1;
540 address_item  *deliver_recipients = NULL;
541 uschar *deliver_selectstring   = NULL;
542 BOOL    deliver_selectstring_regex = FALSE;
543 uschar *deliver_selectstring_sender = NULL;
544 BOOL    deliver_selectstring_sender_regex = FALSE;
545 #ifdef WITH_OLD_DEMIME
546 int     demime_errorlevel      = 0;
547 int     demime_ok              = 0;
548 uschar *demime_reason          = NULL;
549 #endif
550 BOOL    disable_callout_flush  = FALSE;
551 BOOL    disable_delay_flush    = FALSE;
552 #ifdef ENABLE_DISABLE_FSYNC
553 BOOL    disable_fsync          = FALSE;
554 #endif
555 BOOL    disable_ipv6           = FALSE;
556 BOOL    disable_logging        = FALSE;
557
558 #ifndef DISABLE_DKIM
559 uschar *dkim_cur_signer          = NULL;
560 uschar *dkim_signers             = NULL;
561 uschar *dkim_signing_domain      = NULL;
562 uschar *dkim_signing_selector    = NULL;
563 uschar *dkim_verify_signers      = US"$dkim_signers";
564 BOOL    dkim_collect_input       = FALSE;
565 BOOL    dkim_disable_verify      = FALSE;
566 #endif
567
568 uschar *dns_again_means_nonexist = NULL;
569 int     dns_csa_search_limit   = 5;
570 BOOL    dns_csa_use_reverse    = TRUE;
571 uschar *dns_ipv4_lookup        = NULL;
572 int     dns_retrans            = 0;
573 int     dns_retry              = 0;
574 int     dns_use_dnssec         = -1; /* <0 = not coerced */
575 int     dns_use_edns0          = -1; /* <0 = not coerced */
576 uschar *dnslist_domain         = NULL;
577 uschar *dnslist_matched        = NULL;
578 uschar *dnslist_text           = NULL;
579 uschar *dnslist_value          = NULL;
580 tree_node *domainlist_anchor   = NULL;
581 int     domainlist_count       = 0;
582 BOOL    dont_deliver           = FALSE;
583 BOOL    dot_ends               = TRUE;
584 BOOL    drop_cr                = FALSE;         /* No longer used */
585 uschar *dsn_from               = US DEFAULT_DSN_FROM;
586
587 BOOL    enable_dollar_recipients = FALSE;
588 BOOL    envelope_to_remove     = TRUE;
589 int     errno_quota            = ERRNO_QUOTA;
590 uschar *errors_copy            = NULL;
591 int     error_handling         = ERRORS_SENDER;
592 uschar *errors_reply_to        = NULL;
593 int     errors_sender_rc       = EXIT_FAILURE;
594
595 gid_t   exim_gid               = EXIM_GID;
596 BOOL    exim_gid_set           = TRUE;          /* This gid is always set */
597 uschar *exim_path              = US BIN_DIRECTORY "/exim"
598                         "\0<---------------Space to patch exim_path->";
599 uid_t   exim_uid               = EXIM_UID;
600 BOOL    exim_uid_set           = TRUE;          /* This uid is always set */
601 int     expand_forbid          = 0;
602 int     expand_nlength[EXPAND_MAXN+1];
603 int     expand_nmax            = -1;
604 uschar *expand_nstring[EXPAND_MAXN+1];
605 BOOL    expand_string_forcedfail = FALSE;
606 uschar *expand_string_message;
607 BOOL    extract_addresses_remove_arguments = TRUE;
608 uschar *extra_local_interfaces = NULL;
609
610 int     fake_response          = OK;
611 uschar *fake_response_text     = US"Your message has been rejected but is "
612                                    "being kept for evaluation.\nIf it was a "
613                                    "legitimate message, it may still be "
614                                    "delivered to the target recipient(s).";
615 int     filter_n[FILTER_VARIABLE_COUNT];
616 BOOL    filter_running         = FALSE;
617 int     filter_sn[FILTER_VARIABLE_COUNT];
618 int     filter_test            = FTEST_NONE;
619 uschar *filter_test_sfile      = NULL;
620 uschar *filter_test_ufile      = NULL;
621 uschar *filter_thisaddress     = NULL;
622 int     finduser_retries       = 0;
623 #ifdef WITH_OLD_DEMIME
624 uschar *found_extension        = NULL;
625 #endif
626 uid_t   fixed_never_users[]    = { FIXED_NEVER_USERS };
627 uschar *freeze_tell            = NULL;
628 uschar *freeze_tell_config     = NULL;
629 uschar *fudged_queue_times     = US"";
630
631 uschar *gecos_name             = NULL;
632 uschar *gecos_pattern          = NULL;
633 rewrite_rule  *global_rewrite_rules = NULL;
634
635 uschar *headers_charset        = US HEADERS_CHARSET;
636 int     header_insert_maxlen   = 64 * 1024;
637 header_line  *header_last      = NULL;
638 header_line  *header_list      = NULL;
639 int     header_maxsize         = HEADER_MAXSIZE;
640 int     header_line_maxsize    = 0;
641
642 header_name header_names[] = {
643   { US"bcc",            3, TRUE,  htype_bcc },
644   { US"cc",             2, TRUE,  htype_cc },
645   { US"date",           4, TRUE,  htype_date },
646   { US"delivery-date", 13, FALSE, htype_delivery_date },
647   { US"envelope-to",   11, FALSE, htype_envelope_to },
648   { US"from",           4, TRUE,  htype_from },
649   { US"message-id",    10, TRUE,  htype_id },
650   { US"received",       8, FALSE, htype_received },
651   { US"reply-to",       8, FALSE, htype_reply_to },
652   { US"return-path",   11, FALSE, htype_return_path },
653   { US"sender",         6, TRUE,  htype_sender },
654   { US"subject",        7, FALSE, htype_subject },
655   { US"to",             2, TRUE,  htype_to }
656 };
657
658 int header_names_size          = sizeof(header_names)/sizeof(header_name);
659
660 BOOL    header_rewritten       = FALSE;
661 uschar *helo_accept_junk_hosts = NULL;
662 uschar *helo_allow_chars       = US"";
663 uschar *helo_lookup_domains    = US"@ : @[]";
664 uschar *helo_try_verify_hosts  = NULL;
665 BOOL    helo_verified          = FALSE;
666 BOOL    helo_verify_failed     = FALSE;
667 uschar *helo_verify_hosts      = NULL;
668 const uschar *hex_digits       = CUS"0123456789abcdef";
669 uschar *hold_domains           = NULL;
670 BOOL    host_checking          = FALSE;
671 BOOL    host_checking_callout  = FALSE;
672 uschar *host_data              = NULL;
673 BOOL    host_find_failed_syntax= FALSE;
674 uschar *host_lookup            = NULL;
675 BOOL    host_lookup_deferred   = FALSE;
676 BOOL    host_lookup_failed     = FALSE;
677 uschar *host_lookup_order      = US"bydns:byaddr";
678 uschar *host_lookup_msg        = US"";
679 int     host_number            = 0;
680 uschar *host_number_string     = NULL;
681 uschar *host_reject_connection = NULL;
682 tree_node *hostlist_anchor     = NULL;
683 int     hostlist_count         = 0;
684 uschar *hosts_treat_as_local   = NULL;
685 uschar *hosts_connection_nolog = NULL;
686
687 int     ignore_bounce_errors_after = 10*7*24*60*60;  /* 10 weeks */
688 BOOL    ignore_fromline_local  = FALSE;
689 uschar *ignore_fromline_hosts  = NULL;
690 BOOL    inetd_wait_mode        = FALSE;
691 int     inetd_wait_timeout     = -1;
692 uschar *interface_address      = NULL;
693 int     interface_port         = -1;
694 BOOL    is_inetd               = FALSE;
695 uschar *iterate_item           = NULL;
696
697 int     journal_fd             = -1;
698
699 int     keep_malformed         = 4*24*60*60;    /* 4 days */
700
701 uschar *eldap_dn               = NULL;
702 int     load_average           = -2;
703 BOOL    local_error_message    = FALSE;
704 BOOL    local_from_check       = TRUE;
705 uschar *local_from_prefix      = NULL;
706 uschar *local_from_suffix      = NULL;
707
708 #if HAVE_IPV6
709 uschar *local_interfaces       = US"<; ::0 ; 0.0.0.0";
710 #else
711 uschar *local_interfaces       = US"0.0.0.0";
712 #endif
713
714 uschar *local_scan_data        = NULL;
715 int     local_scan_timeout     = 5*60;
716 BOOL    local_sender_retain    = FALSE;
717 gid_t   local_user_gid         = (gid_t)(-1);
718 uid_t   local_user_uid         = (uid_t)(-1);
719
720 tree_node *localpartlist_anchor= NULL;
721 int     localpartlist_count    = 0;
722 uschar *log_buffer             = NULL;
723 unsigned int log_extra_selector = LX_default;
724 uschar *log_file_path          = US LOG_FILE_PATH
725                            "\0<--------------Space to patch log_file_path->";
726
727 /* Those log options with L_xxx identifiers have values less than 0x800000 and
728 are the ones that get put into log_write_selector. They can be used in calls to
729 log_write() to test for the bit. The options with LX_xxx identifiers have
730 values greater than 0x80000000 and are put into log_extra_selector (without the
731 top bit). They are never used in calls to log_write(), but are tested
732 independently. This separation became necessary when the number of log
733 selectors was getting close to filling a 32-bit word. */
734
735 /* Note that this list must be in alphabetical order. */
736
737 bit_table log_options[]        = {
738   { US"8bitmime",                     LX_8bitmime },
739   { US"acl_warn_skipped",             LX_acl_warn_skipped },
740   { US"address_rewrite",              L_address_rewrite },
741   { US"all",                          L_all },
742   { US"all_parents",                  L_all_parents },
743   { US"arguments",                    LX_arguments },
744   { US"connection_reject",            L_connection_reject },
745   { US"delay_delivery",               L_delay_delivery },
746   { US"deliver_time",                 LX_deliver_time },
747   { US"delivery_size",                LX_delivery_size },
748   { US"dnslist_defer",                L_dnslist_defer },
749   { US"etrn",                         L_etrn },
750   { US"host_lookup_failed",           L_host_lookup_failed },
751   { US"ident_timeout",                LX_ident_timeout },
752   { US"incoming_interface",           LX_incoming_interface },
753   { US"incoming_port",                LX_incoming_port },
754   { US"lost_incoming_connection",     L_lost_incoming_connection },
755   { US"outgoing_port",                LX_outgoing_port },
756   { US"pid",                          LX_pid },
757   { US"queue_run",                    L_queue_run },
758   { US"queue_time",                   LX_queue_time },
759   { US"queue_time_overall",           LX_queue_time_overall },
760   { US"received_recipients",          LX_received_recipients },
761   { US"received_sender",              LX_received_sender },
762   { US"rejected_header",              LX_rejected_header },
763   { US"rejected_headers",             LX_rejected_header },
764   { US"retry_defer",                  L_retry_defer },
765   { US"return_path_on_delivery",      LX_return_path_on_delivery },
766   { US"sender_on_delivery",           LX_sender_on_delivery },
767   { US"sender_verify_fail",           LX_sender_verify_fail },
768   { US"size_reject",                  L_size_reject },
769   { US"skip_delivery",                L_skip_delivery },
770   { US"smtp_confirmation",            LX_smtp_confirmation },
771   { US"smtp_connection",              L_smtp_connection },
772   { US"smtp_incomplete_transaction",  L_smtp_incomplete_transaction },
773   { US"smtp_no_mail",                 LX_smtp_no_mail },
774   { US"smtp_protocol_error",          L_smtp_protocol_error },
775   { US"smtp_syntax_error",            L_smtp_syntax_error },
776   { US"subject",                      LX_subject },
777   { US"tls_certificate_verified",     LX_tls_certificate_verified },
778   { US"tls_cipher",                   LX_tls_cipher },
779   { US"tls_peerdn",                   LX_tls_peerdn },
780   { US"tls_sni",                      LX_tls_sni },
781   { US"unknown_in_list",              LX_unknown_in_list }
782 };
783
784 int     log_options_count      = sizeof(log_options)/sizeof(bit_table);
785 int     log_reject_target      = 0;
786 uschar *log_selector_string    = NULL;
787 FILE   *log_stderr             = NULL;
788 BOOL    log_testing_mode       = FALSE;
789 BOOL    log_timezone           = FALSE;
790 unsigned int log_write_selector= L_default;
791 uschar *login_sender_address   = NULL;
792 int     lookup_open_max        = 25;
793 uschar *lookup_value           = NULL;
794
795 macro_item  *macros            = NULL;
796 uschar *mailstore_basename     = NULL;
797 #ifdef WITH_CONTENT_SCAN
798 uschar *malware_name           = NULL;  /* Virus Name */
799 #endif
800 int     max_received_linelength= 0;
801 int     max_username_length    = 0;
802 int     message_age            = 0;
803 uschar *message_body           = NULL;
804 uschar *message_body_end       = NULL;
805 BOOL    message_body_newlines  = FALSE;
806 int     message_body_size      = 0;
807 int     message_body_visible   = 500;
808 int     message_ended          = END_NOTSTARTED;
809 uschar *message_headers        = NULL;
810 uschar *message_id;
811 uschar *message_id_domain      = NULL;
812 uschar *message_id_text        = NULL;
813 struct timeval message_id_tv   = { 0, 0 };
814 uschar  message_id_option[MESSAGE_ID_LENGTH + 3];
815 uschar *message_id_external;
816 int     message_linecount      = 0;
817 BOOL    message_logs           = TRUE;
818 int     message_size           = 0;
819 uschar *message_size_limit     = US"50M";
820 uschar  message_subdir[2]      = { 0, 0 };
821 uschar *message_reference      = NULL;
822
823 /* MIME ACL expandables */
824 #ifdef WITH_CONTENT_SCAN
825 int     mime_anomaly_level     = 0;
826 const uschar *mime_anomaly_text      = NULL;
827 uschar *mime_boundary          = NULL;
828 uschar *mime_charset           = NULL;
829 uschar *mime_content_description = NULL;
830 uschar *mime_content_disposition = NULL;
831 uschar *mime_content_id        = NULL;
832 unsigned int mime_content_size = 0;
833 uschar *mime_content_transfer_encoding = NULL;
834 uschar *mime_content_type      = NULL;
835 uschar *mime_decoded_filename  = NULL;
836 uschar *mime_filename          = NULL;
837 int     mime_is_multipart      = 0;
838 int     mime_is_coverletter    = 0;
839 int     mime_is_rfc822         = 0;
840 int     mime_part_count        = -1;
841 #endif
842
843 BOOL    mua_wrapper            = FALSE;
844
845 uid_t  *never_users            = NULL;
846 #ifdef WITH_CONTENT_SCAN
847 BOOL    no_mbox_unspool        = FALSE;
848 #endif
849 BOOL    no_multiline_responses = FALSE;
850
851 uid_t   original_euid;
852 gid_t   originator_gid;
853 uschar *originator_login       = NULL;
854 uschar *originator_name        = NULL;
855 uid_t   originator_uid;
856 uschar *override_local_interfaces = NULL;
857 uschar *override_pid_file_path = NULL;
858
859 BOOL    parse_allow_group      = FALSE;
860 BOOL    parse_found_group      = FALSE;
861 uschar *percent_hack_domains   = NULL;
862 uschar *pid_file_path          = US PID_FILE_PATH
863                            "\0<--------------Space to patch pid_file_path->";
864 BOOL    pipelining_enable      = TRUE;
865 uschar *pipelining_advertise_hosts = US"*";
866 BOOL    preserve_message_logs  = FALSE;
867 uschar *primary_hostname       = NULL;
868 BOOL    print_topbitchars      = FALSE;
869 uschar  process_info[PROCESS_INFO_SIZE];
870 int     process_info_len       = 0;
871 uschar *process_log_path       = NULL;
872 BOOL    prod_requires_admin    = TRUE;
873 uschar *prvscheck_address      = NULL;
874 uschar *prvscheck_keynum       = NULL;
875 uschar *prvscheck_result       = NULL;
876
877
878 uschar *qualify_domain_recipient = NULL;
879 uschar *qualify_domain_sender  = NULL;
880 BOOL    queue_2stage           = FALSE;
881 uschar *queue_domains          = NULL;
882 int     queue_interval         = -1;
883 BOOL    queue_list_requires_admin = TRUE;
884 BOOL    queue_only             = FALSE;
885 uschar *queue_only_file        = NULL;
886 int     queue_only_load        = -1;
887 BOOL    queue_only_load_latch  = TRUE;
888 BOOL    queue_only_override    = TRUE;
889 BOOL    queue_only_policy      = FALSE;
890 BOOL    queue_run_first_delivery = FALSE;
891 BOOL    queue_run_force        = FALSE;
892 BOOL    queue_run_in_order     = FALSE;
893 BOOL    queue_run_local        = FALSE;
894 int     queue_run_max          = 5;
895 pid_t   queue_run_pid          = (pid_t)0;
896 int     queue_run_pipe         = -1;
897 BOOL    queue_running          = FALSE;
898 BOOL    queue_smtp             = FALSE;
899 uschar *queue_smtp_domains     = NULL;
900
901 unsigned int random_seed       = 0;
902 tree_node *ratelimiters_cmd    = NULL;
903 tree_node *ratelimiters_conn   = NULL;
904 tree_node *ratelimiters_mail   = NULL;
905 uschar *raw_active_hostname    = NULL;
906 uschar *raw_sender             = NULL;
907 uschar **raw_recipients        = NULL;
908 int     raw_recipients_count   = 0;
909
910 int     rcpt_count             = 0;
911 int     rcpt_fail_count        = 0;
912 int     rcpt_defer_count       = 0;
913 gid_t   real_gid;
914 uid_t   real_uid;
915 BOOL    really_exim            = TRUE;
916 BOOL    receive_call_bombout   = FALSE;
917 int     receive_linecount      = 0;
918 int     receive_messagecount   = 0;
919 int     receive_timeout        = 0;
920 int     received_count         = 0;
921 uschar *received_for           = NULL;
922
923 /*  This is the default text for Received headers generated by Exim. The
924 date  will be automatically added on the end. */
925
926 uschar *received_header_text   = US
927      "Received: "
928      "${if def:sender_rcvhost {from $sender_rcvhost\n\t}"
929      "{${if def:sender_ident {from ${quote_local_part:$sender_ident} }}"
930      "${if def:sender_helo_name {(helo=$sender_helo_name)\n\t}}}}"
931      "by $primary_hostname "
932      "${if def:received_protocol {with $received_protocol}} "
933      #ifdef SUPPORT_TLS
934      "${if def:tls_cipher {($tls_cipher)\n\t}}"
935      #endif
936      "(Exim $version_number)\n\t"
937      "${if def:sender_address {(envelope-from <$sender_address>)\n\t}}"
938      "id $message_exim_id"
939      "${if def:received_for {\n\tfor $received_for}}"
940      "\0<---------------Space to patch received_header_text->";
941
942 int     received_headers_max   = 30;
943 uschar *received_protocol      = NULL;
944 int     received_time          = 0;
945 uschar *recipient_data         = NULL;
946 uschar *recipient_unqualified_hosts = NULL;
947 uschar *recipient_verify_failure = NULL;
948 int     recipients_count       = 0;
949 BOOL    recipients_discarded   = FALSE;
950 recipient_item  *recipients_list = NULL;
951 int     recipients_list_max    = 0;
952 int     recipients_max         = 0;
953 BOOL    recipients_max_reject  = FALSE;
954 const pcre *regex_AUTH         = NULL;
955 const pcre *regex_check_dns_names = NULL;
956 const pcre *regex_From         = NULL;
957 const pcre *regex_IGNOREQUOTA  = NULL;
958 const pcre *regex_PIPELINING   = NULL;
959 const pcre *regex_SIZE         = NULL;
960 const pcre *regex_smtp_code    = NULL;
961 const pcre *regex_ismsgid      = NULL;
962 #ifdef WHITELIST_D_MACROS
963 const pcre *regex_whitelisted_macro = NULL;
964 #endif
965 #ifdef WITH_CONTENT_SCAN
966 uschar *regex_match_string     = NULL;
967 #endif
968 int     remote_delivery_count  = 0;
969 int     remote_max_parallel    = 2;
970 uschar *remote_sort_domains    = NULL;
971 int     retry_data_expire      = 7*24*60*60;
972 int     retry_interval_max     = 24*60*60;
973 int     retry_maximum_timeout  = 0;        /* set from retry config */
974 retry_config  *retries         = NULL;
975 uschar *return_path            = NULL;
976 BOOL    return_path_remove     = TRUE;
977 int     rewrite_existflags     = 0;
978 uschar *rfc1413_hosts          = US"*";
979 int     rfc1413_query_timeout  = 5;
980 /* BOOL    rfc821_domains         = FALSE;  <<< on the way out */
981 uid_t   root_gid               = ROOT_GID;
982 uid_t   root_uid               = ROOT_UID;
983
984 router_instance  *routers  = NULL;
985 router_instance  router_defaults = {
986     NULL,                      /* chain pointer */
987     NULL,                      /* name */
988     NULL,                      /* info */
989     NULL,                      /* private options block pointer */
990     NULL,                      /* driver name */
991
992     NULL,                      /* address_data */
993 #ifdef EXPERIMENTAL_BRIGHTMAIL
994     NULL,                      /* bmi_rule */
995 #endif
996     NULL,                      /* cannot_route_message */
997     NULL,                      /* condition */
998     NULL,                      /* current_directory */
999     NULL,                      /* debug_string */
1000     NULL,                      /* domains */
1001     NULL,                      /* errors_to */
1002     NULL,                      /* expand_gid */
1003     NULL,                      /* expand_uid */
1004     NULL,                      /* expand_more */
1005     NULL,                      /* expand_unseen */
1006     NULL,                      /* extra_headers */
1007     NULL,                      /* fallback_hosts */
1008     NULL,                      /* home_directory */
1009     NULL,                      /* ignore_target_hosts */
1010     NULL,                      /* local_parts */
1011     NULL,                      /* pass_router_name */
1012     NULL,                      /* prefix */
1013     NULL,                      /* redirect_router_name */
1014     NULL,                      /* remove_headers */
1015     NULL,                      /* require_files */
1016     NULL,                      /* router_home_directory */
1017     US"freeze",                /* self */
1018     NULL,                      /* senders */
1019     NULL,                      /* suffix */
1020     NULL,                      /* translate_ip_address */
1021     NULL,                      /* transport_name */
1022
1023     TRUE,                      /* address_test */
1024 #ifdef EXPERIMENTAL_BRIGHTMAIL
1025     FALSE,                     /* bmi_deliver_alternate */
1026     FALSE,                     /* bmi_deliver_default */
1027     FALSE,                     /* bmi_dont_deliver */
1028 #endif
1029     TRUE,                      /* expn */
1030     FALSE,                     /* caseful_local_part */
1031     FALSE,                     /* check_local_user */
1032     FALSE,                     /* disable_logging */
1033     FALSE,                     /* fail_verify_recipient */
1034     FALSE,                     /* fail_verify_sender */
1035     FALSE,                     /* gid_set */
1036     FALSE,                     /* initgroups */
1037     TRUE_UNSET,                /* log_as_local */
1038     TRUE,                      /* more */
1039     FALSE,                     /* pass_on_timeout */
1040     FALSE,                     /* prefix_optional */
1041     TRUE,                      /* repeat_use */
1042     TRUE_UNSET,                /* retry_use_local_part - fudge "unset" */
1043     FALSE,                     /* same_domain_copy_routing */
1044     FALSE,                     /* self_rewrite */
1045     FALSE,                     /* suffix_optional */
1046     FALSE,                     /* verify_only */
1047     TRUE,                      /* verify_recipient */
1048     TRUE,                      /* verify_sender */
1049     FALSE,                     /* uid_set */
1050     FALSE,                     /* unseen */
1051
1052     self_freeze,               /* self_code */
1053     (uid_t)(-1),               /* uid */
1054     (gid_t)(-1),               /* gid */
1055
1056     NULL,                      /* fallback_hostlist */
1057     NULL,                      /* transport instance */
1058     NULL,                      /* pass_router */
1059     NULL                       /* redirect_router */
1060 };
1061
1062 ip_address_item *running_interfaces = NULL;
1063 BOOL    running_in_test_harness = FALSE;
1064
1065 /* This is a weird one. The following string gets patched in the binary by the
1066 script that sets up a copy of Exim for running in the test harness. It seems
1067 that compilers are now clever, and share constant strings if they can.
1068 Elsewhere in Exim the string "<" is used. The compiler optimization seems to
1069 make use of the end of this string in order to save space. So the patching then
1070 wrecks this. We defeat this optimization by adding some additional characters
1071 onto the end of the string. */
1072
1073 uschar *running_status         = US">>>running<<<" "\0EXTRA";
1074
1075 int     runrc                  = 0;
1076
1077 uschar *search_error_message   = NULL;
1078 BOOL    search_find_defer      = FALSE;
1079 uschar *self_hostname          = NULL;
1080 uschar *sender_address         = NULL;
1081 unsigned int sender_address_cache[(MAX_NAMED_LIST * 2)/32];
1082 uschar *sender_address_data    = NULL;
1083 BOOL    sender_address_forced  = FALSE;
1084 uschar *sender_address_unrewritten = NULL;
1085 uschar *sender_data            = NULL;
1086 unsigned int sender_domain_cache[(MAX_NAMED_LIST * 2)/32];
1087 uschar *sender_fullhost        = NULL;
1088 uschar *sender_helo_name       = NULL;
1089 uschar **sender_host_aliases   = &no_aliases;
1090 uschar *sender_host_address    = NULL;
1091 uschar *sender_host_authenticated = NULL;
1092 unsigned int sender_host_cache[(MAX_NAMED_LIST * 2)/32];
1093 BOOL    sender_host_dnssec     = FALSE;
1094 uschar *sender_host_name       = NULL;
1095 int     sender_host_port       = 0;
1096 BOOL    sender_host_notsocket  = FALSE;
1097 BOOL    sender_host_unknown    = FALSE;
1098 uschar *sender_ident           = NULL;
1099 BOOL    sender_local           = FALSE;
1100 BOOL    sender_name_forced     = FALSE;
1101 uschar *sender_rate            = NULL;
1102 uschar *sender_rate_limit      = NULL;
1103 uschar *sender_rate_period     = NULL;
1104 uschar *sender_rcvhost         = NULL;
1105 BOOL    sender_set_untrusted   = FALSE;
1106 uschar *sender_unqualified_hosts = NULL;
1107 uschar *sender_verify_failure = NULL;
1108 address_item *sender_verified_list  = NULL;
1109 address_item *sender_verified_failed = NULL;
1110 int     sender_verified_rc     = -1;
1111 BOOL    sender_verified_responded = FALSE;
1112 uschar *sending_ip_address     = NULL;
1113 int     sending_port           = -1;
1114 SIGNAL_BOOL sigalrm_seen       = FALSE;
1115 uschar **sighup_argv           = NULL;
1116 int     smtp_accept_count      = 0;
1117 BOOL    smtp_accept_keepalive  = TRUE;
1118 int     smtp_accept_max        = 20;
1119 int     smtp_accept_max_nonmail= 10;
1120 uschar *smtp_accept_max_nonmail_hosts = US"*";
1121 int     smtp_accept_max_per_connection = 1000;
1122 uschar *smtp_accept_max_per_host = NULL;
1123 int     smtp_accept_queue      = 0;
1124 int     smtp_accept_queue_per_connection = 10;
1125 int     smtp_accept_reserve    = 0;
1126 uschar *smtp_active_hostname   = NULL;
1127 BOOL    smtp_authenticated     = FALSE;
1128 uschar *smtp_banner            = US"$smtp_active_hostname ESMTP "
1129                              "Exim $version_number $tod_full"
1130                              "\0<---------------Space to patch smtp_banner->";
1131 BOOL    smtp_batched_input     = FALSE;
1132 BOOL    smtp_check_spool_space = TRUE;
1133 int     smtp_ch_index          = 0;
1134 uschar *smtp_cmd_argument      = NULL;
1135 uschar *smtp_cmd_buffer        = NULL;
1136 time_t  smtp_connection_start  = 0;
1137 uschar  smtp_connection_had[SMTP_HBUFF_SIZE];
1138 int     smtp_connect_backlog   = 20;
1139 double  smtp_delay_mail        = 0.0;
1140 double  smtp_delay_rcpt        = 0.0;
1141 BOOL    smtp_enforce_sync      = TRUE;
1142 FILE   *smtp_in                = NULL;
1143 BOOL    smtp_input             = FALSE;
1144 int     smtp_load_reserve      = -1;
1145 int     smtp_mailcmd_count     = 0;
1146 FILE   *smtp_out               = NULL;
1147 uschar *smtp_etrn_command      = NULL;
1148 BOOL    smtp_etrn_serialize    = TRUE;
1149 int     smtp_max_synprot_errors= 3;
1150 int     smtp_max_unknown_commands = 3;
1151 uschar *smtp_notquit_reason    = NULL;
1152 uschar *smtp_ratelimit_hosts   = NULL;
1153 uschar *smtp_ratelimit_mail    = NULL;
1154 uschar *smtp_ratelimit_rcpt    = NULL;
1155 uschar *smtp_read_error        = US"";
1156 int     smtp_receive_timeout   = 5*60;
1157 uschar *smtp_reserve_hosts     = NULL;
1158 BOOL    smtp_return_error_details = FALSE;
1159 int     smtp_rlm_base          = 0;
1160 double  smtp_rlm_factor        = 0.0;
1161 int     smtp_rlm_limit         = 0;
1162 int     smtp_rlm_threshold     = INT_MAX;
1163 int     smtp_rlr_base          = 0;
1164 double  smtp_rlr_factor        = 0.0;
1165 int     smtp_rlr_limit         = 0;
1166 int     smtp_rlr_threshold     = INT_MAX;
1167 BOOL    smtp_use_pipelining    = FALSE;
1168 BOOL    smtp_use_size          = FALSE;
1169
1170 #ifdef WITH_CONTENT_SCAN
1171 uschar *spamd_address          = US"127.0.0.1 783";
1172 uschar *spam_bar               = NULL;
1173 uschar *spam_report            = NULL;
1174 uschar *spam_score             = NULL;
1175 uschar *spam_score_int         = NULL;
1176 #endif
1177 #ifdef EXPERIMENTAL_SPF
1178 uschar *spf_guess              = US"v=spf1 a/24 mx/24 ptr ?all";
1179 uschar *spf_header_comment     = NULL;
1180 uschar *spf_received           = NULL;
1181 uschar *spf_result             = NULL;
1182 uschar *spf_smtp_comment       = NULL;
1183 #endif
1184
1185 BOOL    split_spool_directory  = FALSE;
1186 uschar *spool_directory        = US SPOOL_DIRECTORY
1187                            "\0<--------------Space to patch spool_directory->";
1188 #ifdef EXPERIMENTAL_SRS
1189 uschar *srs_config             = NULL;
1190 uschar *srs_db_address         = NULL;
1191 uschar *srs_db_key             = NULL;
1192 int     srs_hashlength         = 6;
1193 int     srs_hashmin            = -1;
1194 int     srs_maxage             = 31;
1195 uschar *srs_orig_recipient     = NULL;
1196 uschar *srs_orig_sender        = NULL;
1197 uschar *srs_recipient          = NULL;
1198 uschar *srs_secrets            = NULL;
1199 uschar *srs_status             = NULL;
1200 BOOL    srs_usehash            = TRUE;
1201 BOOL    srs_usetimestamp       = TRUE;
1202 #endif
1203 BOOL    strict_acl_vars        = FALSE;
1204 int     string_datestamp_offset= -1;
1205 int     string_datestamp_length= 0;
1206 int     string_datestamp_type  = -1;
1207 BOOL    strip_excess_angle_brackets = FALSE;
1208 BOOL    strip_trailing_dot     = FALSE;
1209 uschar *submission_domain      = NULL;
1210 BOOL    submission_mode        = FALSE;
1211 uschar *submission_name        = NULL;
1212 BOOL    suppress_local_fixups  = FALSE;
1213 BOOL    suppress_local_fixups_default = FALSE;
1214 BOOL    synchronous_delivery   = FALSE;
1215 BOOL    syslog_duplication     = TRUE;
1216 int     syslog_facility        = LOG_MAIL;
1217 uschar *syslog_processname     = US"exim";
1218 BOOL    syslog_timestamp       = TRUE;
1219 uschar *system_filter          = NULL;
1220
1221 uschar *system_filter_directory_transport = NULL;
1222 uschar *system_filter_file_transport = NULL;
1223 uschar *system_filter_pipe_transport = NULL;
1224 uschar *system_filter_reply_transport = NULL;
1225
1226 gid_t   system_filter_gid      = 0;
1227 BOOL    system_filter_gid_set  = FALSE;
1228 uid_t   system_filter_uid      = (uid_t)-1;
1229 BOOL    system_filter_uid_set  = FALSE;
1230 BOOL    system_filtering       = FALSE;
1231
1232 BOOL    tcp_nodelay            = TRUE;
1233 #ifdef USE_TCP_WRAPPERS
1234 uschar *tcp_wrappers_daemon_name = US TCP_WRAPPERS_DAEMON_NAME;
1235 #endif
1236 int     test_harness_load_avg  = 0;
1237 int     thismessage_size_limit = 0;
1238 int     timeout_frozen_after   = 0;
1239 BOOL    timestamps_utc         = FALSE;
1240
1241 transport_instance  *transports = NULL;
1242
1243 transport_instance  transport_defaults = {
1244     NULL,                     /* chain pointer */
1245     NULL,                     /* name */
1246     NULL,                     /* info */
1247     NULL,                     /* private options block pointer */
1248     NULL,                     /* driver name */
1249     NULL,                     /* setup entry point */
1250     1,                        /* batch_max */
1251     NULL,                     /* batch_id */
1252     NULL,                     /* home_dir */
1253     NULL,                     /* current_dir */
1254     TRUE,                     /* multi-domain */
1255     FALSE,                    /* overrides_hosts */
1256     100,                      /* max_addresses */
1257     500,                      /* connection_max_messages */
1258     FALSE,                    /* deliver_as_creator */
1259     FALSE,                    /* disable_logging */
1260     FALSE,                    /* initgroups */
1261     FALSE,                    /* uid_set */
1262     FALSE,                    /* gid_set */
1263     (uid_t)(-1),              /* uid */
1264     (gid_t)(-1),              /* gid */
1265     NULL,                     /* expand_uid */
1266     NULL,                     /* expand_gid */
1267     NULL,                     /* warn_message */
1268     NULL,                     /* shadow */
1269     NULL,                     /* shadow_condition */
1270     NULL,                     /* filter_command */
1271     NULL,                     /* add_headers */
1272     NULL,                     /* remove_headers */
1273     NULL,                     /* return_path */
1274     NULL,                     /* debug_string */
1275     NULL,                     /* message_size_limit */
1276     NULL,                     /* headers_rewrite */
1277     NULL,                     /* rewrite_rules */
1278     0,                        /* rewrite_existflags */
1279     300,                      /* filter_timeout */
1280     FALSE,                    /* body_only */
1281     FALSE,                    /* delivery_date_add */
1282     FALSE,                    /* envelope_to_add */
1283     FALSE,                    /* headers_only */
1284     FALSE,                    /* rcpt_include_affixes */
1285     FALSE,                    /* return_path_add */
1286     FALSE,                    /* return_output */
1287     FALSE,                    /* return_fail_output */
1288     FALSE,                    /* log_output */
1289     FALSE,                    /* log_fail_output */
1290     FALSE,                    /* log_defer_output */
1291     TRUE_UNSET                /* retry_use_local_part: BOOL, but set neither
1292                                  1 nor 0 so can detect unset */
1293 };
1294
1295 int     transport_count;
1296 int     transport_newlines;
1297 uschar **transport_filter_argv  = NULL;
1298 int     transport_filter_timeout;
1299 BOOL    transport_filter_timed_out = FALSE;
1300 int     transport_write_timeout= 0;
1301
1302 tree_node  *tree_dns_fails     = NULL;
1303 tree_node  *tree_duplicates    = NULL;
1304 tree_node  *tree_nonrecipients = NULL;
1305 tree_node  *tree_unusable      = NULL;
1306
1307 BOOL    trusted_caller         = FALSE;
1308 BOOL    trusted_config         = TRUE;
1309 gid_t  *trusted_groups         = NULL;
1310 uid_t  *trusted_users          = NULL;
1311 uschar *timezone_string        = US TIMEZONE_DEFAULT;
1312
1313 uschar *unknown_login          = NULL;
1314 uschar *unknown_username       = NULL;
1315 uschar *untrusted_set_sender   = NULL;
1316
1317 /*  A regex for matching a "From_" line in an incoming message, in the form
1318
1319     From ph10 Fri Jan  5 12:35 GMT 1996
1320
1321 which  the "mail" commands send to the MTA (undocumented, of course), or in
1322 the  form
1323
1324     From ph10 Fri, 7 Jan 97 14:00:00 GMT
1325
1326 which  is apparently used by some UUCPs, despite it not being in RFC 976.
1327 Because  of variations in time formats, just match up to the minutes. That
1328 should  be sufficient. Examples have been seen of time fields like 12:1:03,
1329 so  just require one digit for hours and minutes. The weekday is also absent
1330 in  some forms. */
1331
1332 uschar *uucp_from_pattern      = US
1333    "^From\\s+(\\S+)\\s+(?:[a-zA-Z]{3},?\\s+)?"    /* Common start */
1334    "(?:"                                          /* Non-extracting bracket */
1335    "[a-zA-Z]{3}\\s+\\d?\\d|"                      /* First form */
1336    "\\d?\\d\\s+[a-zA-Z]{3}\\s+\\d\\d(?:\\d\\d)?"  /* Second form */
1337    ")"                                            /* End alternation */
1338    "\\s+\\d\\d?:\\d\\d?";                         /* Start of time */
1339
1340 uschar *uucp_from_sender       = US"$1";
1341
1342 uschar *warn_message_file      = NULL;
1343 uschar *warnmsg_delay          = NULL;
1344 uschar *warnmsg_recipients     = NULL;
1345 BOOL    write_rejectlog        = TRUE;
1346
1347 uschar *version_copyright      =
1348  US"Copyright (c) University of Cambridge, 1995 - 2012\n"
1349    "(c) The Exim Maintainers and contributors in ACKNOWLEDGMENTS file, 2007 - 2012";
1350 uschar *version_date           = US"?";
1351 uschar *version_cnumber        = US"????";
1352 uschar *version_string         = US"?";
1353
1354 int     warning_count          = 0;
1355
1356 /*  End of globals.c */