mail-host.c revision 5f5870385cff47efd2f58e7892f251cf13761528
/* Copyright (c) 2010-2012 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "array.h"
#include "mail-host.h"
#define VHOST_MULTIPLIER 100
struct mail_host_list {
bool hosts_unsorted;
};
static int
{
}
{
unsigned int i;
/* rebuild vhosts */
for (i = 0; i < (*hostp)->vhost_count; i++)
}
}
struct mail_host *
{
return host;
}
{
unsigned int i, ips_count;
return -1;
}
for (i = 0; i < ips_count; i++)
return 0;
}
static int
{
i_error("IP address family mismatch: %s vs %s",
return -1;
}
i_error("IP addresses reversed: %s-%s",
return -1;
}
if (IPADDR_IS_V4(&ip1)) {
max_bits = 32;
last_bits = 8;
} else {
#ifndef HAVE_IPV6
i_error("IPv6 not supported");
return -1;
#else
max_bits = 128;
last_bits = 16;
#endif
}
/* make sure initial bits match */
i_error("IP address range too large: %s-%s",
return -1;
}
}
for (j = last_bits; j < 32; j++) {
i_error("IP address range too large: %s-%s",
return -1;
}
}
/* create hosts from the final bits */
do {
i1++;
return 0;
}
const char *hosts_string)
{
int ret = 0;
T_BEGIN {
if (p != NULL) {
/* see if this is ip1-ip2 range */
host2 = p + 1;
ip2) < 0)
ret = -1;
continue;
}
}
ret = -1;
}
} T_END;
if (ret < 0)
i_error("No valid servers specified");
else
i_error("Empty server list");
ret = -1;
}
return ret;
}
{
}
{
unsigned int i, count;
for (i = 0; i < count; i++) {
break;
}
}
}
struct mail_host *
{
if (list->hosts_unsorted)
return *hostp;
}
return NULL;
}
struct mail_host *
{
unsigned int count;
if (list->hosts_unsorted)
if (count == 0)
return NULL;
}
{
if (list->hosts_unsorted)
}
struct mail_host_list *mail_hosts_init(void)
{
struct mail_host_list *list;
return list;
}
{
}
{
return dest;
}
{
struct mail_host_list *dest;
dest = mail_hosts_init();
}
return dest;
}