#include <sys/wait.h>
#include <string.h>
#include <limits.h>
+#include <libcitadel.h>
#include "citadel.h"
#include "server.h"
#include "citserver.h"
#include "database.h"
#include "msgbase.h"
#include "internet_addressing.h"
-#include "tools.h"
#include "ctdl_module.h"
lprintf(CTDL_DEBUG, "Action is REDIRECT, recipient <%s>\n", recp);
- valid = validate_recipients(recp);
+ valid = validate_recipients(recp, 0);
if (valid == NULL) {
lprintf(CTDL_WARNING, "REDIRECT failed: bad recipient <%s>\n", recp);
return SIEVE2_ERROR_BADARGS;
{
struct ctdl_sieve *cs = (struct ctdl_sieve *)my;
- lprintf(CTDL_DEBUG, "Action is GETENVELOPE\n");
+ lprintf(CTDL_DEBUG, "Action is GETENVELOPE\nEnvFrom: %s\n EnvTo: %s\n",
+ cs->envelope_from, cs->envelope_to);
if (cs->envelope_from != NULL) {
if ((cs->envelope_from[0] != '@')&&(cs->envelope_from[strlen(cs->envelope_from)-1] != '@')) {
size_t headers_len = 0;
int len = 0;
+ if (userdata == NULL)
+ {
+ lprintf(CTDL_EMERG, "Cant process Message <%ld>without Userdata!\n", msgnum);
+ return;
+ }
+
lprintf(CTDL_DEBUG, "Performing sieve processing on msg <%ld>\n", msgnum);
msg = CtdlFetchMessage(msgnum, 0);
/* Keep track of the envelope-from address (use body-from if not found) */
if (msg->cm_fields['P'] != NULL) {
safestrncpy(my.envelope_from, msg->cm_fields['P'], sizeof my.envelope_from);
+ stripallbut(my.envelope_from, '<', '>');
}
else if (msg->cm_fields['F'] != NULL) {
safestrncpy(my.envelope_from, msg->cm_fields['F'], sizeof my.envelope_from);
+ stripallbut(my.envelope_from, '<', '>');
}
else {
strcpy(my.envelope_from, "");
/* Keep track of the envelope-to address (use body-to if not found) */
if (msg->cm_fields['V'] != NULL) {
safestrncpy(my.envelope_to, msg->cm_fields['V'], sizeof my.envelope_to);
+ stripallbut(my.envelope_to, '<', '>');
}
else if (msg->cm_fields['R'] != NULL) {
safestrncpy(my.envelope_to, msg->cm_fields['R'], sizeof my.envelope_to);
strcat(my.envelope_to, "@");
strcat(my.envelope_to, msg->cm_fields['D']);
}
+ stripallbut(my.envelope_to, '<', '>');
}
else {
strcpy(my.envelope_to, "");
CTDL_MODULE_INIT(sieve)
{
-
+ if (!threading)
+ {
#ifdef HAVE_LIBSIEVE
- ctdl_sieve_init();
- CtdlRegisterProtoHook(cmd_msiv, "MSIV", "Manage Sieve scripts");
+ ctdl_sieve_init();
+ CtdlRegisterProtoHook(cmd_msiv, "MSIV", "Manage Sieve scripts");
- CtdlRegisterRoomHook(serv_sieve_room);
+ CtdlRegisterRoomHook(serv_sieve_room);
- CtdlRegisterSessionHook(perform_sieve_processing, EVT_HOUSE);
+ CtdlRegisterSessionHook(perform_sieve_processing, EVT_HOUSE);
#else /* HAVE_LIBSIEVE */
- lprintf(CTDL_INFO, "This server is missing libsieve. Mailbox filtering will be disabled.\n");
+ lprintf(CTDL_INFO, "This server is missing libsieve. Mailbox filtering will be disabled.\n");
#endif /* HAVE_LIBSIEVE */
-
+ }
+
/* return our Subversion id for the Log */
return "$Id$";
}