From: PxPert Date: Wed, 8 Jun 2022 11:03:20 +0000 (+0200) Subject: auth: Set correct passdb entry in auth_worker_handle_passw X-Git-Tag: 2.4.0~2585 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3013356de329648b2871a341473b130c1af6fd87;p=thirdparty%2Fdovecot%2Fcore.git auth: Set correct passdb entry in auth_worker_handle_passw --- diff --git a/src/auth/auth-worker-server.c b/src/auth/auth-worker-server.c index d0c154345f..bd9abd85d9 100644 --- a/src/auth/auth-worker-server.c +++ b/src/auth/auth-worker-server.c @@ -301,6 +301,7 @@ auth_worker_handle_passw(struct auth_worker_command *cmd, { struct auth_worker_server *server = cmd->server; struct auth_request *request; + struct auth_passdb *passdb; string_t *str; const char *password; const char *crypted, *scheme, *error; @@ -327,6 +328,25 @@ auth_worker_handle_passw(struct auth_worker_command *cmd, request->mech_password = p_strdup(request->pool, password); + passdb = request->passdb; + while (passdb != NULL && passdb->passdb->id != passdb_id) + passdb = passdb->next; + + if (passdb == NULL) { + /* could be a masterdb */ + passdb = auth_request_get_auth(request)->masterdbs; + while (passdb != NULL && passdb->passdb->id != passdb_id) + passdb = passdb->next; + + if (passdb == NULL) { + *error_r = "BUG: PASSW had invalid passdb ID"; + auth_request_unref(&request); + return FALSE; + } + } + + request->passdb = passdb; + ret = auth_request_password_verify(request, password, crypted, scheme, "cache"); str = t_str_new(128);