Package: exim4-config
Version: 4.50-6

When upgrading any recent version of the exim4 package, the exim4-config
postinst script tries to update /etc/exim4/update-exim4.conf.conf
configuration file automagically.  This configuration file is used (by
update-exim4.conf) to dynamically create a new exim configuration file
(/var/lib/exim4/config.autogenerated) from templates
(/etc/exim4/exim4.conf.template or /etc/exim4/conf.d).

All appears to work if the configuration variables (ie environment
variables) in etc/exim4/update-exim4.conf.conf do not contained escape
sequences.  If they do they will be replaced with their expansion.  A
result can be that the exim configuration is fatally corrupted.

For example, a configuration in /etc/exim4/update-exim4.conf.conf
such as...
dc_relay_domains='*.some.net.somewhere:\\N^[^.]*$'
will be re-written (after upgrading exim4) as ...
dc_relay_domains='*.some.net.somewhere:\N^[^.]*$'

This change in the configuration is clearly not intended.  (The result
in the example above is that exim stops sending mail and resolving
addresses.)

A patch fixing the problem is attached...

Regards,

        Barry.

-- 
Barry Kitson <[EMAIL PROTECTED]>
diff -Naur exim4-4.50.old/debian/exim4-config.postinst exim4-4.50/debian/exim4-config.postinst
--- exim4-4.50.old/debian/exim4-config.postinst	2005-04-23 14:54:29.701122199 +1000
+++ exim4-4.50/debian/exim4-config.postinst	2005-04-23 14:56:45.164653443 +1000
@@ -283,22 +283,38 @@
 			echo "${variable}=''" >> $UE4CC
 		fi
 	done
+
 	# insert new values, remove outdated ones.
-	sed -e "sÄ^[[:space:]]*dc_eximconfig_configtype=.*Ädc_eximconfig_configtype='${dc_eximconfig_configtype}'Ä" \
-	-e "sÄ^[[:space:]]*dc_local_interfaces=.*Ädc_local_interfaces='${dc_local_interfaces}'Ä" \
-	-e "sÄ^[[:space:]]*dc_other_hostnames=.*Ädc_other_hostnames='${dc_other_hostnames}'Ä" \
-	-e "sÄ^[[:space:]]*dc_readhost=.*Ädc_readhost='${dc_readhost}'Ä" \
-	-e "sÄ^[[:space:]]*dc_relay_domains=.*Ädc_relay_domains='${dc_relay_domains}'Ä" \
-	-e "sÄ^[[:space:]]*dc_relay_nets=.*Ädc_relay_nets='${dc_relay_nets}'Ä" \
-	-e "sÄ^[[:space:]]*dc_smarthost=.*Ädc_smarthost='${dc_smarthost}'Ä" \
-	-e "sÄ^[[:space:]]*dc_minimaldns=.*Ädc_minimaldns='${dc_minimaldns}'Ä" \
-	-e "sÄ^[[:space:]]*CFILEMODE=.*ÄCFILEMODE='${CFILEMODE}'Ä" \
-	-e "sÄ^[[:space:]]*dc_never_users=.*ÄÄ" \
-	-e "sÄ^[[:space:]]*dc_use_split_config=.*Ädc_use_split_config='${dc_use_split_config}'Ä" \
-	-e "sÄ^[[:space:]]*dc_hide_mailname=.*Ädc_hide_mailname='${dc_hide_mailname}'Ä" \
-	-e "sÄ^[[:space:]]*dc_mailname_in_oh=.*Ädc_mailname_in_oh='${dc_mailname_in_oh}'Ä" \
-	< $UE4CC \
-	> ${UE4CC}.tmp
+
+	# Use environment variables to communicate data to awk, to
+	# avoid shell (or awk or sed) string expansion which may
+	# expand escape sequences.  Note that the variables named in
+	# ${dc_directives} (but not the variable names themselves) may
+	# contain escaped characters.  
+
+	export dc_directives ${dc_directives}
+
+	awk '
+            BEGIN {
+                split( ENVIRON["dc_directives"], directives, "[[:space:]]" );
+            }
+            {
+                written = 0;
+                for ( i in directives )
+                   {
+                       regex = "^[[:space:]]*" directives[i] "=";
+                       if ( ( $0 ~ regex ) && ( ! written ) )
+                           {
+                               # Add single quotes (\0x27) around the value.
+                               print directives[i] "=\x27" ENVIRON[directives[i]] "\x27";
+                               written = 1;
+                               break;
+                           }
+                   }
+                   if ( ! written )
+                       print $0;
+            }' < ${UE4CC} > ${UE4CC}.tmp
+
 	mv ${UE4CC}.tmp $UE4CC
 
 	echo $mailname > /etc/mailname

Reply via email to