dovecot-2.0: auth: Fixed a crash on cancelled userdb iteration.

dovecot at dovecot.org dovecot at dovecot.org
Tue Jul 20 17:19:08 EEST 2010


details:   http://hg.dovecot.org/dovecot-2.0/rev/8424d5efa6ad
changeset: 11867:8424d5efa6ad
user:      Timo Sirainen <tss at iki.fi>
date:      Tue Jul 20 15:18:16 2010 +0100
description:
auth: Fixed a crash on cancelled userdb iteration.

diffstat:

 src/auth/userdb-blocking.c |  6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diffs (30 lines):

diff -r 5179e8f41cf4 -r 8424d5efa6ad src/auth/userdb-blocking.c
--- a/src/auth/userdb-blocking.c	Tue Jul 20 15:02:02 2010 +0100
+++ b/src/auth/userdb-blocking.c	Tue Jul 20 15:18:16 2010 +0100
@@ -13,6 +13,7 @@
 	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 @@
 
 	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 ret = ctx->ctx.failed ? -1 : 0;
 
 	*_ctx = NULL;
+
+	ctx->destroyed = TRUE;
 	pool_unref(&ctx->pool);
 	return ret;
 }


More information about the dovecot-cvs mailing list