Mercurial > dovecot > original-hg > dovecot-1.2
changeset 8098:8f0111854933 HEAD
Don't apply mail_max_userip_connections limit to master user logins.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Thu, 21 Aug 2008 02:19:07 +0300 |
parents | 4d6cc7bb3426 |
children | 060165bdb0b0 |
files | src/master/mail-process.c |
diffstat | 1 files changed, 21 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/src/master/mail-process.c Thu Aug 14 03:10:34 2008 -0400 +++ b/src/master/mail-process.c Thu Aug 21 02:19:07 2008 +0300 @@ -528,7 +528,7 @@ { const struct var_expand_table *var_expand_table; const char *p, *addr, *mail, *chroot_dir, *home_dir, *full_home_dir; - const char *system_user; + const char *system_user, *master_user; struct mail_process_group *process_group; char title[1024]; struct log_io *log; @@ -549,18 +549,8 @@ return MASTER_LOGIN_STATUS_INTERNAL_ERROR; } - /* check process limit for this user */ - process_group = dump_capability ? NULL : - mail_process_group_lookup(process_type, user, - &request->remote_ip); - process_count = process_group == NULL ? 0 : - array_count(&process_group->processes); - if (process_count >= set->mail_max_userip_connections && - set->mail_max_userip_connections != 0) - return MASTER_LOGIN_STATUS_MAX_CONNECTIONS; - t_array_init(&extra_args, 16); - mail = home_dir = chroot_dir = system_user = ""; + mail = home_dir = chroot_dir = system_user = ""; master_user = NULL; uid = (uid_t)-1; gid = (gid_t)-1; nice_value = 0; home_given = FALSE; for (; *args != NULL; args++) { @@ -582,14 +572,31 @@ return MASTER_LOGIN_STATUS_INTERNAL_ERROR; } uid = (uid_t)strtoul(*args + 4, NULL, 10); - } else if (strncmp(*args, "gid=", 4) == 0) + } else if (strncmp(*args, "gid=", 4) == 0) { gid = (gid_t)strtoul(*args + 4, NULL, 10); - else { + } else if (strncmp(*args, "master_user=", 12) == 0) { + const char *arg = *args; + + master_user = arg + 12; + array_append(&extra_args, &arg, 1); + } else { const char *arg = *args; array_append(&extra_args, &arg, 1); } } + /* check process limit for this user, but not if this is a master + user login. */ + process_group = dump_capability ? NULL : + mail_process_group_lookup(process_type, user, + &request->remote_ip); + process_count = process_group == NULL ? 0 : + array_count(&process_group->processes); + if (process_count >= set->mail_max_userip_connections && + set->mail_max_userip_connections != 0 && + master_user == NULL) + return MASTER_LOGIN_STATUS_MAX_CONNECTIONS; + /* if uid/gid wasn't returned, use the defaults */ if (uid == (uid_t)-1) { uid = set->mail_uid_t;