Forbid both "unseen" and "one_time" on redirect routers.
[exim.git] / src / src / routers / redirect.c
index 7fad1f35f5b7cda2054e5bcf6aef581dd6a91d81..461fc5d92252e136b6a547e72c974837310419c3 100644 (file)
@@ -1,10 +1,10 @@
-/* $Cambridge: exim/src/src/routers/redirect.c,v 1.3 2004/12/16 15:11:48 tom Exp $ */
+/* $Cambridge: exim/src/src/routers/redirect.c,v 1.6 2005/03/15 11:37:21 ph10 Exp $ */
 
 /*************************************************
 *     Exim - an Internet mail transport agent    *
 *************************************************/
 
-/* Copyright (c) University of Cambridge 1995 - 2004 */
+/* Copyright (c) University of Cambridge 1995 - 2005 */
 /* See the file NOTICE for conditions of use and distribution. */
 
 
@@ -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)
@@ -567,7 +573,7 @@ if (!ugid.gid_set && pw != NULL)
         srs_recipient = res;
         eximsrs_done();
         DEBUG(D_any)
-          debug_printf("SRS: Recipient '%s' rewriteen to '%s'\n", srs_orig_recipient, srs_recipient);
+          debug_printf("SRS: Recipient '%s' rewritten to '%s'\n", srs_orig_recipient, srs_recipient);
       }
   }
 #endif
@@ -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;