[exim-cvs] cvs commit: exim/exim-src/src deliver.c filtertes…

Page principale
Supprimer ce message
Répondre à ce message
Auteur: Michael Haardt
Date:  
À: exim-cvs
Sujet: [exim-cvs] cvs commit: exim/exim-src/src deliver.c filtertest.c functions.h rda.c sieve.c exim/exim-src/src/routers queryprogram.c redirect.c redirect.h
michael 2008/12/18 13:13:54 GMT

  Modified files:
    exim-src/src         sieve.c rda.c functions.h deliver.c 
                         filtertest.c 
    exim-src/src/routers queryprogram.c redirect.c redirect.h 
  Log:
  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.


  Revision  Changes    Path
  1.46      +1 -0      exim/exim-src/src/deliver.c
  1.11      +1 -1      exim/exim-src/src/filtertest.c
  1.43      +3 -3      exim/exim-src/src/functions.h
  1.15      +17 -12    exim/exim-src/src/rda.c
  1.11      +1 -0      exim/exim-src/src/routers/queryprogram.c
  1.21      +7 -4      exim/exim-src/src/routers/redirect.c
  1.10      +1 -0      exim/exim-src/src/routers/redirect.h
  1.36      +28 -3     exim/exim-src/src/sieve.c


  Index: sieve.c
  ===================================================================
  RCS file: /home/cvs/exim/exim-src/src/sieve.c,v
  retrieving revision 1.35
  retrieving revision 1.36
  diff -u -r1.35 -r1.36
  --- sieve.c    18 Nov 2008 11:10:43 -0000    1.35
  +++ sieve.c    18 Dec 2008 13:13:53 -0000    1.36
  @@ -1,4 +1,4 @@
  -/* $Cambridge: exim/exim-src/src/sieve.c,v 1.35 2008/11/18 11:10:43 michael Exp $ */
  +/* $Cambridge: exim/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 @@
     int require_enotify;
     struct Notification *notified;
   #endif
  +  uschar *enotify_mailto_owner;
   #ifdef SUBADDRESS
     int require_subaddress;
   #endif
  @@ -3490,7 +3491,15 @@
       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 @@
     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 @@


   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 @@
       }
     }


  +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;



  Index: rda.c
  ===================================================================
  RCS file: /home/cvs/exim/exim-src/src/rda.c,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- rda.c    8 Jan 2007 10:50:18 -0000    1.14
  +++ rda.c    18 Dec 2008 13:13:54 -0000    1.15
  @@ -1,4 +1,4 @@
  -/* $Cambridge: exim/exim-src/src/rda.c,v 1.14 2007/01/08 10:50:18 ph10 Exp $ */
  +/* $Cambridge: exim/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 @@
     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 @@


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 @@
         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 @@
     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 @@


   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 @@
        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 @@
     /* 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. */


  Index: functions.h
  ===================================================================
  RCS file: /home/cvs/exim/exim-src/src/functions.h,v
  retrieving revision 1.42
  retrieving revision 1.43
  diff -u -r1.42 -r1.43
  --- functions.h    4 Jun 2008 13:28:23 -0000    1.42
  +++ functions.h    18 Dec 2008 13:13:54 -0000    1.43
  @@ -1,4 +1,4 @@
  -/* $Cambridge: exim/exim-src/src/functions.h,v 1.42 2008/06/04 13:28:23 michael Exp $ */
  +/* $Cambridge: exim/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     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_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 *);


  Index: deliver.c
  ===================================================================
  RCS file: /home/cvs/exim/exim-src/src/deliver.c,v
  retrieving revision 1.45
  retrieving revision 1.46
  diff -u -r1.45 -r1.46
  --- deliver.c    22 Aug 2007 14:20:28 -0000    1.45
  +++ deliver.c    18 Dec 2008 13:13:54 -0000    1.46
  @@ -1,4 +1,4 @@
  -/* $Cambridge: exim/exim-src/src/deliver.c,v 1.45 2007/08/22 14:20:28 ph10 Exp $ */
  +/* $Cambridge: exim/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 @@
         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 */


  Index: filtertest.c
  ===================================================================
  RCS file: /home/cvs/exim/exim-src/src/filtertest.c,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- filtertest.c    8 Jan 2007 10:50:18 -0000    1.10
  +++ filtertest.c    18 Dec 2008 13:13:54 -0000    1.11
  @@ -1,4 +1,4 @@
  -/* $Cambridge: exim/exim-src/src/filtertest.c,v 1.10 2007/01/08 10:50:18 ph10 Exp $ */
  +/* $Cambridge: exim/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 @@
   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);
     }


  Index: queryprogram.c
  ===================================================================
  RCS file: /home/cvs/exim/exim-src/src/routers/queryprogram.c,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- queryprogram.c    8 Jan 2007 10:50:20 -0000    1.10
  +++ queryprogram.c    18 Dec 2008 13:13:54 -0000    1.11
  @@ -1,4 +1,4 @@
  -/* $Cambridge: exim/exim-src/src/routers/queryprogram.c,v 1.10 2007/01/08 10:50:20 ph10 Exp $ */
  +/* $Cambridge: exim/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 @@
         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) */


  Index: redirect.c
  ===================================================================
  RCS file: /home/cvs/exim/exim-src/src/routers/redirect.c,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- redirect.c    8 Jan 2007 10:50:20 -0000    1.20
  +++ redirect.c    18 Dec 2008 13:13:54 -0000    1.21
  @@ -1,4 +1,4 @@
  -/* $Cambridge: exim/exim-src/src/routers/redirect.c,v 1.20 2007/01/08 10:50:20 ph10 Exp $ */
  +/* $Cambridge: exim/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 @@
         (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 @@
     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 @@
     }


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;


  Index: redirect.h
  ===================================================================
  RCS file: /home/cvs/exim/exim-src/src/routers/redirect.h,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- redirect.h    8 Jan 2007 10:50:20 -0000    1.9
  +++ redirect.h    18 Dec 2008 13:13:54 -0000    1.10
  @@ -1,4 +1,4 @@
  -/* $Cambridge: exim/exim-src/src/routers/redirect.h,v 1.9 2007/01/08 10:50:20 ph10 Exp $ */
  +/* $Cambridge: exim/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 @@
     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;