Skip to content

Commit

Permalink
auth: Fix LDAP user iteration to not access already freed memory
Browse files Browse the repository at this point in the history
db_ldap_request_free() was called on already freed request. Changed to use
auth_request's pool to fix this, since the request is correctly referenced.
  • Loading branch information
sirainen authored and cmouse committed Jun 27, 2018
1 parent 0aeddaf commit 90bd960
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/auth/userdb-ldap.c
Expand Up @@ -208,7 +208,7 @@ userdb_ldap_iterate_init(struct auth_request *auth_request,
const char *error;
string_t *str;

ctx = i_new(struct ldap_userdb_iterate_context, 1);
ctx = p_new(auth_request->pool, struct ldap_userdb_iterate_context, 1);
ctx->ctx.auth_request = auth_request;
ctx->ctx.callback = callback;
ctx->ctx.context = context;
Expand Down Expand Up @@ -268,7 +268,6 @@ static int userdb_ldap_iterate_deinit(struct userdb_iterate_context *_ctx)

db_ldap_enable_input(ctx->conn, TRUE);
auth_request_unref(&ctx->request.request.request.auth_request);
i_free(ctx);
return ret;
}

Expand Down

0 comments on commit 90bd960

Please sign in to comment.