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 (2011-04-24)
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 wrap: on
line diff
--- a/admin/config-transition	Sun Apr 24 19:14:38 2011 +0200
+++ b/admin/config-transition	Sun Apr 24 19:37:56 2011 +0200
@@ -1,12 +1,11 @@
 #!/bin/sh
 #
 # check masqmail config files for options that are obsolete
-# -v enables verbose output
 #
 # 2010  markus schnalke <meillo@marmaro.de>
 
 if [ $# -eq 0 ] ; then
-	echo "usage: config-transition [-v] CONFIGFILE..." >&2
+	echo "usage: config-transition CONFIGFILE..." >&2
 	exit 1
 fi
 
@@ -93,6 +92,10 @@
 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. \
+"
+
 # get files
 
 # already covered by the get.* and online_gets.* options in the conf
@@ -126,26 +129,17 @@
 		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,'"
-		if (verbose) {
-			print "\t>>>> " \$0 " <<<<"
-			print a[3] | cmd
-			close(cmd)
-			print "\t" a[2]
-			print ""
-		}
+		print "\t>>>> " \$0 " <<<<"
+		print a[3] | cmd
+		close(cmd)
+		print "\t" a[2]
+		print ""
 	}
 }
 			
 !
 
 
-verbose=0
-if [ X"$1" = X"-v" ] ; then
-	verbose=1
-	shift
-fi
-
 for i do
-	awk -f "$awkscript" "verbose=$verbose" "$i"
+	awk -f "$awkscript" "$i"
 done
-
--- a/docs/simple-relay-setup	Sun Apr 24 19:14:38 2011 +0200
+++ b/docs/simple-relay-setup	Sun Apr 24 19:37:56 2011 +0200
@@ -34,8 +34,6 @@
 
 Addionally you need to create the route config file like:
 
-    protocol = smtp
-
     # where to relay to; the address and port of the smart host
     mail_host = "mail.gmx.net:25"
     # use a wrapper to enable encryption
--- a/examples/openssl.route	Sun Apr 24 19:14:38 2011 +0200
+++ b/examples/openssl.route	Sun Apr 24 19:37:56 2011 +0200
@@ -2,8 +2,6 @@
 # by Philipp Berndt
 
 
-protocol = "smtp"
-
 # encryption is done by communicating through openssl
 
 # Today usually STARTTLS (RFC-3207) is used:
--- a/man/masqmail.route.5	Sun Apr 24 19:14:38 2011 +0200
+++ b/man/masqmail.route.5	Sun Apr 24 19:37:56 2011 +0200
@@ -9,15 +9,13 @@
 This man page describes the syntax of the route configuration files of \fBmasqmail (8)\fR.
 Their usual locations are in \fI/etc/masqmail/\fR.
 
-.SH OPTIONS
-
-.TP
-\fBprotocol\fR = \fIstring\fR
+Mail will be sent with the SMTP protocol to its destination, unless
+`pipe' is given.
+In this case the message will be piped to the given program.
+See option `pipe' below.
 
-\fIstring\fR can be one of `smtp' or `pipe', default is `smtp'.
-If set to `smtp', mail will be sent with the SMTP protocol to its destination.
-If set to `pipe', you also have to set `pipe' to a command, the message will then be piped to a program.
-See option `pipe' below.
+
+.SH OPTIONS
 
 .TP
 \fBmail_host\fR = \fIstring\fR
@@ -305,7 +303,6 @@
 .TP
 \fBpipe\fR = \fIcommand\fR
 
-If set, and protocol is set to `pipe',
 \fIcommand\fR will be called and the message will be piped to its stdin.
 Purpose is to use gateways to uucp, fax, sms or whatever else.
 
@@ -315,15 +312,15 @@
 .TP
 \fBpipe_fromline = \fIboolean\fR
 
-If this is set, and protocol is set to `pipe',
-a from line will be prepended to the output stream whenever a pipe command is called.
+Only if `pipe' is used.
+A from line will be prepended to the output stream whenever a pipe command is called.
 Default is false.
 
 .TP
 \fBpipe_fromhack = \fIboolean\fR
 
-If this is set, and protocol is set to `pipe',
-each line beginning with `From ' is replaced with `>From ' whenever a pipe command is called.
+Only if `pipe' is used.
+Each line beginning with `From ' is replaced with `>From ' whenever a pipe command is called.
 You probably want this if you have set \fBpipe_fromline\fR above.
 Default is false.
 
--- a/src/conf.c	Sun Apr 24 19:14:38 2011 +0200
+++ b/src/conf.c	Sun Apr 24 19:37:56 2011 +0200
@@ -620,7 +620,6 @@
 	route->filename = g_strdup(filename);
 	route->name = g_strdup(filename);  /* quick hack */
 
-	route->protocol = g_strdup("smtp");
 	route->expand_h_sender_address = TRUE;
 
 	route->is_local_net = is_local_net;
@@ -635,9 +634,7 @@
 
 	gchar lval[256], rval[2048];
 	while (read_statement(in, lval, 256, rval, 2048)) {
-		if (strcmp(lval, "protocol") == 0)
-			route->protocol = g_strdup(rval);
-		else if (strcmp(lval, "mail_host") == 0)
+		if (strcmp(lval, "mail_host") == 0)
 			route->mail_host = parse_interface(rval, 25);
 		else if (strcmp(lval, "helo_name") == 0)
 			route->helo_name = g_strdup(rval);
@@ -803,8 +800,6 @@
 {
 	if (r->filename)
 		g_free(r->filename);
-	if (r->protocol)
-		g_free(r->protocol);
 	if (r->mail_host) {
 		g_free(r->mail_host->address);
 		g_free(r->mail_host);
@@ -890,7 +885,6 @@
 		return NULL;
 	}
 	memset(route, 0, sizeof(connect_route));
-	route->protocol = g_strdup("smtp");
 	route->is_local_net = TRUE;
 	route->name = g_strdup("default local_net_route");
 	route->expand_h_sender_address = TRUE;
--- a/src/deliver.c	Sun Apr 24 19:14:38 2011 +0200
+++ b/src/deliver.c	Sun Apr 24 19:37:56 2011 +0200
@@ -268,11 +268,6 @@
 
 	DEBUG(5) debugf("deliver_msglist_host_pipe entered\n");
 
-	if (route->pipe == NULL) {
-		logwrite(LOG_ALERT, "no pipe command given for route (protocol is pipe!)\n");
-		return FALSE;
-	}
-
 	foreach(msgout_list, msgout_node) {
 		msg_out *msgout = (msg_out *) (msgout_node->data);
 		gboolean flag, ok_fail = FALSE;
@@ -475,11 +470,12 @@
 gboolean
 deliver_msglist_host(connect_route * route, GList * msgout_list, gchar * host, GList * res_list)
 {
-	DEBUG(5) debugf("protocol = %s\n", route->protocol);
 
-	if (strcmp(route->protocol, "pipe") == 0) {
+	if (route->pipe) {
+		DEBUG(5) debugf("with pipe\n");
 		return deliver_msglist_host_pipe(route, msgout_list, host, res_list);
 	} else {
+		DEBUG(5) debugf("with smtp\n");
 		return deliver_msglist_host_smtp(route, msgout_list, host, res_list);
 	}
 }
--- a/src/masqmail.h	Sun Apr 24 19:14:38 2011 +0200
+++ b/src/masqmail.h	Sun Apr 24 19:37:56 2011 +0200
@@ -81,8 +81,6 @@
 	gchar *name;
 	gchar *filename;
 
-	gchar *protocol;
-
 	gboolean is_local_net;
 	gboolean last_route;