Skip to content

Commit

Permalink
lmtp: Fix lmtp_user_concurrency_limit when userdb changes the username
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
sirainen committed Feb 21, 2017
1 parent 9be49ac commit 3d0de61
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/lmtp/commands.c
Expand Up @@ -741,9 +741,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);
Expand Down

0 comments on commit 3d0de61

Please sign in to comment.