[dovecot-cvs] dovecot/src/master main.c,1.96,1.97
tss at dovecot.org
tss at dovecot.org
Thu Dec 28 19:59:40 UTC 2006
Update of /var/lib/cvs/dovecot/src/master
In directory talvi:/tmp/cvs-serv6527
Modified Files:
main.c
Log Message:
If ssl_disable=yes, don't bother resolving ssl_listen. Also if listen or
ssl_listen resolving fails, log if it was listen or ssl_listen setting that
caused the error.
Index: main.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/master/main.c,v
retrieving revision 1.96
retrieving revision 1.97
diff -u -d -r1.96 -r1.97
--- main.c 28 Dec 2006 15:06:31 -0000 1.96
+++ main.c 28 Dec 2006 19:59:37 -0000 1.97
@@ -248,7 +248,8 @@
i_warning("waitpid() failed: %m");
}
-static void resolve_ip(const char *name, struct ip_addr *ip, unsigned int *port)
+static void resolve_ip(const char *set_name, const char *name,
+ struct ip_addr *ip, unsigned int *port)
{
struct ip_addr *ip_list;
const char *p;
@@ -264,16 +265,19 @@
if (name[0] == '[') {
/* IPv6 address */
p = strchr(name, ']');
- if (p == NULL)
- i_fatal("Missing ']' in address %s", name);
-
+ if (p == NULL) {
+ i_fatal("%s: Missing ']' in address %s",
+ set_name, name);
+ }
name = t_strdup_until(name+1, p);
p++;
if (*p == '\0')
p = NULL;
- else if (*p != ':')
- i_fatal("Invalid data after ']' in address %s", name);
+ else if (*p != ':') {
+ i_fatal("%s: Invalid data after ']' in address %s",
+ set_name, name);
+ }
} else {
p = strrchr(name, ':');
if (p != NULL)
@@ -281,8 +285,10 @@
}
if (p != NULL) {
- if (!is_numeric(p+1, '\0'))
- i_fatal("Invalid port in address %s", name);
+ if (!is_numeric(p+1, '\0')) {
+ i_fatal("%s: Invalid port in address %s",
+ set_name, name);
+ }
*port = atoi(p+1);
}
@@ -301,12 +307,12 @@
/* Return the first IP if there happens to be multiple. */
ret = net_gethostbyname(name, &ip_list, &ips_count);
if (ret != 0) {
- i_fatal("Can't resolve address %s: %s",
- name, net_gethosterror(ret));
+ i_fatal("%s: Can't resolve address %s: %s",
+ set_name, name, net_gethosterror(ret));
}
if (ips_count < 1)
- i_fatal("No IPs for address: %s", name);
+ i_fatal("%s: No IPs for address: %s", set_name, name);
*ip = ip_list[0];
}
@@ -359,8 +365,11 @@
#endif
/* resolve */
- resolve_ip(set->listen, &set->listen_ip, &set->listen_port);
- resolve_ip(set->ssl_listen, &set->ssl_listen_ip, &set->ssl_listen_port);
+ resolve_ip("listen", set->listen, &set->listen_ip, &set->listen_port);
+ if (!set->ssl_disable) {
+ resolve_ip("ssl_listen", set->ssl_listen, &set->ssl_listen_ip,
+ &set->ssl_listen_port);
+ }
/* if ssl_listen wasn't explicitly set in the config file,
use the non-ssl IP settings for the ssl listener, too. */
More information about the dovecot-cvs
mailing list