dovecot-2.0: master: Allow inet_listener address to specify mult...
dovecot at dovecot.org
dovecot at dovecot.org
Thu Aug 13 21:23:05 EEST 2009
details: http://hg.dovecot.org/dovecot-2.0/rev/252bb3d23fb9
changeset: 9783:252bb3d23fb9
user: Timo Sirainen <tss at iki.fi>
date: Thu Aug 13 14:17:57 2009 -0400
description:
master: Allow inet_listener address to specify multiple addresses.
diffstat:
2 files changed, 30 insertions(+), 33 deletions(-)
dovecot-master-example.conf | 28 ++++------------------------
src/master/service.c | 35 ++++++++++++++++++++++++++---------
diffs (119 lines):
diff -r e4235adb3044 -r 252bb3d23fb9 dovecot-master-example.conf
--- a/dovecot-master-example.conf Thu Aug 13 13:31:27 2009 -0400
+++ b/dovecot-master-example.conf Thu Aug 13 14:17:57 2009 -0400
@@ -63,22 +63,12 @@ service imap-login {
type = auth-source
executable = imap-login
- # IPv4
inet_listener {
+ address = *, ::
port = 143
}
inet_listener {
- port = 993
- ssl = yes
- }
-
- # IPv6
- inet_listener {
- address = ::
- port = 143
- }
- inet_listener {
- address = ::
+ address = *, ::
port = 993
ssl = yes
}
@@ -98,22 +88,12 @@ service pop3-login {
type = auth-source
executable = pop3-login
- # IPv4
inet_listener {
+ address = *, ::
port = 110
}
inet_listener {
- port = 995
- ssl = yes
- }
-
- # IPv6
- inet_listener {
- address = ::
- port = 110
- }
- inet_listener {
- address = ::
+ address = *, ::
port = 995
ssl = yes
}
diff -r e4235adb3044 -r 252bb3d23fb9 src/master/service.c
--- a/src/master/service.c Thu Aug 13 13:31:27 2009 -0400
+++ b/src/master/service.c Thu Aug 13 14:17:57 2009 -0400
@@ -88,9 +88,9 @@ resolve_ip(const char *address, struct i
}
static struct service_listener *
-service_create_inet_listener(struct service *service,
- const struct inet_listener_settings *set,
- const char **error_r)
+service_create_one_inet_listener(struct service *service,
+ const struct inet_listener_settings *set,
+ const char *address, const char **error_r)
{
struct service_listener *l;
@@ -100,7 +100,7 @@ service_create_inet_listener(struct serv
l->fd = -1;
l->set.inetset.set = set;
- if (resolve_ip(set->address, &l->set.inetset.ip, error_r) < 0)
+ if (resolve_ip(address, &l->set.inetset.ip, error_r) < 0)
return NULL;
if (set->port == 0) {
@@ -113,6 +113,25 @@ service_create_inet_listener(struct serv
}
return l;
+}
+
+static int
+service_create_inet_listeners(struct service *service,
+ const struct inet_listener_settings *set,
+ const char **error_r)
+{
+ static struct service_listener *l;
+ const char *const *tmp;
+
+ tmp = t_strsplit_spaces(set->address, ", ");
+ for (; *tmp != NULL; tmp++) {
+ l = service_create_one_inet_listener(service, set, *tmp,
+ error_r);
+ if (l == NULL)
+ return -1;
+ array_append(&service->listeners, &l, 1);
+ }
+ return 0;
}
static struct service *
@@ -255,11 +274,9 @@ service_create(pool_t pool, const struct
array_append(&service->listeners, &l, 1);
}
for (i = 0; i < inet_count; i++) {
- l = service_create_inet_listener(service, inet_listeners[i],
- error_r);
- if (l == NULL)
- return NULL;
- array_append(&service->listeners, &l, 1);
+ if (service_create_inet_listeners(service, inet_listeners[i],
+ error_r) < 0)
+ return NULL;
}
return service;
More information about the dovecot-cvs
mailing list