]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lmtp: Fix lmtp_user_concurrency_limit when userdb changes the username
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Tue, 21 Feb 2017 11:48:36 +0000 (13:48 +0200)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Tue, 21 Feb 2017 11:48:36 +0000 (13:48 +0200)
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.

src/lmtp/commands.c

index e8862e59453311e14f1463c80c2427e4b4a809ff..2d900c89da95535cb2eda9d2d78fda19b8cea2a6 100644 (file)
@@ -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);