view admin/config-transition @ 323:29de6a1c4538

Fixed an important bug with folded headers! g_strconcat() returns a *copy* of the string, but hdr->value still pointed to the old header (which probably was a memory leak, too). If the folded part had been quite small it was likely that the new string was at the same position as the old one, thus making everything go well. But if pretty long headers were folded several times it was likely that the new string was allocated somewhere else in memory, thus breaking things. In result mails to lots of recipients (folded header) were frequently only sent to the ones in the first line. Sorry for the inconvenience.
author meillo@marmaro.de
date Fri, 03 Jun 2011 09:47:27 +0200
parents 55b7bde95d37
children 08932c629849
line wrap: on
line source

#!/bin/sh
#
# check masqmail config files for options that are obsolete
#
# 2010  markus schnalke <meillo@marmaro.de>

if [ $# -eq 0 ] ; then
	echo "usage: config-transition CONFIGFILE..." >&2
	exit 1
fi

awkscript="/tmp/masqmail-config-transition-$$"

trap 'rm -f "$awkscript"; exit' INT QUIT TERM EXIT

cat >"$awkscript" <<!
# Because of the Here-document, escape (with backslash) these characters:
# backslash, dollar, backtick
BEGIN {

########  START OF CHECKS  ########

# Rules look like this:
#
# check["regexp"] = "conf-kind" SUBSEP "version-info" SUBSEP "verbose-description"
#
# Meaning of the strings:
# - regexp: is also used as the name in the normal listing
# - conf-kind: in which kind of config the option appears (conf, route, get)
# - version-info: when it was removed
# - verbose-description: how to do it now


# conf file

check["remote_port"] = "conf" SUBSEP "Removed in 0.3.0" SUBSEP "\
Use 'mail_host' in the route configuration instead. \
"

check["mbox_default.*maildir"] = "conf" SUBSEP "Removed in 0.3.0" SUBSEP "\
Native maildir support was removed completely. \
Use an MDA, e.g. procmail, to deliver to Maildir mail folder. \
"

check["maildir_users"] = "conf" SUBSEP "Removed in 0.3.0" SUBSEP "\
Native maildir support was removed completely. \
Use an MDA, e.g. procmail, to deliver to Maildir mail folder. \
"

check["mserver_iface"] = "conf" SUBSEP "Removed in 0.3.0" SUBSEP "\
Native mserver support was removed from masqmail. \
Use the mservdetect tool with online_detect=pipe instead. \
"

check["get\\\\."] = "conf" SUBSEP "Removed in 0.3.0" SUBSEP "\
The POP3 client was removed from masqmail. \
Use a dedicated POP3 client, e.g. fetchmail, instead. \
"

check["online_gets\\\\."] = "conf" SUBSEP "Removed in 0.3.0" SUBSEP "\
The POP3 client was removed from masqmail. \
Use a dedicated POP3 client, e.g. fetchmail, instead. \
"

check["alias_local_caseless"] = "conf" SUBSEP "Renamed in 0.3.1" SUBSEP "\
It is now called 'caseless_matching' instead. \
"

check["online_detect"] = "conf" SUBSEP "Removed in 0.3.2" SUBSEP "\
Distilled to online_query. \
"

check["online_file"] = "conf" SUBSEP "Removed in 0.3.2" SUBSEP "\
Use online_query=\"/bin/cat /path/to/file\" instead. \
"

check["online_pipe"] = "conf" SUBSEP "Renamed in 0.3.2" SUBSEP "\
Now known as online_query. online_detect=pipe is not needed anymore. \
"

# route files

check["pop3_login"] = "route" SUBSEP "Removed in 0.3.0" SUBSEP "\
POP-before-SMTP login function was removed completely. \
SMTP AUTH supersedes it today. \
If you though rely on it, stay with masqmail-0.2.x or run an arbitrary POP client before. \
"

check["do_ssl"] = "route" SUBSEP "Ignored by masqmail" SUBSEP "\
Please report to the mailing list at <masqmail@marmaro.de> that you used this option. \
We still don't know the rationale behind this option. \
All we have is a comment in the code saying: This option is used by sqilconf. \
"

check["protocol"] = "route" SUBSEP "Removed in 0.3.2" SUBSEP "\
If pipe is given, pipe will be used, otherwise smtp will be used. \
"

check["(^|[ 	])allowed_return_paths"] = "route" SUBSEP "Removed in 0.3.2" SUBSEP "\
Replaced by 'allowed_senders'. \
"

check["not_allowed_return_paths"] = "route" SUBSEP "Removed in 0.3.2" SUBSEP "\
Replaced by 'denied_senders'. \
"

check["(^|[ 	])allowed_mail_locals"] = "route" SUBSEP "Removed in 0.3.2" SUBSEP "\
Replaced by 'allowed_senders', if neither wildcards nor '@' is used. \
"

check["not_allowed_mail_locals"] = "route" SUBSEP "Removed in 0.3.2" SUBSEP "\
Replaced by 'denied_senders', if neither wildcards nor '@' is used. \
"

check["(^|[ 	])allowed_rcpt_domains"] = "route" SUBSEP "Removed in 0.3.2" SUBSEP "\
Replaced by 'allowed_recipients', if the values are prepended with \
'*@', because 'allowed_recipients' matches complete addresses not just \
domains. \
"

check["not_allowed_rcpt_domains"] = "route" SUBSEP "Removed in 0.3.2" SUBSEP "\
Replaced by 'denied_recipients', if the values are prepended with \
'*@', because 'allowed_recipients' matches complete addresses not just \
domains. \
"

# get files

# already covered by the get.* and online_gets.* options in the conf
# file. This check is just to make sure, because one might only check
# the get file.
# We don't check for the other get file options, which are:
# protocol server port wrapper user pass address return_path do_keep
# do_uidl do_uidl_dele max_size max_size_delete max_count resolve_list

check["protocol.*pop"] = "get" SUBSEP "Removed in 0.3.0" SUBSEP "\
The POP3 client was removed from masqmail. \
Use a dedicated POP3 client, e.g. fetchmail, instead. \
"


########  END OF CHECK DEFINITIONS  ########
}

function checkcomment() {
	if (/^[ \t]*\#/) {
		return " (in a comment)"
	}
}

{
	for (key in check) {
		if (\$0 !~ key) {
			continue;
		}
		# we have a match
		split(check[key], a, SUBSEP);  # array index starts with 1
		printf("%s:%d: [%s] %s%s\n", FILENAME, NR, a[1], key, checkcomment());
		cmd = "fold -sw 70 | sed 's,^,\t,'"
		print "\t>>>> " \$0 " <<<<"
		print a[3] | cmd
		close(cmd)
		print "\t" a[2]
		print ""
	}
}
			
!


for i do
	awk -f "$awkscript" "$i"
done