Update copyright year in (most) files (those that my script finds).
[exim.git] / src / src / route.c
index 427570ef7d7b662fc3d0789f35239e7bc890f068..c5594b27c6bdd4ddb8a99dc1eb79e4ced49ba8c1 100644 (file)
@@ -1,10 +1,10 @@
-/* $Cambridge: exim/src/src/route.c,v 1.1 2004/10/07 10:39:01 ph10 Exp $ */
+/* $Cambridge: exim/src/src/route.c,v 1.8 2006/02/07 11:19:00 ph10 Exp $ */
 
 /*************************************************
 *     Exim - an Internet mail transport agent    *
 *************************************************/
 
-/* Copyright (c) University of Cambridge 1995 - 2004 */
+/* Copyright (c) University of Cambridge 1995 - 2006 */
 /* See the file NOTICE for conditions of use and distribution. */
 
 /* Functions concerned with routing, and the list of generic router options. */
@@ -34,6 +34,16 @@ optionlist optionlist_routers[] = {
                  (void *)(offsetof(router_instance, address_data)) },
   { "address_test",       opt_bool|opt_public,
                  (void *)(offsetof(router_instance, address_test)) },
+#ifdef EXPERIMENTAL_BRIGHTMAIL
+  { "bmi_deliver_alternate",   opt_bool | opt_public,
+                 (void *)(offsetof(router_instance, bmi_deliver_alternate)) },
+  { "bmi_deliver_default",   opt_bool | opt_public,
+                 (void *)(offsetof(router_instance, bmi_deliver_default)) },
+  { "bmi_dont_deliver",   opt_bool | opt_public,
+                 (void *)(offsetof(router_instance, bmi_dont_deliver)) },
+  { "bmi_rule",           opt_stringptr|opt_public,
+                 (void *)(offsetof(router_instance, bmi_rule)) },
+#endif
   { "cannot_route_message", opt_stringptr | opt_public,
                  (void *)(offsetof(router_instance, cannot_route_message)) },
   { "caseful_local_part", opt_bool | opt_public,
@@ -982,6 +992,46 @@ if (r->condition != NULL)
     }
   }
 
+#ifdef EXPERIMENTAL_BRIGHTMAIL
+/* check if a specific Brightmail AntiSpam rule fired on the message */
+if (r->bmi_rule != NULL) {
+  DEBUG(D_route) debug_printf("checking bmi_rule\n");
+  if (bmi_check_rule(bmi_base64_verdict, r->bmi_rule) == 0) {
+    /* none of the rules fired */
+    DEBUG(D_route)
+      debug_printf("%s router skipped: none of bmi_rule rules fired\n", r->name);
+    return SKIP;
+  };
+};
+
+/* check if message should not be delivered */
+if (r->bmi_dont_deliver) {
+  if (bmi_deliver == 1) {
+    DEBUG(D_route)
+      debug_printf("%s router skipped: bmi_dont_deliver is FALSE\n", r->name);
+    return SKIP;
+  };
+};
+
+/* check if message should go to an alternate location */
+if (r->bmi_deliver_alternate) {
+  if ((bmi_deliver == 0) || (bmi_alt_location == NULL)) {
+    DEBUG(D_route)
+      debug_printf("%s router skipped: bmi_deliver_alternate is FALSE\n", r->name);
+    return SKIP;
+  };
+};
+
+/* check if message should go to default location */
+if (r->bmi_deliver_default) {
+  if ((bmi_deliver == 0) || (bmi_alt_location != NULL)) {
+    DEBUG(D_route)
+      debug_printf("%s router skipped: bmi_deliver_default is FALSE\n", r->name);
+    return SKIP;
+  };
+};
+#endif
+
 /* All the checks passed. */
 
 return OK;
@@ -1647,8 +1697,8 @@ for (r = (addr->start_router == NULL)? routers : addr->start_router;
 
   HDEBUG(D_route) debug_printf("calling %s router\n", r->name);
 
-  yield = (r->info->code)(r, addr, pw, verify != v_none, paddr_local,
-    paddr_remote, addr_new, addr_succeed);
+  yield = (r->info->code)(r, addr, pw, verify, paddr_local, paddr_remote,
+    addr_new, addr_succeed);
 
   if (yield == FAIL)
     {
@@ -1804,7 +1854,7 @@ if (r->translate_ip_address != NULL)
 
     DEBUG(D_route) debug_printf("%s [%s] translated to %s\n",
       h->name, h->address, newaddress);
-    if (string_is_ip_address(newaddress, NULL))
+    if (string_is_ip_address(newaddress, NULL) != 0)
       {
       h->address = newaddress;
       continue;
@@ -1839,8 +1889,6 @@ yield = exp_bool(addr, r->name, US"unseen", r->unseen, r->expand_unseen,
   &unseen);
 if (yield != OK) goto ROUTE_EXIT;
 
-
-
 /* Debugging output recording a successful routing */
 
 HDEBUG(D_route)