[Exim] [PATCH] new option: smtp_accept_max_nonmail_hosts

Pàgina inicial
Delete this message
Reply to this message
Autor: Sheldon Hearn
Data:  
A: exim-users
Assumpte: [Exim] [PATCH] new option: smtp_accept_max_nonmail_hosts
Hi folks,

If your Exim installation serves as a smart relay for particularly
stupid clients, (like the version of Crapromedia's CFMail I have
to live with), you may have found the recent inclusion of the
smtp_accept_max_nonmail option awkward.

I like the idea, but don't like its global application.

If you feel the same way, consider using the following patch, which adds
a new host list option smtp_accept_max_nonmail_hosts to the main
configuration section:

| smtp_accept_max_nonmail_hosts
| (default: *)

|
| Specifies the hosts from which nonmail commands should be counted
| against the limit specified by smtp_accept_max_nonmail.


Note that the default value of the new option is intended to preserve
backward compatibility.

In our environment, we use:

hostlist relay_hosts = 127.0.0.1 : 10.0.0.0/24 : ...
...
smtp_accept_max_nonmail_hosts = !+relay_hosts : *

In other words, any host that we trust enough to relay is trusted enough
to get funky with non-mail commands.

Ciao,
Sheldon.

------------------
diff -udrN src.orig/globals.c src/globals.c
--- src.orig/globals.c    Tue Mar  4 14:31:11 2003
+++ src/globals.c    Tue Mar  4 14:33:11 2003
@@ -782,6 +782,7 @@
 BOOL    smtp_accept_keepalive  = TRUE;
 int     smtp_accept_max        = 20;
 int     smtp_accept_max_nonmail= 10;
+uschar *smtp_accept_max_nonmail_hosts = US"*";
 int     smtp_accept_max_per_connection = 1000;
 uschar *smtp_accept_max_per_host = NULL;
 int     smtp_accept_queue      = 0;
diff -udrN src.orig/globals.h src/globals.h
--- src.orig/globals.h    Tue Mar  4 14:31:11 2003
+++ src/globals.h    Tue Mar  4 14:34:46 2003
@@ -461,6 +461,7 @@
 extern BOOL    smtp_accept_keepalive;  /* Set keepalive on incoming */
 extern int     smtp_accept_max;        /* Max SMTP connections */
 extern int     smtp_accept_max_nonmail;/* Max non-mail commands in one con */
+extern uschar *smtp_accept_max_nonmail_hosts; /* Limit non-mail cmds from these hosts */
 extern int     smtp_accept_max_per_connection; /* Max msgs per connection */
 extern uschar *smtp_accept_max_per_host; /* Max SMTP cons from one IP addr */
 extern int     smtp_accept_queue;      /* Queue after so many connections */
diff -udrN src.orig/readconf.c src/readconf.c
--- src.orig/readconf.c    Tue Mar  4 14:31:11 2003
+++ src/readconf.c    Tue Mar  4 14:35:27 2003
@@ -177,6 +177,7 @@
   { "smtp_accept_keepalive",    opt_bool,        &smtp_accept_keepalive },
   { "smtp_accept_max",          opt_int,         &smtp_accept_max },
   { "smtp_accept_max_nonmail",  opt_int,         &smtp_accept_max_nonmail },
+  { "smtp_accept_max_nonmail_hosts", opt_stringptr, &smtp_accept_max_nonmail_hosts },
   { "smtp_accept_max_per_connection", opt_int,   &smtp_accept_max_per_connection },
   { "smtp_accept_max_per_host", opt_stringptr,   &smtp_accept_max_per_host },
   { "smtp_accept_queue",        opt_int,         &smtp_accept_queue },
diff -udrN src.orig/smtp_in.c src/smtp_in.c
--- src.orig/smtp_in.c    Tue Mar  4 14:31:11 2003
+++ src/smtp_in.c    Tue Mar  4 14:31:15 2003
@@ -459,7 +459,8 @@


     if (!p->is_mail_cmd)
       {
-      if (++nonmail_command_count > smtp_accept_max_nonmail)
+      if (++nonmail_command_count > smtp_accept_max_nonmail &&
+      verify_check_host(&smtp_accept_max_nonmail_hosts) == OK)
       return TOO_MANY_NONMAIL_CMD;
       }