Skip to content

Commit

Permalink
director: Fix mail_hosts_dup() to duplicate tags correctly.
Browse files Browse the repository at this point in the history
The host->tag pointed to the old hosts list. Also the new hosts list's tags
array wasn't filled.

This fixes USER-LOOKUP to return host with default configuration, which fixes
doveadm director status <user> to not show "Initial config" as empty.
  • Loading branch information
sirainen committed Apr 3, 2017
1 parent 9ddb3f7 commit dbed1a0
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/director/mail-host.c
Expand Up @@ -558,12 +558,14 @@ void mail_hosts_deinit(struct mail_host_list **_list)
i_free(list);
}

static struct mail_host *mail_host_dup(const struct mail_host *src)
static struct mail_host *
mail_host_dup(struct mail_host_list *dest_list, const struct mail_host *src)
{
struct mail_host *dest;

dest = i_new(struct mail_host, 1);
*dest = *src;
dest->tag = mail_tag_get(dest_list, src->tag->name);
dest->hostname = i_strdup(src->hostname);
return dest;
}
Expand All @@ -576,7 +578,7 @@ struct mail_host_list *mail_hosts_dup(const struct mail_host_list *src)
dest = mail_hosts_init(src->user_expire_secs, src->consistent_hashing,
src->user_free_hook);
array_foreach(&src->hosts, hostp) {
dest_host = mail_host_dup(*hostp);
dest_host = mail_host_dup(dest, *hostp);
array_append(&dest->hosts, &dest_host, 1);
}
mail_hosts_sort(dest);
Expand Down

0 comments on commit dbed1a0

Please sign in to comment.