dovecot-2.0: doveconf: Show local, remote name/bits {} blocks wi...

dovecot at dovecot.org dovecot at dovecot.org
Wed Jun 9 20:32:52 EEST 2010


details:   http://hg.dovecot.org/dovecot-2.0/rev/cc6ebfa394d3
changeset: 11509:cc6ebfa394d3
user:      Timo Sirainen <tss at iki.fi>
date:      Wed Jun 09 18:29:55 2010 +0100
description:
doveconf: Show local, remote name/bits {} blocks with the /bits part.

diffstat:

 src/config/config-parser.c |  17 ++++++++---------
 1 files changed, 8 insertions(+), 9 deletions(-)

diffs (62 lines):

diff -r 6d32cf98b5f3 -r cc6ebfa394d3 src/config/config-parser.c
--- a/src/config/config-parser.c	Wed Jun 09 18:02:46 2010 +0100
+++ b/src/config/config-parser.c	Wed Jun 09 18:29:55 2010 +0100
@@ -183,10 +183,8 @@
 	return NULL;
 }
 
-static int
-config_parse_net(struct config_parser_context *ctx, const char *value,
-		 const char **host_r, struct ip_addr *ip_r,
-		 unsigned int *bits_r, const char **error_r)
+static int config_parse_net(const char *value, struct ip_addr *ip_r,
+			    unsigned int *bits_r, const char **error_r)
 {
 	struct ip_addr *ips;
 	const char *p;
@@ -208,7 +206,6 @@
 					   value, net_gethosterror(ret));
 		return -1;
 	}
-	*host_r = p_strdup(ctx->pool, value);
 	*ip_r = ips[0];
 
 	max_bits = IPADDR_IS_V4(&ips[0]) ? 32 : 128;
@@ -240,8 +237,7 @@
 			ctx->error = "local must not be under protocol";
 		else if (parent->local_name != NULL)
 			ctx->error = "local must not be under local_name";
-		else if (config_parse_net(ctx, value, &filter->local_host,
-					  &filter->local_net,
+		else if (config_parse_net(value, &filter->local_net,
 					  &filter->local_bits, &error) < 0)
 			ctx->error = p_strdup(ctx->pool, error);
 		else if (parent->local_bits > filter->local_bits ||
@@ -250,6 +246,8 @@
 					     &parent->local_net,
 					     parent->local_bits)))
 			ctx->error = "local not a subset of parent local";
+		else
+			filter->local_host = p_strdup(ctx->pool, value);
 	} else if (strcmp(key, "local_name") == 0) {
 		if (parent->remote_bits > 0)
 			ctx->error = "local_name must not be under remote";
@@ -260,8 +258,7 @@
 	} else if (strcmp(key, "remote") == 0) {
 		if (parent->service != NULL)
 			ctx->error = "remote must not be under protocol";
-		else if (config_parse_net(ctx, value, &filter->remote_host,
-					  &filter->remote_net,
+		else if (config_parse_net(value, &filter->remote_net,
 					  &filter->remote_bits, &error) < 0)
 			ctx->error = p_strdup(ctx->pool, error);
 		else if (parent->remote_bits > filter->remote_bits ||
@@ -270,6 +267,8 @@
 					     &parent->remote_net,
 					     parent->remote_bits)))
 			ctx->error = "remote not a subset of parent remote";
+		else
+			filter->remote_host = p_strdup(ctx->pool, value);
 	} else {
 		return FALSE;
 	}


More information about the dovecot-cvs mailing list