From: Timo Sirainen Date: Tue, 21 Feb 2017 11:48:36 +0000 (+0200) Subject: lmtp: Fix lmtp_user_concurrency_limit when userdb changes the username X-Git-Tag: 2.3.0.rc1~2032 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d03980c62bca1d8501d67e5cf3b6f9904d166dd4;p=thirdparty%2Fdovecot%2Fcore.git lmtp: Fix lmtp_user_concurrency_limit when userdb changes the username Anvil LOOKUP was done with the original username, while CONNECT/DISCONNECT was done with the changed username. So LOOKUP always thought that there were zero concurrent sessions for the user. --- diff --git a/src/lmtp/commands.c b/src/lmtp/commands.c index e8862e5945..2d900c89da 100644 --- a/src/lmtp/commands.c +++ b/src/lmtp/commands.c @@ -751,9 +751,13 @@ int cmd_rcpt(struct client *client, const char *args) (void)cmd_rcpt_finish(client, rcpt); return 0; } else { + /* NOTE: username may change as the result of the userdb + lookup. Look up the new one via service_user. */ + const struct mail_storage_service_input *input = + mail_storage_service_user_get_input(rcpt->service_user); const char *query = t_strconcat("LOOKUP\t", master_service_get_name(master_service), - "/", str_tabescape(username), NULL); + "/", str_tabescape(input->username), NULL); io_remove(&client->io); rcpt->anvil_query = anvil_client_query(anvil, query, rcpt_anvil_lookup_callback, rcpt);