From: Stephan Bosch Date: Wed, 1 Nov 2023 23:06:06 +0000 (+0100) Subject: auth: auth-request - Fix success response data without policy lookup X-Git-Tag: 2.4.0~2416 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=86be25e6d6c976b35b2dcc01f50b53105f263ae2;p=thirdparty%2Fdovecot%2Fcore.git auth: auth-request - Fix success response data without policy lookup In that case the success data was discarded and not passed to the client. --- diff --git a/src/auth/auth-request.c b/src/auth/auth-request.c index a7db045f8a..3c563afa03 100644 --- a/src/auth/auth-request.c +++ b/src/auth/auth-request.c @@ -185,23 +185,20 @@ void auth_request_success(struct auth_request *request, if (request->fields.userdb_reply != NULL) auth_fields_snapshot(request->fields.userdb_reply); + struct auth_policy_check_ctx *ctx; + + ctx = p_new(request->pool, struct auth_policy_check_ctx, 1); + ctx->request = request; + ctx->success_data = buffer_create_dynamic(request->pool, data_size); + buffer_append(ctx->success_data, data, data_size); + ctx->type = AUTH_POLICY_CHECK_TYPE_SUCCESS; + if (!request->set->policy_check_after_auth) { - struct auth_policy_check_ctx *ctx = - p_new(request->pool, struct auth_policy_check_ctx, 1); - ctx->success_data = buffer_create_dynamic(request->pool, 1); - ctx->request = request; - ctx->type = AUTH_POLICY_CHECK_TYPE_SUCCESS; auth_request_policy_check_callback(0, ctx); return; } /* perform second policy lookup here */ - struct auth_policy_check_ctx *ctx = - p_new(request->pool, struct auth_policy_check_ctx, 1); - ctx->request = request; - ctx->success_data = buffer_create_dynamic(request->pool, data_size); - buffer_append(ctx->success_data, data, data_size); - ctx->type = AUTH_POLICY_CHECK_TYPE_SUCCESS; auth_policy_check(request, request->mech_password, auth_request_policy_check_callback, ctx); }