Mercurial > dovecot > core-2.2
changeset 20116:bc2237152abd
lmtp: Connect to anvil earlier while still running as root
This was a problem only with lmtp_rcpt_check_quota=yes.
author | Timo Sirainen <timo.sirainen@dovecot.fi> |
---|---|
date | Tue, 26 Apr 2016 18:51:55 +0300 |
parents | 939cd2e189f3 |
children | f212d5a84776 |
files | src/lmtp/commands.c |
diffstat | 1 files changed, 13 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lmtp/commands.c Thu Apr 28 22:33:14 2016 +0300 +++ b/src/lmtp/commands.c Tue Apr 26 18:51:55 2016 +0300 @@ -179,6 +179,14 @@ return p_strdup(client->state_pool, str_c(str)); } +static void lmtp_anvil_init(void) +{ + if (anvil == NULL) { + const char *path = t_strdup_printf("%s/anvil", base_dir); + anvil = anvil_client_init(path, NULL, 0); + } +} + int cmd_mail(struct client *client, const char *args) { const char *addr, *const *argv; @@ -212,6 +220,11 @@ client_send_line(client, "250 2.1.0 OK"); client_state_set(client, "MAIL FROM", client->state.mail_from); + if (client->lmtp_set->lmtp_user_concurrency_limit > 0) { + /* connect to anvil before dropping privileges */ + lmtp_anvil_init(); + } + client->state.mail_from_timeval = ioloop_timeval; return 0; } @@ -604,14 +617,6 @@ } } -static void lmtp_anvil_init(void) -{ - if (anvil == NULL) { - const char *path = t_strdup_printf("%s/anvil", base_dir); - anvil = anvil_client_init(path, NULL, 0); - } -} - int cmd_rcpt(struct client *client, const char *args) { struct mail_recipient *rcpt; @@ -720,7 +725,6 @@ const char *query = t_strconcat("LOOKUP\t", master_service_get_name(master_service), "/", str_tabescape(username), NULL); - lmtp_anvil_init(); client->state.anvil_queries++; rcpt->anvil_query = anvil_client_query(anvil, query, rcpt_anvil_lookup_callback, rcpt);