From: Timo Sirainen Date: Sat, 22 Oct 2016 19:45:48 +0000 (+0300) Subject: director: Fix crash handling director_flush_socket when user is freed. X-Git-Tag: 2.2.26~59 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=bdda7143ac287cb79effe682985f505df30f5bd7;p=thirdparty%2Fdovecot%2Fcore.git director: Fix crash handling director_flush_socket when user is freed. --- diff --git a/src/director/director.c b/src/director/director.c index 97367ea0b3..9f1999a7ca 100644 --- a/src/director/director.c +++ b/src/director/director.c @@ -703,6 +703,7 @@ void director_update_user_weak(struct director *dir, struct director_host *src, struct director_user_kill_finish_ctx { struct director *dir; unsigned int username_hash; + struct ip_addr host_ip; struct user *user; struct program_client *pclient; struct ostream *reply; @@ -726,14 +727,14 @@ director_flush_user_continue(int result, data = i_stream_read_next_line(is); i_error("%s: Failed to flush user hash %u in host %s: %s", ctx->socket_path, - user->username_hash, - net_ip2addr(&user->host->ip), + ctx->username_hash, + net_ip2addr(&ctx->host_ip), data == NULL ? "(no output to stdout)" : data); while((data = i_stream_read_next_line(is)) != NULL) { i_error("%s: Failed to flush user hash %u in host %s: %s", ctx->socket_path, - user->username_hash, - net_ip2addr(&user->host->ip), + ctx->username_hash, + net_ip2addr(&ctx->host_ip), data); } i_stream_unref(&is); @@ -763,6 +764,7 @@ director_flush_user(struct director *dir, struct user *user) struct director_user_kill_finish_ctx *ctx = i_new(struct director_user_kill_finish_ctx, 1); ctx->username_hash = user->username_hash; + ctx->host_ip = user->host->ip; ctx->dir = dir; string_t *s_sock = str_new(default_pool, 32);