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 BEGIN { pop @INC if $INC[-1] eq '.' };
13 ##################################################
15 ##################################################
17 # This is called for the main and the driver sections, not for retry
18 # or rewrite sections (which are unmodified).
23 return "comment" if $line =~ /^\s*(#|$)/;
24 return "end" if $line =~ /^\s*end\s*$/;
26 # Macros are recognized only in the first section of the file.
28 return "macro" if $prefix eq "" && $line =~ /^\s*[A-Z]/;
30 # Pick out the name at the start and the rest of the line (into global
31 # variables) and return whether the start of a driver or not.
33 ($i1,$name,$i2,$rest) = $line =~ /^(\s*)([a-z0-9_]+)(\s*)(.*?)\s*$/;
34 return ($rest =~ /^:/)? "driver" : "option";
40 ##################################################
41 # Add transport setting to a director #
42 ##################################################
44 # This function adds a transport setting to an aliasfile or forwardfile
45 # director if a global setting exists and a local one does not. If neither
46 # exist, it adds file/pipe/reply, but not the directory ones.
51 my($key) = "$prefix$driver.${option}_transport";
54 if (exists $o{"address_${option}_transport"})
56 print STDOUT "# >> Option added by convert4r3\n";
57 printf STDOUT "${i1}${option}_transport = %s\n",
58 $o{"address_${option}_transport"};
60 "\n%03d ${option}_transport added to $driver director.\n",
65 if ($option eq "pipe" || $option eq "file" || $option eq "reply")
67 print STDOUT "# >> Option added by convert4r3\n";
68 printf STDOUT "${i1}${option}_transport = address_${option}\n";
70 "\n%03d ${option}_transport added to $driver director.\n",
80 ##################################################
81 # Negate a list of things #
82 ##################################################
87 return $list if ! defined $list;
89 ($list) = $list =~ /^"?(.*?)"?\s*$/s;
91 # Under Perl 5.005 we can split very nicely at colons, ignoring double
94 # @split = split /\s*(?<!:):(?!:)\s*(?:\\\s*)?/s, $list;
96 # However, we'd better make this work under Perl 5.004, since there is
97 # a lot of that about.
99 $list =~ s/::/>%%%%</g;
100 @split = split /\s*:\s*(?:\\\s*)?/s, $list;
101 foreach $item (@split)
103 $item =~ s/>%%%%</::/g;
114 ##################################################
116 ##################################################
118 # This function is called after we have generated no output for an option;
119 # it skips subsequent blank lines if the previous line was blank.
125 $i++ while $c[$i+1] =~ /^\s*$/;
134 ##################################################
135 # Get base name of data key #
136 ##################################################
139 return "$_[0]" if $_[0] !~ /^(?:d|r|t)\.[^.]+\.(.*)/;
145 ##################################################
146 # Amalgamate accept/reject/reject_except #
147 ##################################################
149 # This function amalgamates the three previous kinds of
150 # option into a single list, using negation for the middle one if
151 # the final argument is "+", or for the outer two if the final
155 my($accept,$reject,$reject_except,$name);
156 my($last_was_negated) = 0;
161 $reject_except = $o{$_[2]};
166 ($accept) = $accept =~ /^"?(.*?)"?\s*$/s if defined $accept;
167 $reject = &negate($reject) if defined $reject;
168 ($reject_except) = $reject_except =~ /^"?(.*?)"?\s*$/s if defined $reject_except;
172 $accept = &negate($accept) if defined $accept;
173 ($reject) = $reject =~ /^"?(.*?)"?\s*$/s if defined $reject;
174 $reject_except = &negate($reject_except) if defined $reject_except;
177 print STDOUT "# >> Option rewritten by convert4r3\n";
178 print STDOUT "${i1}$name = \"";
180 if (defined $reject_except)
182 print STDOUT "$reject_except";
184 $last_was_negated = ($_[4] ne "+");
188 print STDOUT "$join$reject";
190 $last_was_negated = ($_[4] eq "+");
194 print STDOUT "$join$accept";
195 $last_was_negated = ($_[4] ne "+");
199 print STDOUT "$join*" if $last_was_negated;
204 my($driver_type) = "";
206 if ($_[0] =~ /^(d|r|t)\.([^.]+)\./ ||
207 $_[1] =~ /^(d|r|t)\.([^.]+)\./ ||
208 $_[2] =~ /^(d|r|t)\.([^.]+)\./)
210 $driver_type = ($1 eq 'd')? "director" : ($1 eq 'r')? "router" : "transport";
214 my($x) = ($driver_type ne "")? " in \"$driver_name\" $driver_type" : "";
216 my($l0) = &base($_[0]);
217 my($l1) = &base($_[1]);
218 my($l2) = &base($_[2]);
225 printf STDERR "\n%03d $l1 converted to $name$x.\n", ++$count;
229 printf STDERR "\n%03d $l0 and $l1\n amalgamated into $name$x.\n",
237 printf STDERR "\n%03d $l0 and $l2\n amalgamated into $name$x.\n",
242 printf STDERR "\n%03d $l0, $l1 and $l2\n amalgamated into " .
243 "$name$x.\n", ++$count;
251 ##################################################
252 # Join two lists, if they exist #
253 ##################################################
256 my($l1) = $o{"$_[0]"};
257 my($l2) = $o{"$_[1]"};
259 return $l2 if (!defined $l1);
260 return $l1 if (!defined $l2);
262 ($l1) = $l1 =~ /^"?(.*?)"?\s*$/s;
263 ($l2) = $l2 =~ /^"?(.*?)"?\s*$/s;
271 ##################################################
272 # Amalgamate accept/reject/reject_except pairs #
273 ##################################################
275 # This is like amalgamate, but it combines pairs of arguments, and
276 # doesn't output commentary (easier to write a generic one for the few
279 sub amalgamatepairs {
280 my($accept) = &pair($_[0], $_[1]);
281 my($reject) = &pair($_[2], $_[3]);
282 my($reject_except) = &pair($_[4], $_[5]);
283 my($last_was_negated) = 0;
288 ($accept) = $accept =~ /^"?(.*?)"?\s*$/s if defined $accept;
289 $reject = &negate($reject) if defined $reject;
290 ($reject_except) = $reject_except =~ /^"?(.*?)"?\s*$/s if defined $reject_except;
294 $accept = &negate($accept) if defined $accept;
295 ($reject) = $reject =~ /^"?(.*?)"?$/s if defined $reject;
296 $reject_except = &negate($reject_except) if defined $reject_except;
299 print STDOUT "# >> Option rewritten by convert4r3\n";
300 print STDOUT "${i1}$_[6] = \"";
302 if (defined $reject_except)
304 print STDOUT "$reject_except";
306 $last_was_negated = ($_[7] ne "+");
310 print STDOUT "$join$reject";
312 $last_was_negated = ($_[7] eq "+");
316 print STDOUT "$join$accept";
317 $last_was_negated = ($_[7] ne "+");
321 print STDOUT "$join*" if $last_was_negated;
327 ##################################################
328 # Amalgamate boolean and exception list(s) #
329 ##################################################
331 sub amalgboolandlist {
332 my($name,$bool,$e1,$e2) = @_;
334 print STDOUT "# >> Option rewritten by convert4r3\n";
335 if ($bool eq "false")
337 printf STDOUT "$i1$name =\n";
341 printf STDOUT "$i1$name = ";
342 my($n1) = &negate($o{$e1});
343 my($n2) = &negate($o{$e2});
344 if (!defined $n1 && !defined $n2)
350 print STDOUT "\"$n2 : \\\n *\"\n";
354 print STDOUT "\"$n1 : \\\n *\"\n";
358 print STDOUT "\"$n1 : \\\n $n2 : \\\n *\"\n";
365 ##################################################
366 # Convert mask format #
367 ##################################################
369 # This function converts an address and mask in old-fashioned dotted-quad
370 # format into an address plus a new format mask.
372 @byte_list = (0, 128, 192, 224, 240, 248, 252, 254, 255);
375 my($address,$mask) = @_;
379 my(@bytes) = split /\./, $mask;
381 for ($i = 0; $i < 4; $i++)
383 for ($j = 0; $j <= 8; $j++)
385 if ($bytes[$i] == $byte_list[$j])
390 for ($i++; $i < 4; $i++)
392 $j = 9 if ($bytes[$i] != 0);
401 print STDERR "*** IP mask $mask cannot be converted to /n format. ***\n";
402 return "$address/$mask";
406 if (!defined $masks{$mask})
408 printf STDERR "\n%03d IP address mask $mask converted to /$length\n",
409 ++$count, $mask, $length;
413 return sprintf "$address/%d", $length;
420 ##################################################
422 ##################################################
424 print STDERR "Exim pre-release 3.00 configuration file converter.\n";
427 $seen_helo_accept_junk = 0;
428 $seen_hold_domains = 0;
429 $seen_receiver_unqualified = 0;
430 $seen_receiver_verify_except = 0;
431 $seen_receiver_verify_senders = 0;
432 $seen_rfc1413_except = 0;
433 $seen_sender_accept = 0;
434 $seen_sender_accept_recipients = 0;
435 $seen_sender_host_accept = 0;
436 $seen_sender_host_accept_recipients = 0;
437 $seen_sender_host_accept_relay = 0;
438 $seen_sender_unqualified = 0;
439 $seen_sender_verify_except_hosts = 0;
442 $seen_smtp_reserve = 0;
445 # Read the entire file into an array
449 # First, go through the input and covert any net masks in the old dotted-quad
450 # style into the new /n style.
452 for ($i = 0; $i < scalar(@c); $i++)
455 s"((?:\d{1,3}\.){3}\d{1,3})/((?:\d{1,3}\.){3}\d{1,3})"&mask($1,$2)"eg;
458 # We now make two more passes over the input. In the first pass, we place all
459 # the option values into an associative array. Main options are keyed by their
460 # names; options for drivers are keyed by a driver type letter, the driver
461 # name, and the option name, dot-separated. In the second pass we modify
462 # the options if necessary, and write the output file.
464 for ($pass = 1; $pass < 3; $pass++)
470 for ($i = 0; $i < scalar(@c); $i++)
472 # Everything after the router section is just copied in pass 2 and
475 if ($prefix eq "end")
477 print STDOUT "$c[$i]\n" if $pass == 2;
483 $type = &checkline($c[$i]);
485 # Skip comments in pass 1; copy in pass 2
487 if ($type eq "comment")
489 $last_was_blank = ($c[$i] =~ /^\s*$/)? 1 : 0;
490 print STDOUT "$c[$i]\n" if $pass == 2;
494 # Skip/copy macro definitions, but must handle continuations
496 if ($type eq "macro")
498 print STDOUT "$c[$i]\n" if $pass == 2;
499 while ($c[$i] =~ /\\\s*$/)
502 print STDOUT "$c[$i]\n" if $pass == 2;
508 # Handle end of section
512 $prefix = "end"if $prefix eq "r.";
513 $prefix = "r." if $prefix eq "d.";
514 $prefix = "d." if $prefix eq "t.";
515 $prefix = "t." if $prefix eq "";
516 print STDOUT "$c[$i]\n" if $pass == 2;
521 # Handle start of a new driver
523 if ($type eq "driver")
526 print STDOUT "$c[$i]\n" if $pass == 2;
529 $seen_local_parts = 0;
531 $seen_mx_domains = 0;
536 # Handle definition of an option
538 if ($type eq "option")
540 # Handle continued strings
542 if ($rest =~ /^=\s*".*\\$/)
546 $rest .= "\n$c[++$i]";
547 last unless $c[$i] =~ /(\\\s*$|^\s*#)/;
551 # Remove any terminating commas and semicolons in pass 2
553 if ($pass == 2 && $rest =~ /[;,]\s*$/)
555 $rest =~ s/\s*[;,]\s*$//;
559 "\n%03d Terminating semicolons and commas removed from driver " .
560 "options.\n", ++$count;
565 # Convert all booleans to "x = true/false" format, but save the
566 # original so that it can be reproduced unchanged for options that
567 # are not of interest.
572 if ($name =~ /^not?_(.*)/)
577 elsif ($rest !~ /^=/)
582 # Set up the associative array key, and get rid of the = on the data
584 $key = ($prefix eq "")? "$name" : "$prefix$driver.$name";
585 ($rest) = $rest =~ /^=\s*(.*)/s;
587 # Create the associative array of values in pass 1
594 # In pass 2, test for interesting options and do the necessary; copy
599 ########## Global configuration ##########
601 # These global options are abolished
603 if ($name eq "address_directory_transport" ||
604 $name eq "address_directory2_transport" ||
605 $name eq "address_file_transport" ||
606 $name eq "address_pipe_transport" ||
607 $name eq "address_reply_transport")
609 ($n2) = $name =~ /^address_(.*)/;
610 printf STDERR "\n%03d $name option deleted.\n", ++$count;
611 printf STDERR " $n2 will be added to appropriate directors.\n";
612 $i = &skipblanks($i);
616 # This debugging option is abolished
618 elsif ($name eq "sender_verify_log_details")
620 printf STDERR "\n%03d $name option deleted.\n", ++$count;
621 printf STDERR " (Little used facility abolished.)\n";
624 # This option has been renamed
626 elsif ($name eq "check_dns_names")
628 $origname =~ s/check_dns/dns_check/;
629 print STDOUT "# >> Option rewritten by convert4r3\n";
630 print STDOUT "$i1$origname$i2$origrest\n";
631 printf STDERR "\n%03d check_dns_names renamed as dns_check_names.\n",
635 # helo_accept_junk_nets is abolished
637 elsif ($name eq "helo_accept_junk_nets" ||
638 $name eq "helo_accept_junk_hosts")
640 if (!$seen_helo_accept_junk)
642 &amalgamate("helo_accept_junk_nets", "",
643 "helo_accept_junk_hosts", "helo_accept_junk_hosts", "+");
644 $seen_helo_accept_junk = 1;
648 $i = &skipblanks($i);
653 # helo_verify_except_{hosts,nets} are abolished, and helo_verify
654 # is now a host list instead of a boolean.
656 elsif ($name eq "helo_verify")
658 &amalgboolandlist("helo_verify", $rest, "helo_verify_except_hosts",
659 "helo_verify_except_nets");
660 printf STDERR "\n%03d helo_verify converted to host list.\n",
663 elsif ($name eq "helo_verify_except_hosts" ||
664 $name eq "helo_verify_except_nets")
666 $i = &skipblanks($i);
670 # helo_verify_nets was an old synonym for host_lookup_nets; only
671 # one of them will be encountered. Change to a new name.
673 elsif ($name eq "helo_verify_nets" ||
674 $name eq "host_lookup_nets")
676 print STDOUT "# >> Option rewritten by convert4r3\n";
677 print STDOUT "${i1}host_lookup$i2$origrest\n";
678 printf STDERR "\n%03d $name renamed as host_lookup.\n", ++$count;
681 # hold_domains_except is abolished; add as negated items to
684 elsif ($name eq "hold_domains_except" ||
685 $name eq "hold_domains")
687 if ($seen_hold_domains) # If already done with these
688 { # omit, and following blanks.
689 $i = &skipblanks($i);
692 $seen_hold_domains = 1;
694 if (exists $o{"hold_domains_except"})
696 &amalgamate("hold_domains", "hold_domains_except", "",
697 "hold_domains", "+");
701 print STDOUT "$i1$origname$i2$origrest\n";
705 # ignore_fromline_nets is renamed as ignore_fromline_hosts
707 elsif ($name eq "ignore_fromline_nets")
709 $origname =~ s/_nets/_hosts/;
710 print STDOUT "# >> Option rewritten by convert4r3\n";
711 print STDOUT "$i1$origname$i2$origrest\n";
713 "\n%03d ignore_fromline_nets renamed as ignore_fromline_hosts.\n",
717 # Output a warning for message filters with no transports set
719 elsif ($name eq "message_filter")
721 print STDOUT "$i1$origname$i2$origrest\n";
723 if (!exists $o{"message_filter_directory_transport"} &&
724 !exists $o{"message_filter_directory2_transport"} &&
725 !exists $o{"message_filter_file_transport"} &&
726 !exists $o{"message_filter_pipe_transport"} &&
727 !exists $o{"message_filter_reply_transport"})
730 "\n%03d message_filter is set, but no message_filter transports "
732 . " If your filter generates file or pipe deliveries, or "
734 . " you will need to define "
735 . "message_filter_{file,pipe,reply}_transport\n"
736 . " options, as required.\n", ++$count;
740 # queue_remote_except is abolished, and queue_remote is replaced by
741 # queue_remote_domains, which is a host list.
743 elsif ($name eq "queue_remote")
745 &amalgboolandlist("queue_remote_domains", $rest,
746 "queue_remote_except", "");
748 "\n%03d queue_remote converted to domain list queue_remote_domains.\n",
751 elsif ($name eq "queue_remote_except")
753 $i = &skipblanks($i);
757 # queue_smtp_except is abolished, and queue_smtp is replaced by
758 # queue_smtp_domains, which is a host list.
760 elsif ($name eq "queue_smtp")
762 &amalgboolandlist("queue_smtp_domains", $rest,
763 "queue_smtp_except", "");
765 "\n%03d queue_smtp converted to domain list queue_smtp_domains.\n",
768 elsif ($name eq "queue_smtp_except")
770 $i = &skipblanks($i);
774 # rbl_except_nets is replaced by rbl_hosts
776 elsif ($name eq "rbl_except_nets")
778 &amalgamate("", "rbl_except_nets", "", "rbl_hosts", "+");
781 # receiver_unqualified_nets is abolished
783 elsif ($name eq "receiver_unqualified_nets" ||
784 $name eq "receiver_unqualified_hosts")
786 if (!$seen_receiver_unqualified)
788 &amalgamate("receiver_unqualified_nets", "",
789 "receiver_unqualified_hosts", "receiver_unqualified_hosts", "+");
790 $seen_receiver_unqualified = 1;
794 $i = &skipblanks($i);
799 # receiver_verify_except_{hosts,nets} are replaced by
800 # receiver_verify_hosts.
802 elsif ($name eq "receiver_verify_except_hosts" ||
803 $name eq "receiver_verify_except_nets")
805 if (!$seen_receiver_verify_except)
807 &amalgboolandlist("receiver_verify_hosts", "true",
808 "receiver_verify_except_hosts", "receiver_verify_except_nets");
810 "\n%03d receiver_verify_except_{hosts,nets} converted to " .
811 "receiver_verify_hosts.\n",
813 $seen_receiver_verify_except = 1;
817 $i = &skipblanks($i);
822 # receiver_verify_senders_except is abolished
824 elsif ($name eq "receiver_verify_senders" ||
825 $name eq "receiver_verify_senders_except")
827 if (defined $o{"receiver_verify_senders_except"})
829 if (!$seen_receiver_verify_senders)
831 &amalgamate("receiver_verify_senders",
832 "receiver_verify_senders_except", "",
833 "receiver_verify_senders", "+");
834 $seen_receiver_verify_senders = 1;
838 $i = &skipblanks($i);
844 print STDOUT "$i1$origname$i2$origrest\n";
848 # rfc1413_except_{hosts,nets} are replaced by rfc1413_hosts.
850 elsif ($name eq "rfc1413_except_hosts" ||
851 $name eq "rfc1413_except_nets")
853 if (!$seen_rfc1413_except)
855 &amalgboolandlist("rfc1413_hosts", "true",
856 "rfc1413_except_hosts", "rfc1413_except_nets");
858 "\n%03d rfc1413_except_{hosts,nets} converted to rfc1413_hosts.\n",
860 $seen_rfc1413_except = 1;
864 $i = &skipblanks($i);
869 # sender_accept and sender_reject_except are abolished
871 elsif ($name eq "sender_accept" ||
872 $name eq "sender_reject")
874 if (!$seen_sender_accept)
876 &amalgamate("sender_accept", "sender_reject",
877 "sender_reject_except", "sender_reject", "-");
878 $seen_sender_accept = 1;
882 $i = &skipblanks($i);
887 # sender_accept_recipients is also abolished; sender_reject_except
888 # also used to apply to this, so we include it here as well.
890 elsif ($name eq "sender_accept_recipients" ||
891 $name eq "sender_reject_recipients")
893 if (!$seen_sender_accept_recipients)
895 &amalgamate("sender_accept_recipients", "sender_reject_recipients",
896 "sender_reject_except", "sender_reject_recipients", "-");
897 $seen_sender_accept_recipients = 1;
901 $i = &skipblanks($i);
906 # sender_reject_except must be removed
908 elsif ($name eq "sender_reject_except")
910 $i = &skipblanks($i);
914 # sender_{host,net}_{accept,reject}[_except] all collapse into
917 elsif ($name eq "sender_host_accept" ||
918 $name eq "sender_net_accept" ||
919 $name eq "sender_host_reject" ||
920 $name eq "sender_net_reject")
922 if (!$seen_sender_host_accept)
924 &amalgamatepairs("sender_host_accept", "sender_net_accept",
925 "sender_host_reject", "sender_net_reject",
926 "sender_host_reject_except", "sender_net_reject_except",
928 printf STDERR "\n%03d sender_{host,net}_{accept,reject} and " .
929 "sender_{host_net}_reject_except\n" .
930 " amalgamated into host_reject.\n", ++$count;
931 $seen_sender_host_accept = 1;
935 $i = &skipblanks($i);
940 # sender_{host,net}_{accept,reject}_recipients all collapse into
941 # host_reject_recipients.
943 elsif ($name eq "sender_host_accept_recipients" ||
944 $name eq "sender_net_accept_recipients" ||
945 $name eq "sender_host_reject_recipients" ||
946 $name eq "sender_net_reject_recipients")
948 if (!$seen_sender_host_accept_recipients)
950 &amalgamatepairs("sender_host_accept_recipients",
951 "sender_net_accept_recipients",
952 "sender_host_reject_recipients",
953 "sender_net_reject_recipients",
954 "sender_host_reject_except", "sender_net_reject_except",
955 "host_reject_recipients", "-");
956 printf STDERR "\n%03d sender_{host,net}_{accept,reject}_recipients"
957 . "\n and sender_{host_net}_reject_except"
958 . "\n amalgamated into host_reject_recipients.\n", ++$count;
959 $seen_sender_host_accept_recipients = 1;
963 $i = &skipblanks($i);
968 # sender_{host,net}_reject_except must be removed
970 elsif ($name eq "sender_host_reject_except" ||
971 $name eq "sender_net_reject_except")
973 $i = &skipblanks($i);
977 # sender_{host,net}_{accept,reject}_relay all collapse into
980 elsif ($name eq "sender_host_accept_relay" ||
981 $name eq "sender_net_accept_relay" ||
982 $name eq "sender_host_reject_relay" ||
983 $name eq "sender_net_reject_relay")
985 if (!$seen_sender_host_accept_relay)
987 &amalgamatepairs("sender_host_accept_relay",
988 "sender_net_accept_relay",
989 "sender_host_reject_relay",
990 "sender_net_reject_relay",
991 "sender_host_reject_relay_except",
992 "sender_net_reject_relay_except",
993 "host_accept_relay", "+");
994 printf STDERR "\n%03d sender_{host,net}_{accept,reject}_relay"
995 . "\n and sender_{host_net}_reject_relay_except"
996 . "\n amalgamated into host_accept_relay.\n", ++$count;
997 $seen_sender_host_accept_relay = 1;
1001 $i = &skipblanks($i);
1006 # sender_{host,net}_reject_relay_except must be removed
1008 elsif ($name eq "sender_host_reject_relay_except" ||
1009 $name eq "sender_net_reject_relay_except")
1011 $i = &skipblanks($i);
1016 # sender_unqualified_nets is abolished
1018 elsif ($name eq "sender_unqualified_nets" ||
1019 $name eq "sender_unqualified_hosts")
1021 if (!$seen_sender_unqualified)
1023 &amalgamate("sender_unqualified_nets", "",
1024 "sender_unqualified_hosts", "sender_unqualified_hosts", "+");
1025 $seen_sender_unqualified = 1;
1029 $i = &skipblanks($i);
1034 # sender_verify_except_{hosts,nets} are replaced by sender_verify_hosts.
1036 elsif ($name eq "sender_verify_except_hosts" ||
1037 $name eq "sender_verify_except_nets")
1039 if (!$seen_sender_verify_except_hosts)
1041 &amalgboolandlist("sender_verify_hosts", "true",
1042 "sender_verify_except_hosts", "sender_verify_except_nets");
1044 "\n%03d sender_verify_except_{hosts,nets} converted to " .
1045 "sender_verify_hosts.\n",
1047 $seen_sender_verify_except_hosts = 1;
1051 $i = &skipblanks($i);
1056 # smtp_etrn_nets is abolished
1058 elsif ($name eq "smtp_etrn_nets" ||
1059 $name eq "smtp_etrn_hosts")
1061 if (!$seen_smtp_etrn)
1063 &amalgamate("smtp_etrn_nets", "",
1064 "smtp_etrn_hosts", "smtp_etrn_hosts", "+");
1065 $seen_smtp_etrn = 1;
1069 $i = &skipblanks($i);
1074 # smtp_expn_nets is abolished
1076 elsif ($name eq "smtp_expn_nets" ||
1077 $name eq "smtp_expn_hosts")
1079 if (!$seen_smtp_expn)
1081 &amalgamate("smtp_expn_nets", "",
1082 "smtp_expn_hosts", "smtp_expn_hosts", "+");
1083 $seen_smtp_expn = 1;
1087 $i = &skipblanks($i);
1092 # This option has been renamed
1094 elsif ($name eq "smtp_log_connections")
1096 $origname =~ s/smtp_log/log_smtp/;
1097 print STDOUT "# >> Option rewritten by convert4r3\n";
1098 print STDOUT "$i1$origname$i2$origrest\n";
1099 printf STDERR "\n%03d smtp_log_connections renamed as " .
1100 "log_smtp_connections.\n",
1104 # smtp_reserve_nets is abolished
1106 elsif ($name eq "smtp_reserve_nets" ||
1107 $name eq "smtp_reserve_hosts")
1109 if (!$seen_smtp_reserve)
1111 &amalgamate("smtp_reserve_nets", "",
1112 "smtp_reserve_hosts", "smtp_reserve_hosts", "+");
1113 $seen_smtp_reserve = 1;
1117 $i = &skipblanks($i);
1122 ########### Driver configurations ##########
1124 # For aliasfile and forwardfile directors, add file, pipe, and
1125 # reply transports - copying from the globals if they are set.
1127 elsif ($name eq "driver")
1129 $driver_type = $rest;
1130 print STDOUT "$i1$origname$i2$origrest\n";
1131 if ($rest eq "aliasfile" || $rest eq "forwardfile")
1133 &add_transport("directory");
1134 &add_transport("directory2");
1135 &add_transport("file");
1136 &add_transport("pipe");
1137 &add_transport("reply") if $rest eq "forwardfile";
1141 # except_domains is abolished; add as negated items to domains.
1143 elsif ($name eq "except_domains" ||
1146 if ($seen_domains) # If already done with these
1147 { # omit, and following blanks.
1148 $i = &skipblanks($i);
1153 if (exists $o{"$prefix$driver.except_domains"})
1155 &amalgamate("$prefix$driver.domains",
1156 "$prefix$driver.except_domains", "",
1161 print STDOUT "$i1$origname$i2$origrest\n";
1165 # except_local_parts is abolished; add as negated items to
1168 elsif ($name eq "except_local_parts" ||
1169 $name eq "local_parts")
1171 if ($seen_local_parts) # If already done with these
1172 { # omit, and following blanks.
1173 $i = &skipblanks($i);
1176 $seen_local_parts = 1;
1178 if (exists $o{"$prefix$driver.except_local_parts"})
1180 &amalgamate("$prefix$driver.local_parts",
1181 "$prefix$driver.except_local_parts", "",
1182 "local_parts", "+");
1186 print STDOUT "$i1$origname$i2$origrest\n";
1190 # except_senders is abolished; add as negated items to senders
1192 elsif ($name eq "except_senders" ||
1195 if ($seen_senders) # If already done with these
1196 { # omit, and following blanks.
1197 $i = &skipblanks($i);
1202 if (exists $o{"$prefix$driver.except_senders"})
1204 &amalgamate("$prefix$driver.senders",
1205 "$prefix$driver.except_senders", "",
1210 print STDOUT "$i1$origname$i2$origrest\n";
1214 # This option has been renamed
1216 elsif ($name eq "directory" && $driver_type eq "aliasfile")
1218 $origname =~ s/directory/home_directory/;
1219 print STDOUT "# >> Option rewritten by convert4r3\n";
1220 print STDOUT "$i1$origname$i2$origrest\n";
1221 printf STDERR "\n%03d directory renamed as " .
1222 "home_directory in \"$driver\" director.\n",
1226 # This option has been renamed
1228 elsif ($name eq "directory" && $driver_type eq "forwardfile")
1230 $origname =~ s/directory/file_directory/;
1231 print STDOUT "# >> Option rewritten by convert4r3\n";
1232 print STDOUT "$i1$origname$i2$origrest\n";
1233 printf STDERR "\n%03d directory renamed as " .
1234 "file_directory in \"$driver\" director.\n",
1238 # This option has been renamed
1240 elsif ($name eq "forbid_filter_log" && $driver_type eq "forwardfile")
1242 $origname =~ s/log/logwrite/;
1243 print STDOUT "# >> Option rewritten by convert4r3\n";
1244 print STDOUT "$i1$origname$i2$origrest\n";
1245 printf STDERR "\n%03d forbid_filter_log renamed as " .
1246 "forbid_filter_logwrite in \"$driver\" director.\n",
1250 # This option has been renamed
1252 elsif ($name eq "directory" && $driver_type eq "localuser")
1254 $origname =~ s/directory/match_directory/;
1255 print STDOUT "# >> Option rewritten by convert4r3\n";
1256 print STDOUT "$i1$origname$i2$origrest\n";
1257 printf STDERR "\n%03d directory renamed as " .
1258 "match_directory in \"$driver\" director.\n",
1262 # mx_domains_except (and old synonym non_mx_domains) are abolished
1263 # (both lookuphost router and smtp transport)
1265 elsif ($name eq "mx_domains" ||
1266 $name eq "mx_domains_except" ||
1267 $name eq "non_mx_domains")
1269 if ($seen_mx_domains) # If already done with these
1270 { # omit, and following blanks.
1271 $i = &skipblanks($i);
1274 $seen_mx_domains = 1;
1276 if (exists $o{"$prefix$driver.mx_domains_except"} ||
1277 exists $o{"$prefix$driver.non_mx_domains"})
1279 $o{"$prefix$driver.mx_domains_except"} =
1280 &pair("$prefix$driver.mx_domains_except",
1281 "$prefix$driver.non_mx_domains");
1283 &amalgamate("$prefix$driver.mx_domains",
1284 "$prefix$driver.mx_domains_except", "",
1289 print STDOUT "$i1$origname$i2$origrest\n";
1293 # This option has been renamed
1295 elsif ($name eq "directory" && $driver_type eq "pipe")
1297 $origname =~ s/directory/home_directory/;
1298 print STDOUT "# >> Option rewritten by convert4r3\n";
1299 print STDOUT "$i1$origname$i2$origrest\n";
1300 printf STDERR "\n%03d directory renamed as " .
1301 "home_directory in \"$driver\" director.\n",
1305 # serialize_nets is abolished
1307 elsif ($name eq "serialize_nets" ||
1308 $name eq "serialize_hosts")
1310 if (!$seen_serialize)
1312 &amalgamate("$prefix$driver.serialize_nets", "",
1313 "$prefix$driver.serialize_hosts", "serialize_hosts", "+");
1314 $seen_serialize = 1;
1318 $i = &skipblanks($i);
1324 # Option not of interest; reproduce verbatim
1328 print STDOUT "$i1$origname$i2$origrest\n";
1332 $last_was_blank = 0;
1339 # Debugging: show the associative array
1340 # foreach $key (sort keys %o) { print STDERR "$key = $o{$key}\n"; }
1342 print STDERR "\nEnd of configuration file conversion.\n";
1343 print STDERR "\n*******************************************************\n";
1344 print STDERR "***** Please review the generated file carefully. *****\n";
1345 print STDERR "*******************************************************\n\n";
1347 print STDERR "In particular:\n\n";
1349 print STDERR "(1) If you use regular expressions in any options that have\n";
1350 print STDERR " been rewritten by this script, they might have been put\n";
1351 print STDERR " inside quotes, when then were not previously quoted. This\n";
1352 print STDERR " means that any backslashes in them must now be escaped.\n\n";
1354 print STDERR "(2) If your configuration refers to any external files that\n";
1355 print STDERR " contain lists of network addresses, check that the masks\n";
1356 print STDERR " are specified as single numbers, e.g. /24 and NOT as dotted\n";
1357 print STDERR " quads (e.g. 255.255.255.0) because Exim release 3.00 does\n";
1358 print STDERR " not recognize the dotted quad form.\n\n";
1360 print STDERR "(3) If your configuration uses macros for lists of domains or\n";
1361 print STDERR " hosts or addresses, check to see if any of the references\n";
1362 print STDERR " have been negated. If so, you will have to rework things,\n";
1363 print STDERR " because the negation will apply only to the first item in\n";
1364 print STDERR " the macro-generated list.\n\n";
1366 print STDERR "(4) If you do not generate deliveries to pipes, files, or\n";
1367 print STDERR " auto-replies in your aliasfile and forwardfile directors,\n";
1368 print STDERR " you can remove the added transport settings.\n\n";