From: Timo Sirainen Date: Tue, 20 Jul 2010 14:18:16 +0000 (+0100) Subject: auth: Fixed a crash on cancelled userdb iteration. X-Git-Tag: 2.0.rc3~9 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=91e2dc36b9c0c91f0af716be81dc2aa6cbbed6c2;p=thirdparty%2Fdovecot%2Fcore.git auth: Fixed a crash on cancelled userdb iteration. --- diff --git a/src/auth/userdb-blocking.c b/src/auth/userdb-blocking.c index fd81179d7b..b5026bd956 100644 --- a/src/auth/userdb-blocking.c +++ b/src/auth/userdb-blocking.c @@ -13,6 +13,7 @@ struct blocking_userdb_iterate_context { pool_t pool; struct auth_worker_connection *conn; bool next; + bool destroyed; }; static bool user_callback(const char *reply, void *context) @@ -75,7 +76,8 @@ static bool iter_callback(const char *reply, void *context) if (strcmp(reply, "OK") != 0) ctx->ctx.failed = TRUE; - ctx->ctx.callback(NULL, ctx->ctx.context); + if (!ctx->destroyed) + ctx->ctx.callback(NULL, ctx->ctx.context); pool_unref(&pool); return TRUE; } @@ -120,6 +122,8 @@ int userdb_blocking_iter_deinit(struct userdb_iterate_context **_ctx) int ret = ctx->ctx.failed ? -1 : 0; *_ctx = NULL; + + ctx->destroyed = TRUE; pool_unref(&ctx->pool); return ret; }