dovecot-2.0: doveconf: Renamed lip/rip filters to local/remote, ...
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/c147a2653f9c
changeset: 11510:c147a2653f9c
user: Timo Sirainen <tss at iki.fi>
date: Wed Jun 09 18:32:47 2010 +0100
description:
doveconf: Renamed lip/rip filters to local/remote, which also support DNS lookups now.
diffstat:
src/config/config-parser.c | 4 ++--
src/config/config-parser.h | 2 ++
src/config/doveconf.c | 38 ++++++++++++++++++++++++--------------
3 files changed, 28 insertions(+), 16 deletions(-)
diffs (74 lines):
diff -r cc6ebfa394d3 -r c147a2653f9c src/config/config-parser.c
--- a/src/config/config-parser.c Wed Jun 09 18:29:55 2010 +0100
+++ b/src/config/config-parser.c Wed Jun 09 18:32:47 2010 +0100
@@ -183,8 +183,8 @@
return NULL;
}
-static int config_parse_net(const char *value, struct ip_addr *ip_r,
- unsigned int *bits_r, const char **error_r)
+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;
diff -r cc6ebfa394d3 -r c147a2653f9c src/config/config-parser.h
--- a/src/config/config-parser.h Wed Jun 09 18:29:55 2010 +0100
+++ b/src/config/config-parser.h Wed Jun 09 18:32:47 2010 +0100
@@ -14,6 +14,8 @@
extern struct config_filter_context *config_filter;
extern struct module *modules;
+int config_parse_net(const char *value, struct ip_addr *ip_r,
+ unsigned int *bits_r, const char **error_r);
int config_parse_file(const char *path, bool expand_values, const char *module,
const char **error_r);
diff -r cc6ebfa394d3 -r c147a2653f9c src/config/doveconf.c
--- a/src/config/doveconf.c Wed Jun 09 18:29:55 2010 +0100
+++ b/src/config/doveconf.c Wed Jun 09 18:32:47 2010 +0100
@@ -460,20 +460,30 @@
static void filter_parse_arg(struct config_filter *filter, const char *arg)
{
- if (strncmp(arg, "service=", 8) == 0)
- filter->service = arg + 8;
- else if (strncmp(arg, "protocol=", 9) == 0)
- filter->service = arg + 9;
- else if (strncmp(arg, "lname=", 6) == 0)
- filter->local_name = arg + 6;
- else if (strncmp(arg, "lip=", 4) == 0) {
- if (net_parse_range(arg + 4, &filter->local_net,
- &filter->local_bits) < 0)
- i_fatal("lip: Invalid network mask");
- } else if (strncmp(arg, "rip=", 4) == 0) {
- if (net_parse_range(arg + 4, &filter->remote_net,
- &filter->remote_bits) < 0)
- i_fatal("rip: Invalid network mask");
+ const char *key, *value, *error;
+
+ value = strchr(arg, '=');
+ if (value != NULL)
+ key = t_strdup_until(arg, value++);
+ else {
+ key = arg;
+ value = "";
+ }
+
+ if (strcmp(key, "service") == 0)
+ filter->service = value;
+ else if (strcmp(key, "protocol") == 0)
+ filter->service = value;
+ else if (strcmp(key, "lname") == 0)
+ filter->local_name = value;
+ else if (strcmp(key, "local") == 0) {
+ if (config_parse_net(value, &filter->local_net,
+ &filter->local_bits, &error) < 0)
+ i_fatal("local filter: %s", error);
+ } else if (strcmp(key, "remote") == 0) {
+ if (config_parse_net(value, &filter->remote_net,
+ &filter->remote_bits, &error) < 0)
+ i_fatal("remote filter: %s", error);
} else {
i_fatal("Unknown filter argument: %s", arg);
}
More information about the dovecot-cvs
mailing list