[Exim] smtp_accept_max_per_connection?

Αρχική Σελίδα
Delete this message
Reply to this message
Συντάκτης: Pete Naylor
Ημερομηνία:  
Προς: exim-users
Αντικείμενο: [Exim] smtp_accept_max_per_connection?

I've stumbled across a fairly strange requirement to limit the number of
messages per SMTP connection, and can't see a way to accomplish that with
the currently available options. This relates to a repeat abuser of mail
services where we're having difficulty stopping them from coming back with
a new account after each time we catch them (there's an auto-signup
process which I'm not in a position to fix and those people who could are
quite slow). There is smtp_accept_queue_per_connection, which is very
useful, but I think what I need is smtp_accept_max_per_connection. Is
anybody strongly against this idea? Philip, would you consider the
attached patch for the next release?

--
Pete Naylor
*** daemon.c    Sun Apr 30 16:12:37 2000
--- daemon.c.bak    Sun Apr 30 00:32:43 2000
***************
*** 243,249 ****
  if (pid == 0)
    {
    int i;
! /*  int message_count = 0; */
    int queue_only_reason = 0;
    BOOL local_queue_only;
    union sockaddr_46 interface_sockaddr;
--- 243,249 ----
  if (pid == 0)
    {
    int i;
!   int message_count = 0;
    int queue_only_reason = 0;
    BOOL local_queue_only;
    union sockaddr_46 interface_sockaddr;
*** exim.c    Sun Apr 30 16:12:58 2000
--- exim.c.bak    Sun Apr 30 00:44:32 2000
***************
*** 288,294 ****
  int  group_count;
  int  i;
  int  list_queue_option = 0;
! /* int  message_count = 0; */
  int  msg_action = 0;
  int  msg_action_arg = -1;
  int  namelen = (argv[0] == NULL)? 0 : (int)strlen(argv[0]);
--- 288,294 ----
  int  group_count;
  int  i;
  int  list_queue_option = 0;
! int  message_count = 0;
  int  msg_action = 0;
  int  msg_action_arg = -1;
  int  namelen = (argv[0] == NULL)? 0 : (int)strlen(argv[0]);
*** globals.c    Sun Apr 30 16:12:04 2000
--- globals.c.bak    Sun Apr 30 15:59:52 2000
***************
*** 400,406 ****
  char  *message_body_end       = NULL;
  int    message_body_size      = 0;
  int    message_body_visible   = 500;
- int    message_count          = 0;
  int    message_ended          = END_NOTSTARTED;
  char  *message_filter         = NULL;


--- 400,405 ----
***************
*** 631,637 ****
  int    smtp_accept_max_per_host = 0;
  int    smtp_accept_queue      = 0;
  int    smtp_accept_queue_per_connection = 10;
- int    smtp_accept_max_per_connection = 0;
  int    smtp_accept_reserve    = 0;
  char  *smtp_banner            = "${primary_hostname} ESMTP "
                              "Exim ${version_number} #${compile_number} "
--- 630,635 ----
*** globals.h    Sun Apr 30 16:11:39 2000
--- globals.h.bak    Sun Apr 30 00:44:55 2000
***************
*** 280,286 ****
  extern char  *message_body_end;       /* End of message body for filter */
  extern int    message_body_size;      /* Sic */
  extern int    message_body_visible;   /* Amount visible in message_body */
- extern int    message_count;          /* Messages accepted in session */
  extern int    message_ended;          /* State of message reading and how ended */
  extern char  *message_filter;         /* Name of system filter file */


--- 280,285 ----
***************
*** 466,472 ****
  extern int    smtp_accept_max_per_host; /* Max SMTP cons from one host/addr */
  extern int    smtp_accept_queue;      /* Queue after so many connections */
  extern int    smtp_accept_queue_per_connection; /* Queue after so many msgs */
- extern int    smtp_accept_max_per_connection; /* Reject after so many msgs */
  extern int    smtp_accept_reserve;    /* Reserve these SMTP connections */
  extern char  *smtp_banner;            /* Banner string (to be expanded) */
  extern BOOL   smtp_batched_input;     /* TRUE if SMTP batch (no interaction) */
--- 465,470 ----
*** readconf.c    Sun Apr 30 19:01:44 2000
--- readconf.c.bak    Sun Apr 30 00:46:45 2000
***************
*** 219,225 ****
    { "sender_verify_reject",     opt_bool,        &sender_verify_reject },
    { "smtp_accept_keepalive",    opt_bool,        &smtp_accept_keepalive },
    { "smtp_accept_max",          opt_int,         &smtp_accept_max },
-   { "smtp_accept_max_per_connection", opt_int, &smtp_accept_max_per_connection },
    { "smtp_accept_max_per_host", opt_int,         &smtp_accept_max_per_host },
    { "smtp_accept_queue",        opt_int,         &smtp_accept_queue },
    { "smtp_accept_queue_per_connection", opt_int, &smtp_accept_queue_per_connection },
--- 219,224 ----
***************
*** 2384,2398 ****
      "smtp_accept_max must be set if smtp_accept_queue or "
      "smtp_accept_max_per_host is set");


- /* If smtp_accept_queue_per_connection is set, then
- smtp_accept_max_per_connection must also be set (to a larger value). */
- 
- if (smtp_accept_max_per_connection != 0 &&
-     (smtp_accept_queue_per_connection > smtp_accept_max_per_connection))
-   log_write(0, LOG_PANIC_DIE|LOG_CONFIG,
-     "smtp_accept_max_per_connection must be greater than "
-     "smtp_accept_queue_per_connection");
- 
  /* Set up the host number if anything is specified. It is an expanded string
  so that it can be computed from the host name, for example. We do this last
  so as to ensure that everything else is set up before the expansion. */
--- 2383,2388 ----
*** smtp_in.c    Sun Apr 30 19:22:09 2000
--- smtp_in.c.bak    Sun Apr 30 01:16:22 2000
***************
*** 2277,2292 ****
        break;
        }


-     if (smtp_accept_max_per_connection > 0 &&
-         ++message_count > smtp_accept_max_per_connection)
-       {
-       smtp_printf("421 too many messages this connection\r\n");
-       log_write(1, LOG_MAIN|LOG_REJECT, "sender rejected:%s%s too many messages this connection",
-         (sender_fullhost != NULL)? " H=" : "",
-         (sender_fullhost != NULL)? host_and_ident() : "");
-       break;
-       }
- 
      /* Now extract the address, first applying any SMTP-time rewriting. The
      TRUE flag allows "<>" as a sender address. */


--- 2277,2282 ----