diff -x '*.log' -x '*.status' -x '*.deps' -x '*.a' -x '*.o' -ur dovecot-2.3-pigeonhole-0.5.21-orig/src/managesieve/managesieve-client.c dovecot-2.3-pigeonhole-0.5.21/src/managesieve/managesieve-client.c --- dovecot-2.3-pigeonhole-0.5.21-orig/src/managesieve/managesieve-client.c 2023-09-14 15:18:26.000000000 +0200 +++ dovecot-2.3-pigeonhole-0.5.21/src/managesieve/managesieve-client.c 2024-06-08 12:23:33.448065570 +0200 @@ -412,7 +412,7 @@ client_send_no(client, error); - if (++client->bad_counter >= CLIENT_MAX_BAD_COMMANDS) { + if (++client->bad_counter >= client->set->max_command_errors) { client_disconnect_with_error( client, "Too many invalid MANAGESIEVE commands."); } diff -x '*.log' -x '*.status' -x '*.deps' -x '*.a' -x '*.o' -ur dovecot-2.3-pigeonhole-0.5.21-orig/src/managesieve/managesieve-common.h dovecot-2.3-pigeonhole-0.5.21/src/managesieve/managesieve-common.h --- dovecot-2.3-pigeonhole-0.5.21-orig/src/managesieve/managesieve-common.h 2023-09-14 15:18:26.000000000 +0200 +++ dovecot-2.3-pigeonhole-0.5.21/src/managesieve/managesieve-common.h 2024-06-01 10:36:40.167047136 +0200 @@ -12,9 +12,6 @@ /* Stop buffering more data into output stream after this many bytes */ #define CLIENT_OUTPUT_OPTIMAL_SIZE 2048 -/* Disconnect client when it sends too many bad commands in a row */ -#define CLIENT_MAX_BAD_COMMANDS 20 - #define CRITICAL_MSG \ "Internal error occurred. Refer to server log for more information." #define CRITICAL_MSG_STAMP CRITICAL_MSG " [%Y-%m-%d %H:%M:%S]" diff -x '*.log' -x '*.status' -x '*.deps' -x '*.a' -x '*.o' -ur dovecot-2.3-pigeonhole-0.5.21-orig/src/managesieve/managesieve-settings.c dovecot-2.3-pigeonhole-0.5.21/src/managesieve/managesieve-settings.c --- dovecot-2.3-pigeonhole-0.5.21-orig/src/managesieve/managesieve-settings.c 2023-09-14 15:18:26.000000000 +0200 +++ dovecot-2.3-pigeonhole-0.5.21/src/managesieve/managesieve-settings.c 2024-06-08 12:31:13.488173013 +0200 @@ -63,6 +63,7 @@ DEF(BOOL, mail_debug), DEF(BOOL, verbose_proctitle), DEF(STR_VARS, rawlog_dir), + DEF(UINT, max_command_errors), DEF(SIZE, managesieve_max_line_length), DEF(STR, managesieve_implementation_string), @@ -70,7 +71,6 @@ DEF(STR, managesieve_logout_format), DEF(UINT, managesieve_max_compile_errors), - SETTING_DEFINE_LIST_END }; @@ -78,6 +78,7 @@ .mail_debug = FALSE, .verbose_proctitle = FALSE, .rawlog_dir = "", + .max_command_errors = 20, /* RFC-2683 recommends at least 8000 bytes. Some clients however don't break large message sets to multiple commands, so we're pretty diff -x '*.log' -x '*.status' -x '*.deps' -x '*.a' -x '*.o' -ur dovecot-2.3-pigeonhole-0.5.21-orig/src/managesieve/managesieve-settings.h dovecot-2.3-pigeonhole-0.5.21/src/managesieve/managesieve-settings.h --- dovecot-2.3-pigeonhole-0.5.21-orig/src/managesieve/managesieve-settings.h 2023-09-14 15:18:26.000000000 +0200 +++ dovecot-2.3-pigeonhole-0.5.21/src/managesieve/managesieve-settings.h 2024-06-08 12:30:32.487074330 +0200 @@ -13,6 +13,7 @@ bool mail_debug; bool verbose_proctitle; const char *rawlog_dir; + unsigned int max_command_errors; /* managesieve: */ uoff_t managesieve_max_line_length; diff -x '*.log' -x '*.status' -x '*.deps' -x '*.a' -x '*.o' -ur dovecot-2.3-pigeonhole-0.5.21-orig/src/managesieve-login/client.c dovecot-2.3-pigeonhole-0.5.21/src/managesieve-login/client.c --- dovecot-2.3-pigeonhole-0.5.21-orig/src/managesieve-login/client.c 2023-09-14 15:18:26.000000000 +0200 +++ dovecot-2.3-pigeonhole-0.5.21/src/managesieve-login/client.c 2024-06-08 12:22:07.446858494 +0200 @@ -23,9 +23,6 @@ #include "managesieve-login-settings.h" #include "managesieve-proxy.h" -/* Disconnect client when it sends too many bad commands */ -#define CLIENT_MAX_BAD_COMMANDS 3 - struct managesieve_command { const char *name; int (*func)(struct managesieve_client *client, @@ -339,7 +336,7 @@ if (ret != 0) client->cmd_finished = TRUE; if (ret < 0) { - if (++client->common.bad_counter >= CLIENT_MAX_BAD_COMMANDS) { + if (++client->common.bad_counter >= client->common.set->max_login_command_errors) { client_send_bye(&client->common, "Too many invalid MANAGESIEVE commands."); client_destroy(&client->common,