changeset 11867:8424d5efa6ad

auth: Fixed a crash on cancelled userdb iteration.
author Timo Sirainen <tss@iki.fi>
date Tue, 20 Jul 2010 15:18:16 +0100
parents 5179e8f41cf4
children d8af22b91beb
files src/auth/userdb-blocking.c
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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;
 }