comparison src/mail/ngx_mail_handler.c @ 7844:ec1071830799

Mail: max_errors directive. Similarly to smtpd_hard_error_limit in Postfix and smtp_max_unknown_commands in Exim, specifies the number of errors after which the connection is closed.
author Maxim Dounin <mdounin@mdounin.ru>
date Wed, 19 May 2021 03:13:31 +0300
parents 2851e4c7de03
children 0aaa09927703
comparison
equal deleted inserted replaced
7843:b38728495e1a 7844:ec1071830799
872 s->quit = 1; 872 s->quit = 1;
873 873
874 return NGX_MAIL_PARSE_INVALID_COMMAND; 874 return NGX_MAIL_PARSE_INVALID_COMMAND;
875 } 875 }
876 876
877 if (rc == NGX_IMAP_NEXT || rc == NGX_MAIL_PARSE_INVALID_COMMAND) { 877 if (rc == NGX_MAIL_PARSE_INVALID_COMMAND) {
878
879 s->errors++;
880
881 if (s->errors >= cscf->max_errors) {
882 ngx_log_error(NGX_LOG_INFO, c->log, 0,
883 "client sent too many invalid commands");
884 s->quit = 1;
885 }
886
887 return rc;
888 }
889
890 if (rc == NGX_IMAP_NEXT) {
878 return rc; 891 return rc;
879 } 892 }
880 893
881 if (rc == NGX_ERROR) { 894 if (rc == NGX_ERROR) {
882 ngx_mail_close_connection(c); 895 ngx_mail_close_connection(c);