Further tidies to the ${dlfunc code (thanks, Tony): redirect options are
[exim.git] / src / src / routers / redirect.c
index aba5b0d6303834cd71e2cffc1515f8273a59990b..c0c76322cc9581d60c8a760b22e5e68fb93f63c9 100644 (file)
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/src/src/routers/redirect.c,v 1.4 2005/01/04 10:00:44 ph10 Exp $ */
+/* $Cambridge: exim/src/src/routers/redirect.c,v 1.8 2005/03/22 15:02:34 ph10 Exp $ */
 
 /*************************************************
 *     Exim - an Internet mail transport agent    *
@@ -45,16 +45,16 @@ optionlist redirect_router_options[] = {
       (void *)offsetof(redirect_router_options_block, bit_options) },
   { "forbid_file",        opt_bool,
       (void *)offsetof(redirect_router_options_block, forbid_file) },
+  { "forbid_filter_dlfunc", opt_bit | (RDON_DLFUNC << 16),
+      (void *)offsetof(redirect_router_options_block, bit_options) },
   { "forbid_filter_existstest",  opt_bit | (RDON_EXISTS << 16),
       (void *)offsetof(redirect_router_options_block, bit_options) },
   { "forbid_filter_logwrite",opt_bit | (RDON_LOG << 16),
       (void *)offsetof(redirect_router_options_block, bit_options) },
   { "forbid_filter_lookup", opt_bit | (RDON_LOOKUP << 16),
       (void *)offsetof(redirect_router_options_block, bit_options) },
-  #ifdef EXIM_PERL
   { "forbid_filter_perl", opt_bit | (RDON_PERL << 16),
       (void *)offsetof(redirect_router_options_block, bit_options) },
-  #endif
   { "forbid_filter_readfile", opt_bit | (RDON_READFILE << 16),
       (void *)offsetof(redirect_router_options_block, bit_options) },
   { "forbid_filter_readsocket", opt_bit | (RDON_READSOCK << 16),
@@ -185,7 +185,10 @@ if ((ob->file == NULL) == (ob->data == NULL))
     "%sone of \"file\" or \"data\" must be specified",
     rblock->name, (ob->file == NULL)? "" : "only ");
 
-/* Onetime aliases can only be real addresses. Headers can't be manipulated. */
+/* Onetime aliases can only be real addresses. Headers can't be manipulated.
+The combination of one_time and unseen is not allowed. We can't check the
+expansion of "unseen" here, but we assume that if it is set to anything other
+than false, there is likely to be a problem. */
 
 if (ob->one_time)
   {
@@ -194,6 +197,9 @@ if (ob->one_time)
     log_write(0, LOG_PANIC_DIE|LOG_CONFIG_FOR, "%s router:\n  "
       "\"headers_add\" and \"headers_remove\" are not permitted with "
       "\"one_time\"", rblock->name);
+  if (rblock->unseen || rblock->expand_unseen != NULL)
+    log_write(0, LOG_PANIC_DIE|LOG_CONFIG_FOR, "%s router:\n  "
+      "\"unseen\" may not be used with \"one_time\"", rblock->name);
   }
 
 /* The defaults for check_owner and check_group depend on other settings. The
@@ -548,16 +554,16 @@ if (!ugid.gid_set && pw != NULL)
   if(ob->srs != NULL)
   {
     BOOL usesrs = TRUE;
-    
+
     if(ob->srs_condition != NULL)
       usesrs = expand_check_condition(ob->srs_condition, "srs_condition expansion failed", NULL);
-    
+
     if(usesrs)
       if(Ustrcmp(ob->srs, "reverse") == 0 || Ustrcmp(ob->srs, "reverseandforward") == 0)
       {
         uschar *res;
         int n_srs;
-    
+
         srs_orig_recipient = addr->address;
         eximsrs_init();
         if(ob->srs_db)
@@ -800,17 +806,17 @@ else
   if(ob->srs != NULL)
   {
     BOOL usesrs = TRUE;
-    
+
     if(ob->srs_condition != NULL)
       usesrs = expand_check_condition(ob->srs_condition, "srs_condition expansion failed", NULL);
-    
+
     if(usesrs)
       if((Ustrcmp(ob->srs, "forward") == 0 || Ustrcmp(ob->srs, "reverseandforward") == 0) && !verify)
       {
         uschar *res;
         uschar *usedomain;
         int n_srs;
-      
+
         srs_orig_sender = sender_address;
         eximsrs_init();
         if(ob->srs_db)
@@ -818,7 +824,7 @@ else
 
         if(ob->srs_alias != NULL ? (usedomain = expand_string(ob->srs_alias)) == NULL : 1)
           usedomain = deliver_domain;
-                
+
         if((n_srs = eximsrs_forward(&res, sender_address, usedomain)) != OK)
           return n_srs;
         sender_address = res;