masqmail

changeset 311:e230bcd0f1c6

removed protocol option from route config It was somehow redundant. Now, if `pipe' is set, the protocol will be pipe, otherwise it'll be smtp. That's just natural.
author meillo@marmaro.de
date Sun, 24 Apr 2011 19:37:56 +0200
parents f10a56dc7481
children c74adb7c4f50
files admin/config-transition docs/simple-relay-setup examples/openssl.route man/masqmail.route.5 src/conf.c src/deliver.c src/masqmail.h
diffstat 7 files changed, 25 insertions(+), 50 deletions(-) [+]
line diff
     1.1 --- a/admin/config-transition	Sun Apr 24 19:14:38 2011 +0200
     1.2 +++ b/admin/config-transition	Sun Apr 24 19:37:56 2011 +0200
     1.3 @@ -1,12 +1,11 @@
     1.4  #!/bin/sh
     1.5  #
     1.6  # check masqmail config files for options that are obsolete
     1.7 -# -v enables verbose output
     1.8  #
     1.9  # 2010  markus schnalke <meillo@marmaro.de>
    1.10  
    1.11  if [ $# -eq 0 ] ; then
    1.12 -	echo "usage: config-transition [-v] CONFIGFILE..." >&2
    1.13 +	echo "usage: config-transition CONFIGFILE..." >&2
    1.14  	exit 1
    1.15  fi
    1.16  
    1.17 @@ -93,6 +92,10 @@
    1.18  All we have is a comment in the code saying: This option is used by sqilconf. \
    1.19  "
    1.20  
    1.21 +check["protocol"] = "route" SUBSEP "Removed in 0.3.2" SUBSEP "\
    1.22 +If pipe is given, pipe will be used, otherwise smtp will be used. \
    1.23 +"
    1.24 +
    1.25  # get files
    1.26  
    1.27  # already covered by the get.* and online_gets.* options in the conf
    1.28 @@ -126,26 +129,17 @@
    1.29  		split(check[key], a, SUBSEP);  # array index starts with 1
    1.30  		printf("%s:%d: [%s] %s%s\n", FILENAME, NR, a[1], key, checkcomment());
    1.31  		cmd = "fold -sw 70 | sed 's,^,\t,'"
    1.32 -		if (verbose) {
    1.33 -			print "\t>>>> " \$0 " <<<<"
    1.34 -			print a[3] | cmd
    1.35 -			close(cmd)
    1.36 -			print "\t" a[2]
    1.37 -			print ""
    1.38 -		}
    1.39 +		print "\t>>>> " \$0 " <<<<"
    1.40 +		print a[3] | cmd
    1.41 +		close(cmd)
    1.42 +		print "\t" a[2]
    1.43 +		print ""
    1.44  	}
    1.45  }
    1.46  			
    1.47  !
    1.48  
    1.49  
    1.50 -verbose=0
    1.51 -if [ X"$1" = X"-v" ] ; then
    1.52 -	verbose=1
    1.53 -	shift
    1.54 -fi
    1.55 -
    1.56  for i do
    1.57 -	awk -f "$awkscript" "verbose=$verbose" "$i"
    1.58 +	awk -f "$awkscript" "$i"
    1.59  done
    1.60 -
     2.1 --- a/docs/simple-relay-setup	Sun Apr 24 19:14:38 2011 +0200
     2.2 +++ b/docs/simple-relay-setup	Sun Apr 24 19:37:56 2011 +0200
     2.3 @@ -34,8 +34,6 @@
     2.4  
     2.5  Addionally you need to create the route config file like:
     2.6  
     2.7 -    protocol = smtp
     2.8 -
     2.9      # where to relay to; the address and port of the smart host
    2.10      mail_host = "mail.gmx.net:25"
    2.11      # use a wrapper to enable encryption
     3.1 --- a/examples/openssl.route	Sun Apr 24 19:14:38 2011 +0200
     3.2 +++ b/examples/openssl.route	Sun Apr 24 19:37:56 2011 +0200
     3.3 @@ -2,8 +2,6 @@
     3.4  # by Philipp Berndt
     3.5  
     3.6  
     3.7 -protocol = "smtp"
     3.8 -
     3.9  # encryption is done by communicating through openssl
    3.10  
    3.11  # Today usually STARTTLS (RFC-3207) is used:
     4.1 --- a/man/masqmail.route.5	Sun Apr 24 19:14:38 2011 +0200
     4.2 +++ b/man/masqmail.route.5	Sun Apr 24 19:37:56 2011 +0200
     4.3 @@ -9,17 +9,15 @@
     4.4  This man page describes the syntax of the route configuration files of \fBmasqmail (8)\fR.
     4.5  Their usual locations are in \fI/etc/masqmail/\fR.
     4.6  
     4.7 +Mail will be sent with the SMTP protocol to its destination, unless
     4.8 +`pipe' is given.
     4.9 +In this case the message will be piped to the given program.
    4.10 +See option `pipe' below.
    4.11 +
    4.12 +
    4.13  .SH OPTIONS
    4.14  
    4.15  .TP
    4.16 -\fBprotocol\fR = \fIstring\fR
    4.17 -
    4.18 -\fIstring\fR can be one of `smtp' or `pipe', default is `smtp'.
    4.19 -If set to `smtp', mail will be sent with the SMTP protocol to its destination.
    4.20 -If set to `pipe', you also have to set `pipe' to a command, the message will then be piped to a program.
    4.21 -See option `pipe' below.
    4.22 -
    4.23 -.TP
    4.24  \fBmail_host\fR = \fIstring\fR
    4.25  
    4.26  This is preferably the mail server of your ISP.
    4.27 @@ -305,7 +303,6 @@
    4.28  .TP
    4.29  \fBpipe\fR = \fIcommand\fR
    4.30  
    4.31 -If set, and protocol is set to `pipe',
    4.32  \fIcommand\fR will be called and the message will be piped to its stdin.
    4.33  Purpose is to use gateways to uucp, fax, sms or whatever else.
    4.34  
    4.35 @@ -315,15 +312,15 @@
    4.36  .TP
    4.37  \fBpipe_fromline = \fIboolean\fR
    4.38  
    4.39 -If this is set, and protocol is set to `pipe',
    4.40 -a from line will be prepended to the output stream whenever a pipe command is called.
    4.41 +Only if `pipe' is used.
    4.42 +A from line will be prepended to the output stream whenever a pipe command is called.
    4.43  Default is false.
    4.44  
    4.45  .TP
    4.46  \fBpipe_fromhack = \fIboolean\fR
    4.47  
    4.48 -If this is set, and protocol is set to `pipe',
    4.49 -each line beginning with `From ' is replaced with `>From ' whenever a pipe command is called.
    4.50 +Only if `pipe' is used.
    4.51 +Each line beginning with `From ' is replaced with `>From ' whenever a pipe command is called.
    4.52  You probably want this if you have set \fBpipe_fromline\fR above.
    4.53  Default is false.
    4.54  
     5.1 --- a/src/conf.c	Sun Apr 24 19:14:38 2011 +0200
     5.2 +++ b/src/conf.c	Sun Apr 24 19:37:56 2011 +0200
     5.3 @@ -620,7 +620,6 @@
     5.4  	route->filename = g_strdup(filename);
     5.5  	route->name = g_strdup(filename);  /* quick hack */
     5.6  
     5.7 -	route->protocol = g_strdup("smtp");
     5.8  	route->expand_h_sender_address = TRUE;
     5.9  
    5.10  	route->is_local_net = is_local_net;
    5.11 @@ -635,9 +634,7 @@
    5.12  
    5.13  	gchar lval[256], rval[2048];
    5.14  	while (read_statement(in, lval, 256, rval, 2048)) {
    5.15 -		if (strcmp(lval, "protocol") == 0)
    5.16 -			route->protocol = g_strdup(rval);
    5.17 -		else if (strcmp(lval, "mail_host") == 0)
    5.18 +		if (strcmp(lval, "mail_host") == 0)
    5.19  			route->mail_host = parse_interface(rval, 25);
    5.20  		else if (strcmp(lval, "helo_name") == 0)
    5.21  			route->helo_name = g_strdup(rval);
    5.22 @@ -803,8 +800,6 @@
    5.23  {
    5.24  	if (r->filename)
    5.25  		g_free(r->filename);
    5.26 -	if (r->protocol)
    5.27 -		g_free(r->protocol);
    5.28  	if (r->mail_host) {
    5.29  		g_free(r->mail_host->address);
    5.30  		g_free(r->mail_host);
    5.31 @@ -890,7 +885,6 @@
    5.32  		return NULL;
    5.33  	}
    5.34  	memset(route, 0, sizeof(connect_route));
    5.35 -	route->protocol = g_strdup("smtp");
    5.36  	route->is_local_net = TRUE;
    5.37  	route->name = g_strdup("default local_net_route");
    5.38  	route->expand_h_sender_address = TRUE;
     6.1 --- a/src/deliver.c	Sun Apr 24 19:14:38 2011 +0200
     6.2 +++ b/src/deliver.c	Sun Apr 24 19:37:56 2011 +0200
     6.3 @@ -268,11 +268,6 @@
     6.4  
     6.5  	DEBUG(5) debugf("deliver_msglist_host_pipe entered\n");
     6.6  
     6.7 -	if (route->pipe == NULL) {
     6.8 -		logwrite(LOG_ALERT, "no pipe command given for route (protocol is pipe!)\n");
     6.9 -		return FALSE;
    6.10 -	}
    6.11 -
    6.12  	foreach(msgout_list, msgout_node) {
    6.13  		msg_out *msgout = (msg_out *) (msgout_node->data);
    6.14  		gboolean flag, ok_fail = FALSE;
    6.15 @@ -475,11 +470,12 @@
    6.16  gboolean
    6.17  deliver_msglist_host(connect_route * route, GList * msgout_list, gchar * host, GList * res_list)
    6.18  {
    6.19 -	DEBUG(5) debugf("protocol = %s\n", route->protocol);
    6.20  
    6.21 -	if (strcmp(route->protocol, "pipe") == 0) {
    6.22 +	if (route->pipe) {
    6.23 +		DEBUG(5) debugf("with pipe\n");
    6.24  		return deliver_msglist_host_pipe(route, msgout_list, host, res_list);
    6.25  	} else {
    6.26 +		DEBUG(5) debugf("with smtp\n");
    6.27  		return deliver_msglist_host_smtp(route, msgout_list, host, res_list);
    6.28  	}
    6.29  }
     7.1 --- a/src/masqmail.h	Sun Apr 24 19:14:38 2011 +0200
     7.2 +++ b/src/masqmail.h	Sun Apr 24 19:37:56 2011 +0200
     7.3 @@ -81,8 +81,6 @@
     7.4  	gchar *name;
     7.5  	gchar *filename;
     7.6  
     7.7 -	gchar *protocol;
     7.8 -
     7.9  	gboolean is_local_net;
    7.10  	gboolean last_route;
    7.11