summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Haardt <michael@moria.de>2008-12-18 13:13:53 +0000
committerMichael Haardt <michael@moria.de>2008-12-18 13:13:53 +0000
commitefd9a4221230676150af3f26d08432c5567c3a07 (patch)
tree523720ad0382afba614fe566522f802f0f113b18
parentb52bc06efc7a59bd262994eda285d2b125b767d7 (diff)
downloadexim4-efd9a4221230676150af3f26d08432c5567c3a07.tar.gz
Implement the infrastructure of the mailto notification owner as
required by draft-ietf-sieve-notify-mailto-10. There is a new redirect router option sieve_enotify_mailto_owner, which is passed to the Sieve interpreter. The actual Sieve patch will follow later.
-rw-r--r--src/src/deliver.c3
-rw-r--r--src/src/filtertest.c4
-rw-r--r--src/src/functions.h8
-rw-r--r--src/src/rda.c31
-rw-r--r--src/src/routers/queryprogram.c3
-rw-r--r--src/src/routers/redirect.c13
-rw-r--r--src/src/routers/redirect.h3
-rw-r--r--src/src/sieve.c33
8 files changed, 67 insertions, 31 deletions
diff --git a/src/src/deliver.c b/src/src/deliver.c
index c209e12f2..9ab1510e4 100644
--- a/src/src/deliver.c
+++ b/src/src/deliver.c
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/src/src/deliver.c,v 1.45 2007/08/22 14:20:28 ph10 Exp $ */
+/* $Cambridge: exim/src/src/deliver.c,v 1.46 2008/12/18 13:13:54 michael Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
@@ -4807,6 +4807,7 @@ else if (system_filter != NULL && process_recipients != RECIP_FAIL_TIMEOUT)
RDO_REWRITE,
NULL, /* No :include: restriction (not used in filter) */
NULL, /* No sieve vacation directory (not sieve!) */
+ NULL, /* No sieve enotify mailto owner (not sieve!) */
NULL, /* No sieve user address (not sieve!) */
NULL, /* No sieve subaddress (not sieve!) */
&ugid, /* uid/gid data */
diff --git a/src/src/filtertest.c b/src/src/filtertest.c
index 30f29562a..37fc13d45 100644
--- a/src/src/filtertest.c
+++ b/src/src/filtertest.c
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/src/src/filtertest.c,v 1.10 2007/01/08 10:50:18 ph10 Exp $ */
+/* $Cambridge: exim/src/src/filtertest.c,v 1.11 2008/12/18 13:13:54 michael Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
@@ -272,7 +272,7 @@ if (is_system)
else
{
yield = (filter_type == FILTER_SIEVE)?
- sieve_interpret(filebuf, RDO_REWRITE, NULL, NULL, NULL, &generated, &error)
+ sieve_interpret(filebuf, RDO_REWRITE, NULL, NULL, NULL, NULL, &generated, &error)
:
filter_interpret(filebuf, RDO_REWRITE, &generated, &error);
}
diff --git a/src/src/functions.h b/src/src/functions.h
index 514d113cf..2c77c17fd 100644
--- a/src/src/functions.h
+++ b/src/src/functions.h
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/src/src/functions.h,v 1.42 2008/06/04 13:28:23 michael Exp $ */
+/* $Cambridge: exim/src/src/functions.h,v 1.43 2008/12/18 13:13:54 michael Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
@@ -203,8 +203,8 @@ extern int random_number(int);
extern int recv_line(int, uschar *, int);
#endif
extern int rda_interpret(redirect_block *, int, uschar *, uschar *,
- uschar *, uschar *, ugid_block *, address_item **, uschar **,
- error_block **, int *, uschar *);
+ uschar *, uschar *, uschar *, ugid_block *, address_item **,
+ uschar **, error_block **, int *, uschar *);
extern int rda_is_filter(const uschar *);
extern BOOL readconf_depends(driver_instance *, uschar *);
extern void readconf_driver_init(uschar *, driver_instance **,
@@ -268,7 +268,7 @@ extern void sha1_end(sha1 *, const uschar *, int, uschar *);
extern void sha1_mid(sha1 *, const uschar *);
extern void sha1_start(sha1 *);
extern int sieve_interpret(uschar *, int, uschar *, uschar *, uschar *,
- address_item **, uschar **);
+ uschar *, address_item **, uschar **);
extern void sigalrm_handler(int);
extern BOOL smtp_buffered(void);
extern void smtp_closedown(uschar *);
diff --git a/src/src/rda.c b/src/src/rda.c
index 13701dca4..2af9fbfaa 100644
--- a/src/src/rda.c
+++ b/src/src/rda.c
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/src/src/rda.c,v 1.14 2007/01/08 10:50:18 ph10 Exp $ */
+/* $Cambridge: exim/src/src/rda.c,v 1.15 2008/12/18 13:13:54 michael Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
@@ -327,6 +327,7 @@ Arguments:
options the options bits
include_directory restrain to this directory
sieve_vacation_directory passed to sieve_interpret
+ sieve_enotify_mailto_owner passed to sieve_interpret
sieve_useraddress passed to sieve_interpret
sieve_subaddress passed to sieve_interpret
generated where to hang generated addresses
@@ -344,9 +345,10 @@ Returns: a suitable return for rda_interpret()
static int
rda_extract(redirect_block *rdata, int options, uschar *include_directory,
- uschar *sieve_vacation_directory, uschar *sieve_useraddress,
- uschar *sieve_subaddress, address_item **generated, uschar **error,
- error_block **eblockp, int *filtertype)
+ uschar *sieve_vacation_directory, uschar *sieve_enotify_mailto_owner,
+ uschar *sieve_useraddress, uschar *sieve_subaddress,
+ address_item **generated, uschar **error, error_block **eblockp,
+ int *filtertype)
{
uschar *data;
@@ -405,7 +407,8 @@ if (*filtertype != FILTER_FORWARD)
return FF_ERROR;
}
frc = sieve_interpret(data, options, sieve_vacation_directory,
- sieve_useraddress, sieve_subaddress, generated, error);
+ sieve_enotify_mailto_owner, sieve_useraddress, sieve_subaddress,
+ generated, error);
}
expand_forbid = old_expand_forbid;
@@ -511,7 +514,8 @@ Arguments:
options options to pass to the extraction functions,
plus ENOTDIR and EACCES handling bits
include_directory restrain :include: to this directory
- sieve_vacation_directory directory passed to sieve_interpret()
+ sieve_vacation_directory directory passed to sieve_interpret
+ sieve_enotify_mailto_owner passed to sieve_interpret
sieve_useraddress passed to sieve_interpret
sieve_subaddress passed to sieve_interpret
ugid uid/gid to run under - if NULL, no change
@@ -540,9 +544,10 @@ Returns: values from extraction function, or FF_NONEXIST:
int
rda_interpret(redirect_block *rdata, int options, uschar *include_directory,
- uschar *sieve_vacation_directory, uschar *sieve_useraddress,
- uschar *sieve_subaddress, ugid_block *ugid, address_item **generated,
- uschar **error, error_block **eblockp, int *filtertype, uschar *rname)
+ uschar *sieve_vacation_directory, uschar *sieve_enotify_mailto_owner,
+ uschar *sieve_useraddress, uschar *sieve_subaddress, ugid_block *ugid,
+ address_item **generated, uschar **error, error_block **eblockp,
+ int *filtertype, uschar *rname)
{
int fd, rc, pfd[2];
int yield, status;
@@ -586,8 +591,8 @@ if (!ugid->uid_set || /* Either there's no uid, or */
Ustrstr(data, ":include:") == NULL)) /* and there's no :include: */
{
return rda_extract(rdata, options, include_directory,
- sieve_vacation_directory, sieve_useraddress, sieve_subaddress,
- generated, error, eblockp, filtertype);
+ sieve_vacation_directory, sieve_enotify_mailto_owner, sieve_useraddress,
+ sieve_subaddress, generated, error, eblockp, filtertype);
}
/* We need to run the processing code in a sub-process. However, if we can
@@ -636,8 +641,8 @@ if ((pid = fork()) == 0)
/* Now do the business */
yield = rda_extract(rdata, options, include_directory,
- sieve_vacation_directory, sieve_useraddress, sieve_subaddress, generated,
- error, eblockp, filtertype);
+ sieve_vacation_directory, sieve_enotify_mailto_owner, sieve_useraddress,
+ sieve_subaddress, generated, error, eblockp, filtertype);
/* Pass back whether it was a filter, and the return code and any overall
error text via the pipe. */
diff --git a/src/src/routers/queryprogram.c b/src/src/routers/queryprogram.c
index b5f0b435e..3ae577ba8 100644
--- a/src/src/routers/queryprogram.c
+++ b/src/src/routers/queryprogram.c
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/src/src/routers/queryprogram.c,v 1.10 2007/01/08 10:50:20 ph10 Exp $ */
+/* $Cambridge: exim/src/src/routers/queryprogram.c,v 1.11 2008/12/18 13:13:54 michael Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
@@ -378,6 +378,7 @@ if (strcmpic(rword, US"REDIRECT") == 0)
RDO_REWRITE, /* rewrite generated addresses */
NULL, /* :include: directory not relevant */
NULL, /* sieve vacation directory not relevant */
+ NULL, /* sieve enotify mailto owner not relevant */
NULL, /* sieve useraddress not relevant */
NULL, /* sieve subaddress not relevant */
&ugid, /* uid/gid (but not set) */
diff --git a/src/src/routers/redirect.c b/src/src/routers/redirect.c
index 74aba2065..7a8f5b755 100644
--- a/src/src/routers/redirect.c
+++ b/src/src/routers/redirect.c
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/src/src/routers/redirect.c,v 1.20 2007/01/08 10:50:20 ph10 Exp $ */
+/* $Cambridge: exim/src/src/routers/redirect.c,v 1.21 2008/12/18 13:13:54 michael Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
@@ -107,6 +107,8 @@ optionlist redirect_router_options[] = {
(void *)offsetof(redirect_router_options_block, sieve_useraddress) },
{ "sieve_vacation_directory", opt_stringptr,
(void *)offsetof(redirect_router_options_block, sieve_vacation_directory) },
+ { "sieve_enotify_mailto_owner", opt_stringptr,
+ (void *)offsetof(redirect_router_options_block, sieve_enotify_mailto_owner) },
{ "skip_syntax_errors", opt_bool,
(void *)offsetof(redirect_router_options_block, skip_syntax_errors) },
#ifdef EXPERIMENTAL_SRS
@@ -151,6 +153,7 @@ redirect_router_options_block redirect_router_option_defaults = {
NULL, /* sieve_subaddress */
NULL, /* sieve_useraddress */
NULL, /* sieve_vacation_directory */
+ NULL, /* sieve_enotify_mailto_owner */
NULL, /* syntax_errors_text */
NULL, /* syntax_errors_to */
NULL, /* qualify_domain */
@@ -693,10 +696,10 @@ else
}
frc = rda_interpret(&redirect, options, ob->include_directory,
- ob->sieve_vacation_directory, ob->sieve_useraddress, ob->sieve_subaddress,
- &ugid, &generated, &(addr->message), ob->skip_syntax_errors? &eblock : NULL,
- &filtertype, string_sprintf("%s router (recipient is %s)", rblock->name,
- addr->address));
+ ob->sieve_vacation_directory, ob->sieve_enotify_mailto_owner,
+ ob->sieve_useraddress, ob->sieve_subaddress, &ugid, &generated,
+ &(addr->message), ob->skip_syntax_errors? &eblock : NULL, &filtertype,
+ string_sprintf("%s router (recipient is %s)", rblock->name, addr->address));
qualify_domain_recipient = save_qualify_domain_recipient;
diff --git a/src/src/routers/redirect.h b/src/src/routers/redirect.h
index e4f6f2abe..dfed4697a 100644
--- a/src/src/routers/redirect.h
+++ b/src/src/routers/redirect.h
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/src/src/routers/redirect.h,v 1.9 2007/01/08 10:50:20 ph10 Exp $ */
+/* $Cambridge: exim/src/src/routers/redirect.h,v 1.10 2008/12/18 13:13:54 michael Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
@@ -28,6 +28,7 @@ typedef struct {
uschar *sieve_subaddress;
uschar *sieve_useraddress;
uschar *sieve_vacation_directory;
+ uschar *sieve_enotify_mailto_owner;
uschar *syntax_errors_text;
uschar *syntax_errors_to;
uschar *qualify_domain;
diff --git a/src/src/sieve.c b/src/src/sieve.c
index 30fa62999..f1b7cd1f7 100644
--- a/src/src/sieve.c
+++ b/src/src/sieve.c
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/src/src/sieve.c,v 1.35 2008/11/18 11:10:43 michael Exp $ */
+/* $Cambridge: exim/src/src/sieve.c,v 1.36 2008/12/18 13:13:53 michael Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
@@ -71,6 +71,7 @@ struct Sieve
int require_enotify;
struct Notification *notified;
#endif
+ uschar *enotify_mailto_owner;
#ifdef SUBADDRESS
int require_subaddress;
#endif
@@ -3490,7 +3491,15 @@ while (parse_identifier(filter,CUS "require"))
else if (eq_octet(check,&str_envelope_auth,0)) filter->require_envelope_auth=1;
#endif
#ifdef ENOTIFY
- else if (eq_octet(check,&str_enotify,0)) filter->require_enotify=1;
+ else if (eq_octet(check,&str_enotify,0))
+ {
+ if (filter->enotify_mailto_owner == NULL)
+ {
+ filter->errmsg=CUS "enotify disabled";
+ return -1;
+ }
+ filter->require_enotify=1;
+ }
#endif
#ifdef SUBADDRESS
else if (eq_octet(check,&str_subaddress,0)) filter->require_subaddress=1;
@@ -3538,7 +3547,8 @@ Arguments:
filter points to the entire file, read into store as a single string
options controls whether various special things are allowed, and requests
special actions (not currently used)
- sieve_vacation_directory where to store vacation "once" files
+ vacation_directory where to store vacation "once" files
+ enotify_mailto_owner owner of mailto notifications
useraddress string expression for :user part of address
subaddress string expression for :subaddress part of address
generated where to hang newly-generated addresses
@@ -3554,7 +3564,8 @@ Returns: FF_DELIVERED success, a significant action was taken
int
sieve_interpret(uschar *filter, int options, uschar *vacation_directory,
- uschar *useraddress, uschar *subaddress, address_item **generated, uschar **error)
+ uschar *enotify_mailto_owner, uschar *useraddress, uschar *subaddress,
+ address_item **generated, uschar **error)
{
struct Sieve sieve;
int r;
@@ -3580,6 +3591,20 @@ else
}
}
+if (enotify_mailto_owner == NULL)
+ sieve.enotify_mailto_owner = NULL;
+else
+ {
+ sieve.enotify_mailto_owner=expand_string(enotify_mailto_owner);
+ if (sieve.enotify_mailto_owner == NULL)
+ {
+ *error = string_sprintf("failed to expand \"%s\" "
+ "(sieve_enotify_mailto_owner): %s", enotify_mailto_owner,
+ expand_string_message);
+ return FF_ERROR;
+ }
+ }
+
sieve.useraddress = useraddress == NULL ? CUS "$local_part_prefix$local_part$local_part_suffix" : useraddress;
sieve.subaddress = subaddress;