changeset 21882:476eab310305

director: Fix mail_hosts_dup() to duplicate tags correctly. 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.
author Timo Sirainen <timo.sirainen@dovecot.fi>
date Mon, 03 Apr 2017 12:40:51 +0300
parents f8a58f1375ce
children 45e5e6ea89ae
files src/director/mail-host.c
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/director/mail-host.c	Mon Apr 03 11:41:29 2017 +0300
+++ b/src/director/mail-host.c	Mon Apr 03 12:40:51 2017 +0300
@@ -558,12 +558,14 @@
 	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;
 }
@@ -576,7 +578,7 @@
 	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);