dovecot-1.2: Don't apply mail_max_userip_connections limit to ma...

dovecot at dovecot.org dovecot at dovecot.org
Thu Aug 21 02:19:15 EEST 2008


details:   http://hg.dovecot.org/dovecot-1.2/rev/8f0111854933
changeset: 8098:8f0111854933
user:      Timo Sirainen <tss at iki.fi>
date:      Thu Aug 21 02:19:07 2008 +0300
description:
Don't apply mail_max_userip_connections limit to master user logins.

diffstat:

1 file changed, 21 insertions(+), 14 deletions(-)
src/master/mail-process.c |   35 +++++++++++++++++++++--------------

diffs (65 lines):

diff -r 4d6cc7bb3426 -r 8f0111854933 src/master/mail-process.c
--- 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 @@ create_mail_process(enum process_type pr
 {
 	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 @@ create_mail_process(enum process_type pr
 		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,13 +572,30 @@ create_mail_process(enum process_type pr
 				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) {


More information about the dovecot-cvs mailing list