3 # This is a Perl script that reads an Exim run-time configuration file and
4 # checks for settings that were valid prior to release 3.00 but which were
5 # obsoleted by that release. It writes a new file with suggested changes to
6 # the standard output, and commentary about what it has done to stderr.
8 # It is assumed that the input is a valid Exim configuration file.
11 ##################################################
13 ##################################################
15 # This is called for the main and the driver sections, not for retry
16 # or rewrite sections (which are unmodified).
21 return "comment" if $line =~ /^\s*(#|$)/;
22 return "end" if $line =~ /^\s*end\s*$/;
24 # Macros are recognized only in the first section of the file.
26 return "macro" if $prefix eq "" && $line =~ /^\s*[A-Z]/;
28 # Pick out the name at the start and the rest of the line (into global
29 # variables) and return whether the start of a driver or not.
31 ($i1,$name,$i2,$rest) = $line =~ /^(\s*)([a-z0-9_]+)(\s*)(.*?)\s*$/;
32 return ($rest =~ /^:/)? "driver" : "option";
38 ##################################################
39 # Add transport setting to a director #
40 ##################################################
42 # This function adds a transport setting to an aliasfile or forwardfile
43 # director if a global setting exists and a local one does not. If neither
44 # exist, it adds file/pipe/reply, but not the directory ones.
49 my($key) = "$prefix$driver.${option}_transport";
52 if (exists $o{"address_${option}_transport"})
54 print STDOUT "# >> Option added by convert4r3\n";
55 printf STDOUT "${i1}${option}_transport = %s\n",
56 $o{"address_${option}_transport"};
58 "\n%03d ${option}_transport added to $driver director.\n",
63 if ($option eq "pipe" || $option eq "file" || $option eq "reply")
65 print STDOUT "# >> Option added by convert4r3\n";
66 printf STDOUT "${i1}${option}_transport = address_${option}\n";
68 "\n%03d ${option}_transport added to $driver director.\n",
78 ##################################################
79 # Negate a list of things #
80 ##################################################
85 return $list if ! defined $list;
87 ($list) = $list =~ /^"?(.*?)"?\s*$/s;
89 # Under Perl 5.005 we can split very nicely at colons, ignoring double
92 # @split = split /\s*(?<!:):(?!:)\s*(?:\\\s*)?/s, $list;
94 # However, we'd better make this work under Perl 5.004, since there is
95 # a lot of that about.
97 $list =~ s/::/>%%%%</g;
98 @split = split /\s*:\s*(?:\\\s*)?/s, $list;
99 foreach $item (@split)
101 $item =~ s/>%%%%</::/g;
112 ##################################################
114 ##################################################
116 # This function is called after we have generated no output for an option;
117 # it skips subsequent blank lines if the previous line was blank.
123 $i++ while $c[$i+1] =~ /^\s*$/;
132 ##################################################
133 # Get base name of data key #
134 ##################################################
137 return "$_[0]" if $_[0] !~ /^(?:d|r|t)\.[^.]+\.(.*)/;
143 ##################################################
144 # Amalgamate accept/reject/reject_except #
145 ##################################################
147 # This function amalgamates the three previous kinds of
148 # option into a single list, using negation for the middle one if
149 # the final argument is "+", or for the outer two if the final
153 my($accept,$reject,$reject_except,$name);
154 my($last_was_negated) = 0;
159 $reject_except = $o{$_[2]};
164 ($accept) = $accept =~ /^"?(.*?)"?\s*$/s if defined $accept;
165 $reject = &negate($reject) if defined $reject;
166 ($reject_except) = $reject_except =~ /^"?(.*?)"?\s*$/s if defined $reject_except;
170 $accept = &negate($accept) if defined $accept;
171 ($reject) = $reject =~ /^"?(.*?)"?\s*$/s if defined $reject;
172 $reject_except = &negate($reject_except) if defined $reject_except;
175 print STDOUT "# >> Option rewritten by convert4r3\n";
176 print STDOUT "${i1}$name = \"";
178 if (defined $reject_except)
180 print STDOUT "$reject_except";
182 $last_was_negated = ($_[4] ne "+");
186 print STDOUT "$join$reject";
188 $last_was_negated = ($_[4] eq "+");
192 print STDOUT "$join$accept";
193 $last_was_negated = ($_[4] ne "+");
197 print STDOUT "$join*" if $last_was_negated;
202 my($driver_type) = "";
204 if ($_[0] =~ /^(d|r|t)\.([^.]+)\./ ||
205 $_[1] =~ /^(d|r|t)\.([^.]+)\./ ||
206 $_[2] =~ /^(d|r|t)\.([^.]+)\./)
208 $driver_type = ($1 eq 'd')? "director" : ($1 eq 'r')? "router" : "transport";
212 my($x) = ($driver_type ne "")? " in \"$driver_name\" $driver_type" : "";
214 my($l0) = &base($_[0]);
215 my($l1) = &base($_[1]);
216 my($l2) = &base($_[2]);
223 printf STDERR "\n%03d $l1 converted to $name$x.\n", ++$count;
227 printf STDERR "\n%03d $l0 and $l1\n amalgamated into $name$x.\n",
235 printf STDERR "\n%03d $l0 and $l2\n amalgamated into $name$x.\n",
240 printf STDERR "\n%03d $l0, $l1 and $l2\n amalgamated into " .
241 "$name$x.\n", ++$count;
249 ##################################################
250 # Join two lists, if they exist #
251 ##################################################
254 my($l1) = $o{"$_[0]"};
255 my($l2) = $o{"$_[1]"};
257 return $l2 if (!defined $l1);
258 return $l1 if (!defined $l2);
260 ($l1) = $l1 =~ /^"?(.*?)"?\s*$/s;
261 ($l2) = $l2 =~ /^"?(.*?)"?\s*$/s;
269 ##################################################
270 # Amalgamate accept/reject/reject_except pairs #
271 ##################################################
273 # This is like amalgamate, but it combines pairs of arguments, and
274 # doesn't output commentary (easier to write a generic one for the few
277 sub amalgamatepairs {
278 my($accept) = &pair($_[0], $_[1]);
279 my($reject) = &pair($_[2], $_[3]);
280 my($reject_except) = &pair($_[4], $_[5]);
281 my($last_was_negated) = 0;
286 ($accept) = $accept =~ /^"?(.*?)"?\s*$/s if defined $accept;
287 $reject = &negate($reject) if defined $reject;
288 ($reject_except) = $reject_except =~ /^"?(.*?)"?\s*$/s if defined $reject_except;
292 $accept = &negate($accept) if defined $accept;
293 ($reject) = $reject =~ /^"?(.*?)"?$/s if defined $reject;
294 $reject_except = &negate($reject_except) if defined $reject_except;
297 print STDOUT "# >> Option rewritten by convert4r3\n";
298 print STDOUT "${i1}$_[6] = \"";
300 if (defined $reject_except)
302 print STDOUT "$reject_except";
304 $last_was_negated = ($_[7] ne "+");
308 print STDOUT "$join$reject";
310 $last_was_negated = ($_[7] eq "+");
314 print STDOUT "$join$accept";
315 $last_was_negated = ($_[7] ne "+");
319 print STDOUT "$join*" if $last_was_negated;
325 ##################################################
326 # Amalgamate boolean and exception list(s) #
327 ##################################################
329 sub amalgboolandlist {
330 my($name,$bool,$e1,$e2) = @_;
332 print STDOUT "# >> Option rewritten by convert4r3\n";
333 if ($bool eq "false")
335 printf STDOUT "$i1$name =\n";
339 printf STDOUT "$i1$name = ";
340 my($n1) = &negate($o{$e1});
341 my($n2) = &negate($o{$e2});
342 if (!defined $n1 && !defined $n2)
348 print STDOUT "\"$n2 : \\\n *\"\n";
352 print STDOUT "\"$n1 : \\\n *\"\n";
356 print STDOUT "\"$n1 : \\\n $n2 : \\\n *\"\n";
363 ##################################################
364 # Convert mask format #
365 ##################################################
367 # This function converts an address and mask in old-fashioned dotted-quad
368 # format into an address plus a new format mask.
370 @byte_list = (0, 128, 192, 224, 240, 248, 252, 254, 255);
373 my($address,$mask) = @_;
377 my(@bytes) = split /\./, $mask;
379 for ($i = 0; $i < 4; $i++)
381 for ($j = 0; $j <= 8; $j++)
383 if ($bytes[$i] == $byte_list[$j])
388 for ($i++; $i < 4; $i++)
390 $j = 9 if ($bytes[$i] != 0);
399 print STDERR "*** IP mask $mask cannot be converted to /n format. ***\n";
400 return "$address/$mask";
404 if (!defined $masks{$mask})
406 printf STDERR "\n%03d IP address mask $mask converted to /$length\n",
407 ++$count, $mask, $length;
411 return sprintf "$address/%d", $length;
418 ##################################################
420 ##################################################
422 print STDERR "Exim pre-release 3.00 configuration file converter.\n";
425 $seen_helo_accept_junk = 0;
426 $seen_hold_domains = 0;
427 $seen_receiver_unqualified = 0;
428 $seen_receiver_verify_except = 0;
429 $seen_receiver_verify_senders = 0;
430 $seen_rfc1413_except = 0;
431 $seen_sender_accept = 0;
432 $seen_sender_accept_recipients = 0;
433 $seen_sender_host_accept = 0;
434 $seen_sender_host_accept_recipients = 0;
435 $seen_sender_host_accept_relay = 0;
436 $seen_sender_unqualified = 0;
437 $seen_sender_verify_except_hosts = 0;
440 $seen_smtp_reserve = 0;
443 # Read the entire file into an array
447 # First, go through the input and covert any net masks in the old dotted-quad
448 # style into the new /n style.
450 for ($i = 0; $i < scalar(@c); $i++)
453 s"((?:\d{1,3}\.){3}\d{1,3})/((?:\d{1,3}\.){3}\d{1,3})"&mask($1,$2)"eg;
456 # We now make two more passes over the input. In the first pass, we place all
457 # the option values into an associative array. Main options are keyed by their
458 # names; options for drivers are keyed by a driver type letter, the driver
459 # name, and the option name, dot-separated. In the second pass we modify
460 # the options if necessary, and write the output file.
462 for ($pass = 1; $pass < 3; $pass++)
468 for ($i = 0; $i < scalar(@c); $i++)
470 # Everything after the router section is just copied in pass 2 and
473 if ($prefix eq "end")
475 print STDOUT "$c[$i]\n" if $pass == 2;
481 $type = &checkline($c[$i]);
483 # Skip comments in pass 1; copy in pass 2
485 if ($type eq "comment")
487 $last_was_blank = ($c[$i] =~ /^\s*$/)? 1 : 0;
488 print STDOUT "$c[$i]\n" if $pass == 2;
492 # Skip/copy macro definitions, but must handle continuations
494 if ($type eq "macro")
496 print STDOUT "$c[$i]\n" if $pass == 2;
497 while ($c[$i] =~ /\\\s*$/)
500 print STDOUT "$c[$i]\n" if $pass == 2;
506 # Handle end of section
510 $prefix = "end"if $prefix eq "r.";
511 $prefix = "r." if $prefix eq "d.";
512 $prefix = "d." if $prefix eq "t.";
513 $prefix = "t." if $prefix eq "";
514 print STDOUT "$c[$i]\n" if $pass == 2;
519 # Handle start of a new driver
521 if ($type eq "driver")
524 print STDOUT "$c[$i]\n" if $pass == 2;
527 $seen_local_parts = 0;
529 $seen_mx_domains = 0;
534 # Handle definition of an option
536 if ($type eq "option")
538 # Handle continued strings
540 if ($rest =~ /^=\s*".*\\$/)
544 $rest .= "\n$c[++$i]";
545 last unless $c[$i] =~ /(\\\s*$|^\s*#)/;
549 # Remove any terminating commas and semicolons in pass 2
551 if ($pass == 2 && $rest =~ /[;,]\s*$/)
553 $rest =~ s/\s*[;,]\s*$//;
557 "\n%03d Terminating semicolons and commas removed from driver " .
558 "options.\n", ++$count;
563 # Convert all booleans to "x = true/false" format, but save the
564 # original so that it can be reproduced unchanged for options that
565 # are not of interest.
570 if ($name =~ /^not?_(.*)/)
575 elsif ($rest !~ /^=/)
580 # Set up the associative array key, and get rid of the = on the data
582 $key = ($prefix eq "")? "$name" : "$prefix$driver.$name";
583 ($rest) = $rest =~ /^=\s*(.*)/s;
585 # Create the associative array of values in pass 1
592 # In pass 2, test for interesting options and do the necessary; copy
597 ########## Global configuration ##########
599 # These global options are abolished
601 if ($name eq "address_directory_transport" ||
602 $name eq "address_directory2_transport" ||
603 $name eq "address_file_transport" ||
604 $name eq "address_pipe_transport" ||
605 $name eq "address_reply_transport")
607 ($n2) = $name =~ /^address_(.*)/;
608 printf STDERR "\n%03d $name option deleted.\n", ++$count;
609 printf STDERR " $n2 will be added to appropriate directors.\n";
610 $i = &skipblanks($i);
614 # This debugging option is abolished
616 elsif ($name eq "sender_verify_log_details")
618 printf STDERR "\n%03d $name option deleted.\n", ++$count;
619 printf STDERR " (Little used facility abolished.)\n";
622 # This option has been renamed
624 elsif ($name eq "check_dns_names")
626 $origname =~ s/check_dns/dns_check/;
627 print STDOUT "# >> Option rewritten by convert4r3\n";
628 print STDOUT "$i1$origname$i2$origrest\n";
629 printf STDERR "\n%03d check_dns_names renamed as dns_check_names.\n",
633 # helo_accept_junk_nets is abolished
635 elsif ($name eq "helo_accept_junk_nets" ||
636 $name eq "helo_accept_junk_hosts")
638 if (!$seen_helo_accept_junk)
640 &amalgamate("helo_accept_junk_nets", "",
641 "helo_accept_junk_hosts", "helo_accept_junk_hosts", "+");
642 $seen_helo_accept_junk = 1;
646 $i = &skipblanks($i);
651 # helo_verify_except_{hosts,nets} are abolished, and helo_verify
652 # is now a host list instead of a boolean.
654 elsif ($name eq "helo_verify")
656 &amalgboolandlist("helo_verify", $rest, "helo_verify_except_hosts",
657 "helo_verify_except_nets");
658 printf STDERR "\n%03d helo_verify converted to host list.\n",
661 elsif ($name eq "helo_verify_except_hosts" ||
662 $name eq "helo_verify_except_nets")
664 $i = &skipblanks($i);
668 # helo_verify_nets was an old synonym for host_lookup_nets; only
669 # one of them will be encountered. Change to a new name.
671 elsif ($name eq "helo_verify_nets" ||
672 $name eq "host_lookup_nets")
674 print STDOUT "# >> Option rewritten by convert4r3\n";
675 print STDOUT "${i1}host_lookup$i2$origrest\n";
676 printf STDERR "\n%03d $name renamed as host_lookup.\n", ++$count;
679 # hold_domains_except is abolished; add as negated items to
682 elsif ($name eq "hold_domains_except" ||
683 $name eq "hold_domains")
685 if ($seen_hold_domains) # If already done with these
686 { # omit, and following blanks.
687 $i = &skipblanks($i);
690 $seen_hold_domains = 1;
692 if (exists $o{"hold_domains_except"})
694 &amalgamate("hold_domains", "hold_domains_except", "",
695 "hold_domains", "+");
699 print STDOUT "$i1$origname$i2$origrest\n";
703 # ignore_fromline_nets is renamed as ignore_fromline_hosts
705 elsif ($name eq "ignore_fromline_nets")
707 $origname =~ s/_nets/_hosts/;
708 print STDOUT "# >> Option rewritten by convert4r3\n";
709 print STDOUT "$i1$origname$i2$origrest\n";
711 "\n%03d ignore_fromline_nets renamed as ignore_fromline_hosts.\n",
715 # Output a warning for message filters with no transports set
717 elsif ($name eq "message_filter")
719 print STDOUT "$i1$origname$i2$origrest\n";
721 if (!exists $o{"message_filter_directory_transport"} &&
722 !exists $o{"message_filter_directory2_transport"} &&
723 !exists $o{"message_filter_file_transport"} &&
724 !exists $o{"message_filter_pipe_transport"} &&
725 !exists $o{"message_filter_reply_transport"})
728 "\n%03d message_filter is set, but no message_filter transports "
730 . " If your filter generates file or pipe deliveries, or "
732 . " you will need to define "
733 . "message_filter_{file,pipe,reply}_transport\n"
734 . " options, as required.\n", ++$count;
738 # queue_remote_except is abolished, and queue_remote is replaced by
739 # queue_remote_domains, which is a host list.
741 elsif ($name eq "queue_remote")
743 &amalgboolandlist("queue_remote_domains", $rest,
744 "queue_remote_except", "");
746 "\n%03d queue_remote converted to domain list queue_remote_domains.\n",
749 elsif ($name eq "queue_remote_except")
751 $i = &skipblanks($i);
755 # queue_smtp_except is abolished, and queue_smtp is replaced by
756 # queue_smtp_domains, which is a host list.
758 elsif ($name eq "queue_smtp")
760 &amalgboolandlist("queue_smtp_domains", $rest,
761 "queue_smtp_except", "");
763 "\n%03d queue_smtp converted to domain list queue_smtp_domains.\n",
766 elsif ($name eq "queue_smtp_except")
768 $i = &skipblanks($i);
772 # rbl_except_nets is replaced by rbl_hosts
774 elsif ($name eq "rbl_except_nets")
776 &amalgamate("", "rbl_except_nets", "", "rbl_hosts", "+");
779 # receiver_unqualified_nets is abolished
781 elsif ($name eq "receiver_unqualified_nets" ||
782 $name eq "receiver_unqualified_hosts")
784 if (!$seen_receiver_unqualified)
786 &amalgamate("receiver_unqualified_nets", "",
787 "receiver_unqualified_hosts", "receiver_unqualified_hosts", "+");
788 $seen_receiver_unqualified = 1;
792 $i = &skipblanks($i);
797 # receiver_verify_except_{hosts,nets} are replaced by
798 # receiver_verify_hosts.
800 elsif ($name eq "receiver_verify_except_hosts" ||
801 $name eq "receiver_verify_except_nets")
803 if (!$seen_receiver_verify_except)
805 &amalgboolandlist("receiver_verify_hosts", "true",
806 "receiver_verify_except_hosts", "receiver_verify_except_nets");
808 "\n%03d receiver_verify_except_{hosts,nets} converted to " .
809 "receiver_verify_hosts.\n",
811 $seen_receiver_verify_except = 1;
815 $i = &skipblanks($i);
820 # receiver_verify_senders_except is abolished
822 elsif ($name eq "receiver_verify_senders" ||
823 $name eq "receiver_verify_senders_except")
825 if (defined $o{"receiver_verify_senders_except"})
827 if (!$seen_receiver_verify_senders)
829 &amalgamate("receiver_verify_senders",
830 "receiver_verify_senders_except", "",
831 "receiver_verify_senders", "+");
832 $seen_receiver_verify_senders = 1;
836 $i = &skipblanks($i);
842 print STDOUT "$i1$origname$i2$origrest\n";
846 # rfc1413_except_{hosts,nets} are replaced by rfc1413_hosts.
848 elsif ($name eq "rfc1413_except_hosts" ||
849 $name eq "rfc1413_except_nets")
851 if (!$seen_rfc1413_except)
853 &amalgboolandlist("rfc1413_hosts", "true",
854 "rfc1413_except_hosts", "rfc1413_except_nets");
856 "\n%03d rfc1413_except_{hosts,nets} converted to rfc1413_hosts.\n",
858 $seen_rfc1413_except = 1;
862 $i = &skipblanks($i);
867 # sender_accept and sender_reject_except are abolished
869 elsif ($name eq "sender_accept" ||
870 $name eq "sender_reject")
872 if (!$seen_sender_accept)
874 &amalgamate("sender_accept", "sender_reject",
875 "sender_reject_except", "sender_reject", "-");
876 $seen_sender_accept = 1;
880 $i = &skipblanks($i);
885 # sender_accept_recipients is also abolished; sender_reject_except
886 # also used to apply to this, so we include it here as well.
888 elsif ($name eq "sender_accept_recipients" ||
889 $name eq "sender_reject_recipients")
891 if (!$seen_sender_accept_recipients)
893 &amalgamate("sender_accept_recipients", "sender_reject_recipients",
894 "sender_reject_except", "sender_reject_recipients", "-");
895 $seen_sender_accept_recipients = 1;
899 $i = &skipblanks($i);
904 # sender_reject_except must be removed
906 elsif ($name eq "sender_reject_except")
908 $i = &skipblanks($i);
912 # sender_{host,net}_{accept,reject}[_except] all collapse into
915 elsif ($name eq "sender_host_accept" ||
916 $name eq "sender_net_accept" ||
917 $name eq "sender_host_reject" ||
918 $name eq "sender_net_reject")
920 if (!$seen_sender_host_accept)
922 &amalgamatepairs("sender_host_accept", "sender_net_accept",
923 "sender_host_reject", "sender_net_reject",
924 "sender_host_reject_except", "sender_net_reject_except",
926 printf STDERR "\n%03d sender_{host,net}_{accept,reject} and " .
927 "sender_{host_net}_reject_except\n" .
928 " amalgamated into host_reject.\n", ++$count;
929 $seen_sender_host_accept = 1;
933 $i = &skipblanks($i);
938 # sender_{host,net}_{accept,reject}_recipients all collapse into
939 # host_reject_recipients.
941 elsif ($name eq "sender_host_accept_recipients" ||
942 $name eq "sender_net_accept_recipients" ||
943 $name eq "sender_host_reject_recipients" ||
944 $name eq "sender_net_reject_recipients")
946 if (!$seen_sender_host_accept_recipients)
948 &amalgamatepairs("sender_host_accept_recipients",
949 "sender_net_accept_recipients",
950 "sender_host_reject_recipients",
951 "sender_net_reject_recipients",
952 "sender_host_reject_except", "sender_net_reject_except",
953 "host_reject_recipients", "-");
954 printf STDERR "\n%03d sender_{host,net}_{accept,reject}_recipients"
955 . "\n and sender_{host_net}_reject_except"
956 . "\n amalgamated into host_reject_recipients.\n", ++$count;
957 $seen_sender_host_accept_recipients = 1;
961 $i = &skipblanks($i);
966 # sender_{host,net}_reject_except must be removed
968 elsif ($name eq "sender_host_reject_except" ||
969 $name eq "sender_net_reject_except")
971 $i = &skipblanks($i);
975 # sender_{host,net}_{accept,reject}_relay all collapse into
978 elsif ($name eq "sender_host_accept_relay" ||
979 $name eq "sender_net_accept_relay" ||
980 $name eq "sender_host_reject_relay" ||
981 $name eq "sender_net_reject_relay")
983 if (!$seen_sender_host_accept_relay)
985 &amalgamatepairs("sender_host_accept_relay",
986 "sender_net_accept_relay",
987 "sender_host_reject_relay",
988 "sender_net_reject_relay",
989 "sender_host_reject_relay_except",
990 "sender_net_reject_relay_except",
991 "host_accept_relay", "+");
992 printf STDERR "\n%03d sender_{host,net}_{accept,reject}_relay"
993 . "\n and sender_{host_net}_reject_relay_except"
994 . "\n amalgamated into host_accept_relay.\n", ++$count;
995 $seen_sender_host_accept_relay = 1;
999 $i = &skipblanks($i);
1004 # sender_{host,net}_reject_relay_except must be removed
1006 elsif ($name eq "sender_host_reject_relay_except" ||
1007 $name eq "sender_net_reject_relay_except")
1009 $i = &skipblanks($i);
1014 # sender_unqualified_nets is abolished
1016 elsif ($name eq "sender_unqualified_nets" ||
1017 $name eq "sender_unqualified_hosts")
1019 if (!$seen_sender_unqualified)
1021 &amalgamate("sender_unqualified_nets", "",
1022 "sender_unqualified_hosts", "sender_unqualified_hosts", "+");
1023 $seen_sender_unqualified = 1;
1027 $i = &skipblanks($i);
1032 # sender_verify_except_{hosts,nets} are replaced by sender_verify_hosts.
1034 elsif ($name eq "sender_verify_except_hosts" ||
1035 $name eq "sender_verify_except_nets")
1037 if (!$seen_sender_verify_except_hosts)
1039 &amalgboolandlist("sender_verify_hosts", "true",
1040 "sender_verify_except_hosts", "sender_verify_except_nets");
1042 "\n%03d sender_verify_except_{hosts,nets} converted to " .
1043 "sender_verify_hosts.\n",
1045 $seen_sender_verify_except_hosts = 1;
1049 $i = &skipblanks($i);
1054 # smtp_etrn_nets is abolished
1056 elsif ($name eq "smtp_etrn_nets" ||
1057 $name eq "smtp_etrn_hosts")
1059 if (!$seen_smtp_etrn)
1061 &amalgamate("smtp_etrn_nets", "",
1062 "smtp_etrn_hosts", "smtp_etrn_hosts", "+");
1063 $seen_smtp_etrn = 1;
1067 $i = &skipblanks($i);
1072 # smtp_expn_nets is abolished
1074 elsif ($name eq "smtp_expn_nets" ||
1075 $name eq "smtp_expn_hosts")
1077 if (!$seen_smtp_expn)
1079 &amalgamate("smtp_expn_nets", "",
1080 "smtp_expn_hosts", "smtp_expn_hosts", "+");
1081 $seen_smtp_expn = 1;
1085 $i = &skipblanks($i);
1090 # This option has been renamed
1092 elsif ($name eq "smtp_log_connections")
1094 $origname =~ s/smtp_log/log_smtp/;
1095 print STDOUT "# >> Option rewritten by convert4r3\n";
1096 print STDOUT "$i1$origname$i2$origrest\n";
1097 printf STDERR "\n%03d smtp_log_connections renamed as " .
1098 "log_smtp_connections.\n",
1102 # smtp_reserve_nets is abolished
1104 elsif ($name eq "smtp_reserve_nets" ||
1105 $name eq "smtp_reserve_hosts")
1107 if (!$seen_smtp_reserve)
1109 &amalgamate("smtp_reserve_nets", "",
1110 "smtp_reserve_hosts", "smtp_reserve_hosts", "+");
1111 $seen_smtp_reserve = 1;
1115 $i = &skipblanks($i);
1120 ########### Driver configurations ##########
1122 # For aliasfile and forwardfile directors, add file, pipe, and
1123 # reply transports - copying from the globals if they are set.
1125 elsif ($name eq "driver")
1127 $driver_type = $rest;
1128 print STDOUT "$i1$origname$i2$origrest\n";
1129 if ($rest eq "aliasfile" || $rest eq "forwardfile")
1131 &add_transport("directory");
1132 &add_transport("directory2");
1133 &add_transport("file");
1134 &add_transport("pipe");
1135 &add_transport("reply") if $rest eq "forwardfile";
1139 # except_domains is abolished; add as negated items to domains.
1141 elsif ($name eq "except_domains" ||
1144 if ($seen_domains) # If already done with these
1145 { # omit, and following blanks.
1146 $i = &skipblanks($i);
1151 if (exists $o{"$prefix$driver.except_domains"})
1153 &amalgamate("$prefix$driver.domains",
1154 "$prefix$driver.except_domains", "",
1159 print STDOUT "$i1$origname$i2$origrest\n";
1163 # except_local_parts is abolished; add as negated items to
1166 elsif ($name eq "except_local_parts" ||
1167 $name eq "local_parts")
1169 if ($seen_local_parts) # If already done with these
1170 { # omit, and following blanks.
1171 $i = &skipblanks($i);
1174 $seen_local_parts = 1;
1176 if (exists $o{"$prefix$driver.except_local_parts"})
1178 &amalgamate("$prefix$driver.local_parts",
1179 "$prefix$driver.except_local_parts", "",
1180 "local_parts", "+");
1184 print STDOUT "$i1$origname$i2$origrest\n";
1188 # except_senders is abolished; add as negated items to senders
1190 elsif ($name eq "except_senders" ||
1193 if ($seen_senders) # If already done with these
1194 { # omit, and following blanks.
1195 $i = &skipblanks($i);
1200 if (exists $o{"$prefix$driver.except_senders"})
1202 &amalgamate("$prefix$driver.senders",
1203 "$prefix$driver.except_senders", "",
1208 print STDOUT "$i1$origname$i2$origrest\n";
1212 # This option has been renamed
1214 elsif ($name eq "directory" && $driver_type eq "aliasfile")
1216 $origname =~ s/directory/home_directory/;
1217 print STDOUT "# >> Option rewritten by convert4r3\n";
1218 print STDOUT "$i1$origname$i2$origrest\n";
1219 printf STDERR "\n%03d directory renamed as " .
1220 "home_directory in \"$driver\" director.\n",
1224 # This option has been renamed
1226 elsif ($name eq "directory" && $driver_type eq "forwardfile")
1228 $origname =~ s/directory/file_directory/;
1229 print STDOUT "# >> Option rewritten by convert4r3\n";
1230 print STDOUT "$i1$origname$i2$origrest\n";
1231 printf STDERR "\n%03d directory renamed as " .
1232 "file_directory in \"$driver\" director.\n",
1236 # This option has been renamed
1238 elsif ($name eq "forbid_filter_log" && $driver_type eq "forwardfile")
1240 $origname =~ s/log/logwrite/;
1241 print STDOUT "# >> Option rewritten by convert4r3\n";
1242 print STDOUT "$i1$origname$i2$origrest\n";
1243 printf STDERR "\n%03d forbid_filter_log renamed as " .
1244 "forbid_filter_logwrite in \"$driver\" director.\n",
1248 # This option has been renamed
1250 elsif ($name eq "directory" && $driver_type eq "localuser")
1252 $origname =~ s/directory/match_directory/;
1253 print STDOUT "# >> Option rewritten by convert4r3\n";
1254 print STDOUT "$i1$origname$i2$origrest\n";
1255 printf STDERR "\n%03d directory renamed as " .
1256 "match_directory in \"$driver\" director.\n",
1260 # mx_domains_except (and old synonym non_mx_domains) are abolished
1261 # (both lookuphost router and smtp transport)
1263 elsif ($name eq "mx_domains" ||
1264 $name eq "mx_domains_except" ||
1265 $name eq "non_mx_domains")
1267 if ($seen_mx_domains) # If already done with these
1268 { # omit, and following blanks.
1269 $i = &skipblanks($i);
1272 $seen_mx_domains = 1;
1274 if (exists $o{"$prefix$driver.mx_domains_except"} ||
1275 exists $o{"$prefix$driver.non_mx_domains"})
1277 $o{"$prefix$driver.mx_domains_except"} =
1278 &pair("$prefix$driver.mx_domains_except",
1279 "$prefix$driver.non_mx_domains");
1281 &amalgamate("$prefix$driver.mx_domains",
1282 "$prefix$driver.mx_domains_except", "",
1287 print STDOUT "$i1$origname$i2$origrest\n";
1291 # This option has been renamed
1293 elsif ($name eq "directory" && $driver_type eq "pipe")
1295 $origname =~ s/directory/home_directory/;
1296 print STDOUT "# >> Option rewritten by convert4r3\n";
1297 print STDOUT "$i1$origname$i2$origrest\n";
1298 printf STDERR "\n%03d directory renamed as " .
1299 "home_directory in \"$driver\" director.\n",
1303 # serialize_nets is abolished
1305 elsif ($name eq "serialize_nets" ||
1306 $name eq "serialize_hosts")
1308 if (!$seen_serialize)
1310 &amalgamate("$prefix$driver.serialize_nets", "",
1311 "$prefix$driver.serialize_hosts", "serialize_hosts", "+");
1312 $seen_serialize = 1;
1316 $i = &skipblanks($i);
1322 # Option not of interest; reproduce verbatim
1326 print STDOUT "$i1$origname$i2$origrest\n";
1330 $last_was_blank = 0;
1337 # Debugging: show the associative array
1338 # foreach $key (sort keys %o) { print STDERR "$key = $o{$key}\n"; }
1340 print STDERR "\nEnd of configuration file conversion.\n";
1341 print STDERR "\n*******************************************************\n";
1342 print STDERR "***** Please review the generated file carefully. *****\n";
1343 print STDERR "*******************************************************\n\n";
1345 print STDERR "In particular:\n\n";
1347 print STDERR "(1) If you use regular expressions in any options that have\n";
1348 print STDERR " been rewritten by this script, they might have been put\n";
1349 print STDERR " inside quotes, when then were not previously quoted. This\n";
1350 print STDERR " means that any backslashes in them must now be escaped.\n\n";
1352 print STDERR "(2) If your configuration refers to any external files that\n";
1353 print STDERR " contain lists of network addresses, check that the masks\n";
1354 print STDERR " are specified as single numbers, e.g. /24 and NOT as dotted\n";
1355 print STDERR " quads (e.g. 255.255.255.0) because Exim release 3.00 does\n";
1356 print STDERR " not recognize the dotted quad form.\n\n";
1358 print STDERR "(3) If your configuration uses macros for lists of domains or\n";
1359 print STDERR " hosts or addresses, check to see if any of the references\n";
1360 print STDERR " have been negated. If so, you will have to rework things,\n";
1361 print STDERR " because the negation will apply only to the first item in\n";
1362 print STDERR " the macro-generated list.\n\n";
1364 print STDERR "(4) If you do not generate deliveries to pipes, files, or\n";
1365 print STDERR " auto-replies in your aliasfile and forwardfile directors,\n";
1366 print STDERR " you can remove the added transport settings.\n\n";