]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
auth: Fixed a crash on cancelled userdb iteration.
authorTimo Sirainen <tss@iki.fi>
Tue, 20 Jul 2010 14:18:16 +0000 (15:18 +0100)
committerTimo Sirainen <tss@iki.fi>
Tue, 20 Jul 2010 14:18:16 +0000 (15:18 +0100)
src/auth/userdb-blocking.c

index fd81179d7ba11de38770ff85478e635202efe2be..b5026bd9568934e762c25388d1aa69b6e88dc976 100644 (file)
@@ -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;
 }