/* Copyright (c) 2010-2018 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "array.h"
#include "bsearch-insert-pos.h"
#include "crc32.h"
#include "md5.h"
#include "user-directory.h"
#include "mail-host.h"
struct mail_host_list {
unsigned int hosts_hash;
unsigned int user_expire_secs;
bool vhosts_unsorted;
bool have_vhosts;
};
static int
{
}
static int
{
return -1;
return 1;
/* hash collision. not ideal, but we'll need to keep the order
consistent across directors so compare the IPs next. */
}
static int
{
return 1;
return -1;
else
return 0;
}
{
unsigned int i, j;
return;
for (i = 0; i < host->vhost_count; i++) {
}
}
static void
{
/* rebuild vhosts */
}
static void
{
}
/* recalculate the hosts_hash */
list->hosts_hash = 0;
}
}
struct mail_tag *
{
return *tagp;
}
return NULL;
}
static struct mail_tag *
{
}
return tag;
}
{
}
struct mail_host *
const char *tag_name)
{
return host;
}
struct mail_host *
{
return host;
}
static int
const char *tag_name)
{
unsigned int i, ips_count;
return 0;
}
return -1;
}
for (i = 0; i < ips_count; i++)
return 0;
}
static int
const char *tag_name)
{
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 {
max_bits = 128;
last_bits = 16;
}
/* 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)
tag = "";
else {
tag = p;
}
if (p != NULL) {
/* see if this is ip1-ip2 range */
host2 = p + 1;
tag) < 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;
}
{
}
{
}
{
i_info("%sHost %s changed %s "
"(vhost_count=%u last_updown_change=%ld)",
}
}
const char *log_prefix)
{
i_info("%sHost %s vhost count changed from %u to %u",
}
{
}
{
unsigned int i, count;
for (i = 0; i < count; i++) {
break;
}
}
}
struct mail_host *
{
if (list->vhosts_unsorted)
return *hostp;
}
return NULL;
}
static struct mail_host *
{
if (count == 0)
return NULL;
idx = 0;
}
}
struct mail_host *
const char *tag_name)
{
if (list->vhosts_unsorted)
return NULL;
}
{
}
{
if (list->vhosts_unsorted)
/* don't retun 0 as hash, since we're using it as "doesn't exist" in
some places. */
}
{
if (list->vhosts_unsorted)
return list->have_vhosts;
}
{
if (list->vhosts_unsorted)
}
{
if (list->vhosts_unsorted)
return TRUE;
}
return FALSE;
}
{
}
struct mail_host_list *
{
return list;
}
{
}
static struct mail_host *
{
return dest;
}
{
}
return dest;
}
{
}