2 # $Cambridge: exim/src/src/convert4r3.src,v 1.1 2004/10/07 10:39:01 ph10 Exp $
4 # This is a Perl script that reads an Exim run-time configuration file and
5 # checks for settings that were valid prior to release 3.00 but which were
6 # obsoleted by that release. It writes a new file with suggested changes to
7 # the standard output, and commentary about what it has done to stderr.
9 # It is assumed that the input is a valid Exim configuration file.
12 ##################################################
14 ##################################################
16 # This is called for the main and the driver sections, not for retry
17 # or rewrite sections (which are unmodified).
22 return "comment" if $line =~ /^\s*(#|$)/;
23 return "end" if $line =~ /^\s*end\s*$/;
25 # Macros are recognized only in the first section of the file.
27 return "macro" if $prefix eq "" && $line =~ /^\s*[A-Z]/;
29 # Pick out the name at the start and the rest of the line (into global
30 # variables) and return whether the start of a driver or not.
32 ($i1,$name,$i2,$rest) = $line =~ /^(\s*)([a-z0-9_]+)(\s*)(.*?)\s*$/;
33 return ($rest =~ /^:/)? "driver" : "option";
39 ##################################################
40 # Add transport setting to a director #
41 ##################################################
43 # This function adds a transport setting to an aliasfile or forwardfile
44 # director if a global setting exists and a local one does not. If neither
45 # exist, it adds file/pipe/reply, but not the directory ones.
50 my($key) = "$prefix$driver.${option}_transport";
53 if (exists $o{"address_${option}_transport"})
55 print STDOUT "# >> Option added by convert4r3\n";
56 printf STDOUT "${i1}${option}_transport = %s\n",
57 $o{"address_${option}_transport"};
59 "\n%03d ${option}_transport added to $driver director.\n",
64 if ($option eq "pipe" || $option eq "file" || $option eq "reply")
66 print STDOUT "# >> Option added by convert4r3\n";
67 printf STDOUT "${i1}${option}_transport = address_${option}\n";
69 "\n%03d ${option}_transport added to $driver director.\n",
79 ##################################################
80 # Negate a list of things #
81 ##################################################
86 return $list if ! defined $list;
88 ($list) = $list =~ /^"?(.*?)"?\s*$/s;
90 # Under Perl 5.005 we can split very nicely at colons, ignoring double
93 # @split = split /\s*(?<!:):(?!:)\s*(?:\\\s*)?/s, $list;
95 # However, we'd better make this work under Perl 5.004, since there is
96 # a lot of that about.
98 $list =~ s/::/>%%%%</g;
99 @split = split /\s*:\s*(?:\\\s*)?/s, $list;
100 foreach $item (@split)
102 $item =~ s/>%%%%</::/g;
113 ##################################################
115 ##################################################
117 # This function is called after we have generated no output for an option;
118 # it skips subsequent blank lines if the previous line was blank.
124 $i++ while $c[$i+1] =~ /^\s*$/;
133 ##################################################
134 # Get base name of data key #
135 ##################################################
138 return "$_[0]" if $_[0] !~ /^(?:d|r|t)\.[^.]+\.(.*)/;
144 ##################################################
145 # Amalgamate accept/reject/reject_except #
146 ##################################################
148 # This function amalgamates the three previous kinds of
149 # option into a single list, using negation for the middle one if
150 # the final argument is "+", or for the outer two if the final
154 my($accept,$reject,$reject_except,$name);
155 my($last_was_negated) = 0;
160 $reject_except = $o{$_[2]};
165 ($accept) = $accept =~ /^"?(.*?)"?\s*$/s if defined $accept;
166 $reject = &negate($reject) if defined $reject;
167 ($reject_except) = $reject_except =~ /^"?(.*?)"?\s*$/s if defined $reject_except;
171 $accept = &negate($accept) if defined $accept;
172 ($reject) = $reject =~ /^"?(.*?)"?\s*$/s if defined $reject;
173 $reject_except = &negate($reject_except) if defined $reject_except;
176 print STDOUT "# >> Option rewritten by convert4r3\n";
177 print STDOUT "${i1}$name = \"";
179 if (defined $reject_except)
181 print STDOUT "$reject_except";
183 $last_was_negated = ($_[4] ne "+");
187 print STDOUT "$join$reject";
189 $last_was_negated = ($_[4] eq "+");
193 print STDOUT "$join$accept";
194 $last_was_negated = ($_[4] ne "+");
198 print STDOUT "$join*" if $last_was_negated;
203 my($driver_type) = "";
205 if ($_[0] =~ /^(d|r|t)\.([^.]+)\./ ||
206 $_[1] =~ /^(d|r|t)\.([^.]+)\./ ||
207 $_[2] =~ /^(d|r|t)\.([^.]+)\./)
209 $driver_type = ($1 eq 'd')? "director" : ($1 eq 'r')? "router" : "transport";
213 my($x) = ($driver_type ne "")? " in \"$driver_name\" $driver_type" : "";
215 my($l0) = &base($_[0]);
216 my($l1) = &base($_[1]);
217 my($l2) = &base($_[2]);
224 printf STDERR "\n%03d $l1 converted to $name$x.\n", ++$count;
228 printf STDERR "\n%03d $l0 and $l1\n amalgamated into $name$x.\n",
236 printf STDERR "\n%03d $l0 and $l2\n amalgamated into $name$x.\n",
241 printf STDERR "\n%03d $l0, $l1 and $l2\n amalgamated into " .
242 "$name$x.\n", ++$count;
250 ##################################################
251 # Join two lists, if they exist #
252 ##################################################
255 my($l1) = $o{"$_[0]"};
256 my($l2) = $o{"$_[1]"};
258 return $l2 if (!defined $l1);
259 return $l1 if (!defined $l2);
261 ($l1) = $l1 =~ /^"?(.*?)"?\s*$/s;
262 ($l2) = $l2 =~ /^"?(.*?)"?\s*$/s;
270 ##################################################
271 # Amalgamate accept/reject/reject_except pairs #
272 ##################################################
274 # This is like amalgamate, but it combines pairs of arguments, and
275 # doesn't output commentary (easier to write a generic one for the few
278 sub amalgamatepairs {
279 my($accept) = &pair($_[0], $_[1]);
280 my($reject) = &pair($_[2], $_[3]);
281 my($reject_except) = &pair($_[4], $_[5]);
282 my($last_was_negated) = 0;
287 ($accept) = $accept =~ /^"?(.*?)"?\s*$/s if defined $accept;
288 $reject = &negate($reject) if defined $reject;
289 ($reject_except) = $reject_except =~ /^"?(.*?)"?\s*$/s if defined $reject_except;
293 $accept = &negate($accept) if defined $accept;
294 ($reject) = $reject =~ /^"?(.*?)"?$/s if defined $reject;
295 $reject_except = &negate($reject_except) if defined $reject_except;
298 print STDOUT "# >> Option rewritten by convert4r3\n";
299 print STDOUT "${i1}$_[6] = \"";
301 if (defined $reject_except)
303 print STDOUT "$reject_except";
305 $last_was_negated = ($_[7] ne "+");
309 print STDOUT "$join$reject";
311 $last_was_negated = ($_[7] eq "+");
315 print STDOUT "$join$accept";
316 $last_was_negated = ($_[7] ne "+");
320 print STDOUT "$join*" if $last_was_negated;
326 ##################################################
327 # Amalgamate boolean and exception list(s) #
328 ##################################################
330 sub amalgboolandlist {
331 my($name,$bool,$e1,$e2) = @_;
333 print STDOUT "# >> Option rewritten by convert4r3\n";
334 if ($bool eq "false")
336 printf STDOUT "$i1$name =\n";
340 printf STDOUT "$i1$name = ";
341 my($n1) = &negate($o{$e1});
342 my($n2) = &negate($o{$e2});
343 if (!defined $n1 && !defined $n2)
349 print STDOUT "\"$n2 : \\\n *\"\n";
353 print STDOUT "\"$n1 : \\\n *\"\n";
357 print STDOUT "\"$n1 : \\\n $n2 : \\\n *\"\n";
364 ##################################################
365 # Convert mask format #
366 ##################################################
368 # This function converts an address and mask in old-fashioned dotted-quad
369 # format into an address plus a new format mask.
371 @byte_list = (0, 128, 192, 224, 240, 248, 252, 254, 255);
374 my($address,$mask) = @_;
378 my(@bytes) = split /\./, $mask;
380 for ($i = 0; $i < 4; $i++)
382 for ($j = 0; $j <= 8; $j++)
384 if ($bytes[$i] == $byte_list[$j])
389 for ($i++; $i < 4; $i++)
391 $j = 9 if ($bytes[$i] != 0);
400 print STDERR "*** IP mask $mask cannot be converted to /n format. ***\n";
401 return "$address/$mask";
405 if (!defined $masks{$mask})
407 printf STDERR "\n%03d IP address mask $mask converted to /$length\n",
408 ++$count, $mask, $length;
412 return sprintf "$address/%d", $length;
419 ##################################################
421 ##################################################
423 print STDERR "Exim pre-release 3.00 configuration file converter.\n";
426 $seen_helo_accept_junk = 0;
427 $seen_hold_domains = 0;
428 $seen_receiver_unqualified = 0;
429 $seen_receiver_verify_except = 0;
430 $seen_receiver_verify_senders = 0;
431 $seen_rfc1413_except = 0;
432 $seen_sender_accept = 0;
433 $seen_sender_accept_recipients = 0;
434 $seen_sender_host_accept = 0;
435 $seen_sender_host_accept_recipients = 0;
436 $seen_sender_host_accept_relay = 0;
437 $seen_sender_unqualified = 0;
438 $seen_sender_verify_except_hosts = 0;
441 $seen_smtp_reserve = 0;
444 # Read the entire file into an array
448 # First, go through the input and covert any net masks in the old dotted-quad
449 # style into the new /n style.
451 for ($i = 0; $i < scalar(@c); $i++)
454 s"((?:\d{1,3}\.){3}\d{1,3})/((?:\d{1,3}\.){3}\d{1,3})"&mask($1,$2)"eg;
457 # We now make two more passes over the input. In the first pass, we place all
458 # the option values into an associative array. Main options are keyed by their
459 # names; options for drivers are keyed by a driver type letter, the driver
460 # name, and the option name, dot-separated. In the second pass we modify
461 # the options if necessary, and write the output file.
463 for ($pass = 1; $pass < 3; $pass++)
469 for ($i = 0; $i < scalar(@c); $i++)
471 # Everything after the router section is just copied in pass 2 and
474 if ($prefix eq "end")
476 print STDOUT "$c[$i]\n" if $pass == 2;
482 $type = &checkline($c[$i]);
484 # Skip comments in pass 1; copy in pass 2
486 if ($type eq "comment")
488 $last_was_blank = ($c[$i] =~ /^\s*$/)? 1 : 0;
489 print STDOUT "$c[$i]\n" if $pass == 2;
493 # Skip/copy macro definitions, but must handle continuations
495 if ($type eq "macro")
497 print STDOUT "$c[$i]\n" if $pass == 2;
498 while ($c[$i] =~ /\\\s*$/)
501 print STDOUT "$c[$i]\n" if $pass == 2;
507 # Handle end of section
511 $prefix = "end"if $prefix eq "r.";
512 $prefix = "r." if $prefix eq "d.";
513 $prefix = "d." if $prefix eq "t.";
514 $prefix = "t." if $prefix eq "";
515 print STDOUT "$c[$i]\n" if $pass == 2;
520 # Handle start of a new driver
522 if ($type eq "driver")
525 print STDOUT "$c[$i]\n" if $pass == 2;
528 $seen_local_parts = 0;
530 $seen_mx_domains = 0;
535 # Handle definition of an option
537 if ($type eq "option")
539 # Handle continued strings
541 if ($rest =~ /^=\s*".*\\$/)
545 $rest .= "\n$c[++$i]";
546 last unless $c[$i] =~ /(\\\s*$|^\s*#)/;
550 # Remove any terminating commas and semicolons in pass 2
552 if ($pass == 2 && $rest =~ /[;,]\s*$/)
554 $rest =~ s/\s*[;,]\s*$//;
558 "\n%03d Terminating semicolons and commas removed from driver " .
559 "options.\n", ++$count;
564 # Convert all booleans to "x = true/false" format, but save the
565 # original so that it can be reproduced unchanged for options that
566 # are not of interest.
571 if ($name =~ /^not?_(.*)/)
576 elsif ($rest !~ /^=/)
581 # Set up the associative array key, and get rid of the = on the data
583 $key = ($prefix eq "")? "$name" : "$prefix$driver.$name";
584 ($rest) = $rest =~ /^=\s*(.*)/s;
586 # Create the associative array of values in pass 1
593 # In pass 2, test for interesting options and do the necessary; copy
598 ########## Global configuration ##########
600 # These global options are abolished
602 if ($name eq "address_directory_transport" ||
603 $name eq "address_directory2_transport" ||
604 $name eq "address_file_transport" ||
605 $name eq "address_pipe_transport" ||
606 $name eq "address_reply_transport")
608 ($n2) = $name =~ /^address_(.*)/;
609 printf STDERR "\n%03d $name option deleted.\n", ++$count;
610 printf STDERR " $n2 will be added to appropriate directors.\n";
611 $i = &skipblanks($i);
615 # This debugging option is abolished
617 elsif ($name eq "sender_verify_log_details")
619 printf STDERR "\n%03d $name option deleted.\n", ++$count;
620 printf STDERR " (Little used facility abolished.)\n";
623 # This option has been renamed
625 elsif ($name eq "check_dns_names")
627 $origname =~ s/check_dns/dns_check/;
628 print STDOUT "# >> Option rewritten by convert4r3\n";
629 print STDOUT "$i1$origname$i2$origrest\n";
630 printf STDERR "\n%03d check_dns_names renamed as dns_check_names.\n",
634 # helo_accept_junk_nets is abolished
636 elsif ($name eq "helo_accept_junk_nets" ||
637 $name eq "helo_accept_junk_hosts")
639 if (!$seen_helo_accept_junk)
641 &amalgamate("helo_accept_junk_nets", "",
642 "helo_accept_junk_hosts", "helo_accept_junk_hosts", "+");
643 $seen_helo_accept_junk = 1;
647 $i = &skipblanks($i);
652 # helo_verify_except_{hosts,nets} are abolished, and helo_verify
653 # is now a host list instead of a boolean.
655 elsif ($name eq "helo_verify")
657 &amalgboolandlist("helo_verify", $rest, "helo_verify_except_hosts",
658 "helo_verify_except_nets");
659 printf STDERR "\n%03d helo_verify converted to host list.\n",
662 elsif ($name eq "helo_verify_except_hosts" ||
663 $name eq "helo_verify_except_nets")
665 $i = &skipblanks($i);
669 # helo_verify_nets was an old synonym for host_lookup_nets; only
670 # one of them will be encountered. Change to a new name.
672 elsif ($name eq "helo_verify_nets" ||
673 $name eq "host_lookup_nets")
675 print STDOUT "# >> Option rewritten by convert4r3\n";
676 print STDOUT "${i1}host_lookup$i2$origrest\n";
677 printf STDERR "\n%03d $name renamed as host_lookup.\n", ++$count;
680 # hold_domains_except is abolished; add as negated items to
683 elsif ($name eq "hold_domains_except" ||
684 $name eq "hold_domains")
686 if ($seen_hold_domains) # If already done with these
687 { # omit, and following blanks.
688 $i = &skipblanks($i);
691 $seen_hold_domains = 1;
693 if (exists $o{"hold_domains_except"})
695 &amalgamate("hold_domains", "hold_domains_except", "",
696 "hold_domains", "+");
700 print STDOUT "$i1$origname$i2$origrest\n";
704 # ignore_fromline_nets is renamed as ignore_fromline_hosts
706 elsif ($name eq "ignore_fromline_nets")
708 $origname =~ s/_nets/_hosts/;
709 print STDOUT "# >> Option rewritten by convert4r3\n";
710 print STDOUT "$i1$origname$i2$origrest\n";
712 "\n%03d ignore_fromline_nets renamed as ignore_fromline_hosts.\n",
716 # Output a warning for message filters with no transports set
718 elsif ($name eq "message_filter")
720 print STDOUT "$i1$origname$i2$origrest\n";
722 if (!exists $o{"message_filter_directory_transport"} &&
723 !exists $o{"message_filter_directory2_transport"} &&
724 !exists $o{"message_filter_file_transport"} &&
725 !exists $o{"message_filter_pipe_transport"} &&
726 !exists $o{"message_filter_reply_transport"})
729 "\n%03d message_filter is set, but no message_filter transports "
731 . " If your filter generates file or pipe deliveries, or "
733 . " you will need to define "
734 . "message_filter_{file,pipe,reply}_transport\n"
735 . " options, as required.\n", ++$count;
739 # queue_remote_except is abolished, and queue_remote is replaced by
740 # queue_remote_domains, which is a host list.
742 elsif ($name eq "queue_remote")
744 &amalgboolandlist("queue_remote_domains", $rest,
745 "queue_remote_except", "");
747 "\n%03d queue_remote converted to domain list queue_remote_domains.\n",
750 elsif ($name eq "queue_remote_except")
752 $i = &skipblanks($i);
756 # queue_smtp_except is abolished, and queue_smtp is replaced by
757 # queue_smtp_domains, which is a host list.
759 elsif ($name eq "queue_smtp")
761 &amalgboolandlist("queue_smtp_domains", $rest,
762 "queue_smtp_except", "");
764 "\n%03d queue_smtp converted to domain list queue_smtp_domains.\n",
767 elsif ($name eq "queue_smtp_except")
769 $i = &skipblanks($i);
773 # rbl_except_nets is replaced by rbl_hosts
775 elsif ($name eq "rbl_except_nets")
777 &amalgamate("", "rbl_except_nets", "", "rbl_hosts", "+");
780 # receiver_unqualified_nets is abolished
782 elsif ($name eq "receiver_unqualified_nets" ||
783 $name eq "receiver_unqualified_hosts")
785 if (!$seen_receiver_unqualified)
787 &amalgamate("receiver_unqualified_nets", "",
788 "receiver_unqualified_hosts", "receiver_unqualified_hosts", "+");
789 $seen_receiver_unqualified = 1;
793 $i = &skipblanks($i);
798 # receiver_verify_except_{hosts,nets} are replaced by
799 # receiver_verify_hosts.
801 elsif ($name eq "receiver_verify_except_hosts" ||
802 $name eq "receiver_verify_except_nets")
804 if (!$seen_receiver_verify_except)
806 &amalgboolandlist("receiver_verify_hosts", "true",
807 "receiver_verify_except_hosts", "receiver_verify_except_nets");
809 "\n%03d receiver_verify_except_{hosts,nets} converted to " .
810 "receiver_verify_hosts.\n",
812 $seen_receiver_verify_except = 1;
816 $i = &skipblanks($i);
821 # receiver_verify_senders_except is abolished
823 elsif ($name eq "receiver_verify_senders" ||
824 $name eq "receiver_verify_senders_except")
826 if (defined $o{"receiver_verify_senders_except"})
828 if (!$seen_receiver_verify_senders)
830 &amalgamate("receiver_verify_senders",
831 "receiver_verify_senders_except", "",
832 "receiver_verify_senders", "+");
833 $seen_receiver_verify_senders = 1;
837 $i = &skipblanks($i);
843 print STDOUT "$i1$origname$i2$origrest\n";
847 # rfc1413_except_{hosts,nets} are replaced by rfc1413_hosts.
849 elsif ($name eq "rfc1413_except_hosts" ||
850 $name eq "rfc1413_except_nets")
852 if (!$seen_rfc1413_except)
854 &amalgboolandlist("rfc1413_hosts", "true",
855 "rfc1413_except_hosts", "rfc1413_except_nets");
857 "\n%03d rfc1413_except_{hosts,nets} converted to rfc1413_hosts.\n",
859 $seen_rfc1413_except = 1;
863 $i = &skipblanks($i);
868 # sender_accept and sender_reject_except are abolished
870 elsif ($name eq "sender_accept" ||
871 $name eq "sender_reject")
873 if (!$seen_sender_accept)
875 &amalgamate("sender_accept", "sender_reject",
876 "sender_reject_except", "sender_reject", "-");
877 $seen_sender_accept = 1;
881 $i = &skipblanks($i);
886 # sender_accept_recipients is also abolished; sender_reject_except
887 # also used to apply to this, so we include it here as well.
889 elsif ($name eq "sender_accept_recipients" ||
890 $name eq "sender_reject_recipients")
892 if (!$seen_sender_accept_recipients)
894 &amalgamate("sender_accept_recipients", "sender_reject_recipients",
895 "sender_reject_except", "sender_reject_recipients", "-");
896 $seen_sender_accept_recipients = 1;
900 $i = &skipblanks($i);
905 # sender_reject_except must be removed
907 elsif ($name eq "sender_reject_except")
909 $i = &skipblanks($i);
913 # sender_{host,net}_{accept,reject}[_except] all collapse into
916 elsif ($name eq "sender_host_accept" ||
917 $name eq "sender_net_accept" ||
918 $name eq "sender_host_reject" ||
919 $name eq "sender_net_reject")
921 if (!$seen_sender_host_accept)
923 &amalgamatepairs("sender_host_accept", "sender_net_accept",
924 "sender_host_reject", "sender_net_reject",
925 "sender_host_reject_except", "sender_net_reject_except",
927 printf STDERR "\n%03d sender_{host,net}_{accept,reject} and " .
928 "sender_{host_net}_reject_except\n" .
929 " amalgamated into host_reject.\n", ++$count;
930 $seen_sender_host_accept = 1;
934 $i = &skipblanks($i);
939 # sender_{host,net}_{accept,reject}_recipients all collapse into
940 # host_reject_recipients.
942 elsif ($name eq "sender_host_accept_recipients" ||
943 $name eq "sender_net_accept_recipients" ||
944 $name eq "sender_host_reject_recipients" ||
945 $name eq "sender_net_reject_recipients")
947 if (!$seen_sender_host_accept_recipients)
949 &amalgamatepairs("sender_host_accept_recipients",
950 "sender_net_accept_recipients",
951 "sender_host_reject_recipients",
952 "sender_net_reject_recipients",
953 "sender_host_reject_except", "sender_net_reject_except",
954 "host_reject_recipients", "-");
955 printf STDERR "\n%03d sender_{host,net}_{accept,reject}_recipients"
956 . "\n and sender_{host_net}_reject_except"
957 . "\n amalgamated into host_reject_recipients.\n", ++$count;
958 $seen_sender_host_accept_recipients = 1;
962 $i = &skipblanks($i);
967 # sender_{host,net}_reject_except must be removed
969 elsif ($name eq "sender_host_reject_except" ||
970 $name eq "sender_net_reject_except")
972 $i = &skipblanks($i);
976 # sender_{host,net}_{accept,reject}_relay all collapse into
979 elsif ($name eq "sender_host_accept_relay" ||
980 $name eq "sender_net_accept_relay" ||
981 $name eq "sender_host_reject_relay" ||
982 $name eq "sender_net_reject_relay")
984 if (!$seen_sender_host_accept_relay)
986 &amalgamatepairs("sender_host_accept_relay",
987 "sender_net_accept_relay",
988 "sender_host_reject_relay",
989 "sender_net_reject_relay",
990 "sender_host_reject_relay_except",
991 "sender_net_reject_relay_except",
992 "host_accept_relay", "+");
993 printf STDERR "\n%03d sender_{host,net}_{accept,reject}_relay"
994 . "\n and sender_{host_net}_reject_relay_except"
995 . "\n amalgamated into host_accept_relay.\n", ++$count;
996 $seen_sender_host_accept_relay = 1;
1000 $i = &skipblanks($i);
1005 # sender_{host,net}_reject_relay_except must be removed
1007 elsif ($name eq "sender_host_reject_relay_except" ||
1008 $name eq "sender_net_reject_relay_except")
1010 $i = &skipblanks($i);
1015 # sender_unqualified_nets is abolished
1017 elsif ($name eq "sender_unqualified_nets" ||
1018 $name eq "sender_unqualified_hosts")
1020 if (!$seen_sender_unqualified)
1022 &amalgamate("sender_unqualified_nets", "",
1023 "sender_unqualified_hosts", "sender_unqualified_hosts", "+");
1024 $seen_sender_unqualified = 1;
1028 $i = &skipblanks($i);
1033 # sender_verify_except_{hosts,nets} are replaced by sender_verify_hosts.
1035 elsif ($name eq "sender_verify_except_hosts" ||
1036 $name eq "sender_verify_except_nets")
1038 if (!$seen_sender_verify_except_hosts)
1040 &amalgboolandlist("sender_verify_hosts", "true",
1041 "sender_verify_except_hosts", "sender_verify_except_nets");
1043 "\n%03d sender_verify_except_{hosts,nets} converted to " .
1044 "sender_verify_hosts.\n",
1046 $seen_sender_verify_except_hosts = 1;
1050 $i = &skipblanks($i);
1055 # smtp_etrn_nets is abolished
1057 elsif ($name eq "smtp_etrn_nets" ||
1058 $name eq "smtp_etrn_hosts")
1060 if (!$seen_smtp_etrn)
1062 &amalgamate("smtp_etrn_nets", "",
1063 "smtp_etrn_hosts", "smtp_etrn_hosts", "+");
1064 $seen_smtp_etrn = 1;
1068 $i = &skipblanks($i);
1073 # smtp_expn_nets is abolished
1075 elsif ($name eq "smtp_expn_nets" ||
1076 $name eq "smtp_expn_hosts")
1078 if (!$seen_smtp_expn)
1080 &amalgamate("smtp_expn_nets", "",
1081 "smtp_expn_hosts", "smtp_expn_hosts", "+");
1082 $seen_smtp_expn = 1;
1086 $i = &skipblanks($i);
1091 # This option has been renamed
1093 elsif ($name eq "smtp_log_connections")
1095 $origname =~ s/smtp_log/log_smtp/;
1096 print STDOUT "# >> Option rewritten by convert4r3\n";
1097 print STDOUT "$i1$origname$i2$origrest\n";
1098 printf STDERR "\n%03d smtp_log_connections renamed as " .
1099 "log_smtp_connections.\n",
1103 # smtp_reserve_nets is abolished
1105 elsif ($name eq "smtp_reserve_nets" ||
1106 $name eq "smtp_reserve_hosts")
1108 if (!$seen_smtp_reserve)
1110 &amalgamate("smtp_reserve_nets", "",
1111 "smtp_reserve_hosts", "smtp_reserve_hosts", "+");
1112 $seen_smtp_reserve = 1;
1116 $i = &skipblanks($i);
1121 ########### Driver configurations ##########
1123 # For aliasfile and forwardfile directors, add file, pipe, and
1124 # reply transports - copying from the globals if they are set.
1126 elsif ($name eq "driver")
1128 $driver_type = $rest;
1129 print STDOUT "$i1$origname$i2$origrest\n";
1130 if ($rest eq "aliasfile" || $rest eq "forwardfile")
1132 &add_transport("directory");
1133 &add_transport("directory2");
1134 &add_transport("file");
1135 &add_transport("pipe");
1136 &add_transport("reply") if $rest eq "forwardfile";
1140 # except_domains is abolished; add as negated items to domains.
1142 elsif ($name eq "except_domains" ||
1145 if ($seen_domains) # If already done with these
1146 { # omit, and following blanks.
1147 $i = &skipblanks($i);
1152 if (exists $o{"$prefix$driver.except_domains"})
1154 &amalgamate("$prefix$driver.domains",
1155 "$prefix$driver.except_domains", "",
1160 print STDOUT "$i1$origname$i2$origrest\n";
1164 # except_local_parts is abolished; add as negated items to
1167 elsif ($name eq "except_local_parts" ||
1168 $name eq "local_parts")
1170 if ($seen_local_parts) # If already done with these
1171 { # omit, and following blanks.
1172 $i = &skipblanks($i);
1175 $seen_local_parts = 1;
1177 if (exists $o{"$prefix$driver.except_local_parts"})
1179 &amalgamate("$prefix$driver.local_parts",
1180 "$prefix$driver.except_local_parts", "",
1181 "local_parts", "+");
1185 print STDOUT "$i1$origname$i2$origrest\n";
1189 # except_senders is abolished; add as negated items to senders
1191 elsif ($name eq "except_senders" ||
1194 if ($seen_senders) # If already done with these
1195 { # omit, and following blanks.
1196 $i = &skipblanks($i);
1201 if (exists $o{"$prefix$driver.except_senders"})
1203 &amalgamate("$prefix$driver.senders",
1204 "$prefix$driver.except_senders", "",
1209 print STDOUT "$i1$origname$i2$origrest\n";
1213 # This option has been renamed
1215 elsif ($name eq "directory" && $driver_type eq "aliasfile")
1217 $origname =~ s/directory/home_directory/;
1218 print STDOUT "# >> Option rewritten by convert4r3\n";
1219 print STDOUT "$i1$origname$i2$origrest\n";
1220 printf STDERR "\n%03d directory renamed as " .
1221 "home_directory in \"$driver\" director.\n",
1225 # This option has been renamed
1227 elsif ($name eq "directory" && $driver_type eq "forwardfile")
1229 $origname =~ s/directory/file_directory/;
1230 print STDOUT "# >> Option rewritten by convert4r3\n";
1231 print STDOUT "$i1$origname$i2$origrest\n";
1232 printf STDERR "\n%03d directory renamed as " .
1233 "file_directory in \"$driver\" director.\n",
1237 # This option has been renamed
1239 elsif ($name eq "forbid_filter_log" && $driver_type eq "forwardfile")
1241 $origname =~ s/log/logwrite/;
1242 print STDOUT "# >> Option rewritten by convert4r3\n";
1243 print STDOUT "$i1$origname$i2$origrest\n";
1244 printf STDERR "\n%03d forbid_filter_log renamed as " .
1245 "forbid_filter_logwrite in \"$driver\" director.\n",
1249 # This option has been renamed
1251 elsif ($name eq "directory" && $driver_type eq "localuser")
1253 $origname =~ s/directory/match_directory/;
1254 print STDOUT "# >> Option rewritten by convert4r3\n";
1255 print STDOUT "$i1$origname$i2$origrest\n";
1256 printf STDERR "\n%03d directory renamed as " .
1257 "match_directory in \"$driver\" director.\n",
1261 # mx_domains_except (and old synonym non_mx_domains) are abolished
1262 # (both lookuphost router and smtp transport)
1264 elsif ($name eq "mx_domains" ||
1265 $name eq "mx_domains_except" ||
1266 $name eq "non_mx_domains")
1268 if ($seen_mx_domains) # If already done with these
1269 { # omit, and following blanks.
1270 $i = &skipblanks($i);
1273 $seen_mx_domains = 1;
1275 if (exists $o{"$prefix$driver.mx_domains_except"} ||
1276 exists $o{"$prefix$driver.non_mx_domains"})
1278 $o{"$prefix$driver.mx_domains_except"} =
1279 &pair("$prefix$driver.mx_domains_except",
1280 "$prefix$driver.non_mx_domains");
1282 &amalgamate("$prefix$driver.mx_domains",
1283 "$prefix$driver.mx_domains_except", "",
1288 print STDOUT "$i1$origname$i2$origrest\n";
1292 # This option has been renamed
1294 elsif ($name eq "directory" && $driver_type eq "pipe")
1296 $origname =~ s/directory/home_directory/;
1297 print STDOUT "# >> Option rewritten by convert4r3\n";
1298 print STDOUT "$i1$origname$i2$origrest\n";
1299 printf STDERR "\n%03d directory renamed as " .
1300 "home_directory in \"$driver\" director.\n",
1304 # serialize_nets is abolished
1306 elsif ($name eq "serialize_nets" ||
1307 $name eq "serialize_hosts")
1309 if (!$seen_serialize)
1311 &amalgamate("$prefix$driver.serialize_nets", "",
1312 "$prefix$driver.serialize_hosts", "serialize_hosts", "+");
1313 $seen_serialize = 1;
1317 $i = &skipblanks($i);
1323 # Option not of interest; reproduce verbatim
1327 print STDOUT "$i1$origname$i2$origrest\n";
1331 $last_was_blank = 0;
1338 # Debugging: show the associative array
1339 # foreach $key (sort keys %o) { print STDERR "$key = $o{$key}\n"; }
1341 print STDERR "\nEnd of configuration file conversion.\n";
1342 print STDERR "\n*******************************************************\n";
1343 print STDERR "***** Please review the generated file carefully. *****\n";
1344 print STDERR "*******************************************************\n\n";
1346 print STDERR "In particular:\n\n";
1348 print STDERR "(1) If you use regular expressions in any options that have\n";
1349 print STDERR " been rewritten by this script, they might have been put\n";
1350 print STDERR " inside quotes, when then were not previously quoted. This\n";
1351 print STDERR " means that any backslashes in them must now be escaped.\n\n";
1353 print STDERR "(2) If your configuration refers to any external files that\n";
1354 print STDERR " contain lists of network addresses, check that the masks\n";
1355 print STDERR " are specified as single numbers, e.g. /24 and NOT as dotted\n";
1356 print STDERR " quads (e.g. 255.255.255.0) because Exim release 3.00 does\n";
1357 print STDERR " not recognize the dotted quad form.\n\n";
1359 print STDERR "(3) If your configuration uses macros for lists of domains or\n";
1360 print STDERR " hosts or addresses, check to see if any of the references\n";
1361 print STDERR " have been negated. If so, you will have to rework things,\n";
1362 print STDERR " because the negation will apply only to the first item in\n";
1363 print STDERR " the macro-generated list.\n\n";
1365 print STDERR "(4) If you do not generate deliveries to pipes, files, or\n";
1366 print STDERR " auto-replies in your aliasfile and forwardfile directors,\n";
1367 print STDERR " you can remove the added transport settings.\n\n";