[PATCHv2 4/4] Make min/max VACACTION response configurable
Philipp Hahn
hahn at univention.de
Tue May 8 02:52:18 EDT 2012
Add imapoptions to change the minimum and maximum allowed time interval
between consecutive vacation responses.
The defaults are still 3 and 90 days, which are too high for the
vacation-seconds extension. Blindly lowering the limit might be
problematic for high traffic sites.
Signed-off-by: Philipp Hahn <hahn at univention.de>
---
lib/imapoptions | 8 ++++++++
sieve/interp.c | 6 ++++--
sieve/sieve_interface.h | 2 +-
tools/config2header | 1 +
4 files changed, 14 insertions(+), 3 deletions(-)
diff --git a/lib/imapoptions b/lib/imapoptions
index f97be2d..3552848 100644
--- a/lib/imapoptions
+++ b/lib/imapoptions
@@ -1238,6 +1238,14 @@ product version in the capabilities */
/* If enabled, timsieved will emit a capability response after a successful
SASL authentication, per draft-martin-managesieve-12.txt . */
+{ "sieve_vacation_min_response", 3 * DAY2SEC, INT }
+/* Minimum time interval (in seconds) between consecutive vacation responses,
+ per draft-ietf-vacation-seconds.txt . */
+
+{ "sieve_vacation_max_response", 90 * DAY2SEC, INT }
+/* Maximum time interval (in seconds) between consecutive vacation responses,
+ per draft-ietf-vacation-seconds.txt . */
+
{ "sievedir", "/usr/sieve", STRING }
/* If sieveusehomedir is false, this directory is searched for Sieve
scripts. */
diff --git a/sieve/interp.c b/sieve/interp.c
index e36fe48..a2548a0 100644
--- a/sieve/interp.c
+++ b/sieve/interp.c
@@ -259,8 +259,10 @@ int sieve_register_vacation(sieve_interp_t *interp, sieve_vacation_t *v)
return SIEVE_NOT_FINALIZED; /* we need envelope for vacation! */
}
- if (v->min_response == 0) v->min_response = 3 * DAY2SEC;
- if (v->max_response == 0) v->max_response = 90 * DAY2SEC;
+ if (v->min_response == 0)
+ v->min_response = config_getint(IMAPOPT_SIEVE_VACATION_MIN_RESPONSE);
+ if (v->max_response == 0)
+ v->max_response = config_getint(IMAPOPT_SIEVE_VACATION_MAX_RESPONSE);
if (v->min_response < 0 || v->max_response < 7 * DAY2SEC || !v->autorespond
|| !v->send_response) {
return SIEVE_FAIL;
diff --git a/sieve/sieve_interface.h b/sieve/sieve_interface.h
index 35bb88f..18515dd 100644
--- a/sieve/sieve_interface.h
+++ b/sieve/sieve_interface.h
@@ -84,7 +84,7 @@ typedef int sieve_get_body(void *message_context, const char **content_types,
sieve_bodypart_t ***parts);
typedef struct sieve_vacation {
- int min_response; /* 0 -> defaults to 3 days */
+ int min_response; /* 0 -> defaults to 0 seconds */
int max_response; /* 0 -> defaults to 90 days */
/* given a hash, say whether we've already responded to it in the last
diff --git a/tools/config2header b/tools/config2header
index 93b0698..76f60a7 100755
--- a/tools/config2header
+++ b/tools/config2header
@@ -126,6 +126,7 @@ print CFILE <<EOF
#include <stdlib.h>
#include <string.h>
#include "imapopts.h"
+#include "times.h"
struct imapopt_s imapopts[] =
{
--
1.7.1
More information about the Cyrus-devel
mailing list