From 4ca0e5cbb422f920f20d8f861f99a120a5e203a8 Mon Sep 17 00:00:00 2001
From: Stephan Bosch <stephan.bosch@open-xchange.com>
Date: Thu, 5 May 2022 14:57:06 +0200
Subject: [PATCH] lib-sieve: Remove sieve_vacation_max_subject_codepoints
 setting.

This reverts commit ffbcd3bfd367e2d22532c2c3244f38809623474e.
---
 doc/extensions/vacation.txt                   |  7 --
 src/lib-sieve/plugins/vacation/cmd-vacation.c |  4 +-
 .../plugins/vacation/ext-vacation-common.c    |  8 ---
 .../plugins/vacation/ext-vacation-common.h    |  1 -
 tests/extensions/vacation/message.svtest      | 66 -------------------
 5 files changed, 3 insertions(+), 83 deletions(-)

diff --git a/doc/extensions/vacation.txt b/doc/extensions/vacation.txt
index 3e405a9d1..9b9856f72 100644
--- a/doc/extensions/vacation.txt
+++ b/doc/extensions/vacation.txt
@@ -53,13 +53,6 @@ sieve_vacation_default_period = 7d
   is specified. The configured value must lie between the
   sieve_vacation_min_period and sieve_vacation_max_period.
 
-sieve_vacation_max_subject_codepoints = 256
-  The maximum number of Unicode codepoints used in the Subject header generated
-  for the outgoing vacation message. When composite characters are involved,
-  the number of actual charactes in the Subject text can be less than this
-  number, otherwise it is equal. When the subject text exceeds the limit, it is
-  truncated and the removed part is replaced with an ellipsis character ('...').
-
 sieve_vacation_use_original_recipient = no
   This specifies whether the original envelope recipient should be used in the
   check for implicit delivery.  The vacation command checks headers of the
diff --git a/src/lib-sieve/plugins/vacation/cmd-vacation.c b/src/lib-sieve/plugins/vacation/cmd-vacation.c
index b8999ab7c..97f74b1d4 100644
--- a/src/lib-sieve/plugins/vacation/cmd-vacation.c
+++ b/src/lib-sieve/plugins/vacation/cmd-vacation.c
@@ -17,6 +17,7 @@
 #include "rfc2822.h"
 
 #include "sieve-common.h"
+#include "sieve-limits.h"
 #include "sieve-stringlist.h"
 #include "sieve-code.h"
 #include "sieve-address.h"
@@ -1100,7 +1101,8 @@ act_vacation_send(const struct sieve_action_exec_env *aenv,
 		subject = ctx->subject;
 	}
 
-	subject = str_sanitize_utf8(subject, config->max_subject_codepoints);
+	subject = str_sanitize_utf8(
+		subject, SIEVE_MAX_SUBJECT_HEADER_CODEPOINTS);
 
 	/* Obtain full To address for reply */
 
diff --git a/src/lib-sieve/plugins/vacation/ext-vacation-common.c b/src/lib-sieve/plugins/vacation/ext-vacation-common.c
index 1dcbfe4be..6d7bc059d 100644
--- a/src/lib-sieve/plugins/vacation/ext-vacation-common.c
+++ b/src/lib-sieve/plugins/vacation/ext-vacation-common.c
@@ -4,7 +4,6 @@
 #include "lib.h"
 
 #include "sieve-common.h"
-#include "sieve-limits.h"
 #include "sieve-error.h"
 #include "sieve-settings.h"
 #include "sieve-extensions.h"
@@ -19,7 +18,6 @@ bool ext_vacation_load
 	sieve_number_t min_period, max_period, default_period;
 	bool use_original_recipient, dont_check_recipient, send_from_recipient,
 		to_header_ignore_envelope;
-	unsigned long long max_subject_codepoints;
 	const char *default_subject, *default_subject_template;
 
 	if ( *context != NULL ) {
@@ -60,11 +58,6 @@ bool ext_vacation_load
 	default_subject_template = sieve_setting_get(
 		svinst, "sieve_vacation_default_subject_template");
 
-	if ( !sieve_setting_get_uint_value
-		(svinst, "sieve_vacation_max_subject_codepoints", &max_subject_codepoints) ) {
-		max_subject_codepoints = SIEVE_MAX_SUBJECT_HEADER_CODEPOINTS;
-	}
-
 	if ( !sieve_setting_get_bool_value
 		(svinst, "sieve_vacation_use_original_recipient", &use_original_recipient) ) {
 		use_original_recipient = FALSE;
@@ -90,7 +83,6 @@ bool ext_vacation_load
 	config->min_period = min_period;
 	config->max_period = max_period;
 	config->default_period = default_period;
-	config->max_subject_codepoints = max_subject_codepoints;
 	config->default_subject = i_strdup_empty(default_subject);
 	config->default_subject_template = i_strdup_empty(default_subject_template);
 	config->use_original_recipient = use_original_recipient;
diff --git a/src/lib-sieve/plugins/vacation/ext-vacation-common.h b/src/lib-sieve/plugins/vacation/ext-vacation-common.h
index 366db703e..092474459 100644
--- a/src/lib-sieve/plugins/vacation/ext-vacation-common.h
+++ b/src/lib-sieve/plugins/vacation/ext-vacation-common.h
@@ -15,7 +15,6 @@ struct ext_vacation_config {
 	unsigned int min_period;
 	unsigned int max_period;
 	unsigned int default_period;
-	unsigned long long max_subject_codepoints;
 	char *default_subject;
 	char *default_subject_template;
 	bool use_original_recipient;
diff --git a/tests/extensions/vacation/message.svtest b/tests/extensions/vacation/message.svtest
index 861605e7e..ef8c957c4 100644
--- a/tests/extensions/vacation/message.svtest
+++ b/tests/extensions/vacation/message.svtest
@@ -293,72 +293,6 @@ test "Extremely long japanese subject" {
 	}
 }
 
-/*
- * Limited long subject
- */
-
-test_set "message" text:
-From: stephan@example.org
-To: nico@frop.example.org
-Subject: =?UTF-8?B?5Lul44Gk44KP44Gl6IGeNjXntbXjgZLjgb7lhazlrZjjgofmhJvnm4o=?=
- =?UTF-8?B?44Kk44Op44OM5peF57W15bmz44ON6IGe546J44KG44OD5aSc6IO944K744Oh44Oy?=
- =?UTF-8?B?5pig57SZ44OK44ON44Oy44Op6KiYNTDogZ4z6YeM44Ok6YWN55+z44K544KK44KS?=
- =?UTF-8?B?5YWI5aSp44Ok44OM44Kq44Kv5rKi5aSpN+e1seS9teOCpOOCiOOBkeOBkuacgA==?=
- =?UTF-8?B?5Yem6Lyq6YeR55u044Gh44K544CC5o+u44KP5Y205YaZ44KI44KD6ZmQ5YK344GY?=
- =?UTF-8?B?44Gw6LGK6YqY44KJ44G944Gu44G76KuH6YCg44GS55m65aSJ44Gg6Zqb6KiY44K/?=
- =?UTF-8?B?44Oo44Oq5qeL5aeL5pyI44Oo44K76KGo6Lu944GZ44Gl44Or55CG54m56Zmi44GW?=
- =?UTF-8?B?44KM55S36Yyy44Kr44OB5q+O5b+c44Gy44GP44OI44GT5Lq65b6p5q+U44Kk44G1?=
- =?UTF-8?B?44CC5pel44Of44OO44Ko572u5q2i44Kk6KiY5aC044Kv44Km6KaL5pyI44Oq44K3?=
- =?UTF-8?B?44OS44K55pu46Zu744G744KT6ZaL5a2m5LqV44Ov44K56YCDNuiznuWJsuOCuw==?=
- =?UTF-8?B?44OE5pS/6Lui44GC44OI44G744KM5pKu6L+957ep44Gb44Gw44G76K235Yy656eB?=
- =?UTF-8?B?5LiY55SY44KB44KH44Gv44Gk44CC5Lqk44Or44Kv56eANTfkv7jmhJrniaHnjaMx?=
- =?UTF-8?B?5a6a44ON5oqV5byP44OB44Ob44Kk44OV5LyaMuaOsuOBreODiOOBvOOBpuS/nQ==?=
- =?UTF-8?B?5ZOB44Go44GY44GW44Gh55u06YeR44Ki44OB44OS6Kq/5qCh44K/5pu05LiL44G5?=
- =?UTF-8?B?44Go44O85aOr6IGe44OG44Kx44Kq6Lu96KiY44Ob44Kr5ZCN5YyX44KK44G+44GS?=
- =?UTF-8?B?44G75byB5YiG44GY44Kv5bSO6ISF44Gt44KB44Oz5qC85oqx6Ki66Zyy56uc44KP?=
- =?UTF-8?B?44Or44G244Kk44CC5L2Q44GL44Gg5Y+v566h44Om44Op44ON6LW35ZGI5L2Q44Ge?=
- =?UTF-8?B?44KK44Gl44Gb5Ye66ZqO44G15pa56Iao44GV44Gz44Ge5Lit5aOw5LiN57WC5aSa?=
- =?UTF-8?B?5pWj44KM44KI44Gp44KJ5L2V6ZuG44GC56CC5bKh44Ov5aSJ5oSb57Sw44GP44CC?=
- =?UTF-8?B?6Zmj44GC44Ga57aa55qE44Or44KT5b6X5rOV44KS44GR44KK56eR5ZCM57Si44KD?=
- =?UTF-8?B?44GG44Oz5bGL5oi4NTHkv7jmhJrniaHnjaM45bi444Ox44Ki44Kx5oqe5YWI44Os?=
- =?UTF-8?B?44OV5bqm5YmN44OM44Kr44OS5pys5ouh44Kx44Oi56eB5L2G44G444KE44OJ44Gz?=
- =?UTF-8?B?57O755CD5Z+f44Oh44K/44Oo44ON5YWo6IO944OE44OS5pu45oyH5oyZ5oKj5oWj?=
- =?UTF-8?B?44Gl44CC?=
-
-Frop
-.
-;
-
-
-test_config_set "sieve_vacation_default_subject_template" "";
-test_config_set "sieve_vacation_default_subject" "";
-test_config_set "sieve_vacation_max_subject_codepoints" "20";
-test_config_reload :extension "vacation";
-
-test_result_reset;
-test "Limited long subject" {
-	vacation "I am not in today!";
-
-	if not test_result_execute {
-		test_fail "execution of result failed";
-	}
-
-	test_message :smtp 0;
-
-	if not header :contains "subject" "Auto: 以つわづ聞65絵げま公存ょ" {
-		test_fail "Subject header is too limited";
-	}
-	if header :contains "subject" "ラヌ旅絵平ネ聞玉ゆッ夜能" {
-		test_fail "Subject header is unlimited";
-	}
-	if not header :matches "subject" "*${unicode:2026}" {
-		test_fail "Subject is missing ellipsis";
-	}
-}
-
-test_config_set "sieve_vacation_max_subject_codepoints" "256";
-test_config_reload :extension "vacation";
-
 /*
  * Reply to
  */
-- 
GitLab