Add queue_only_load_latch.
[exim.git] / src / src / expand.c
index 922d50faceb4dcb5c72dad41562a7706c508483e..d86ea46585dbc0af5bec5ab3a2e36212ea8ae7d1 100644 (file)
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/src/src/expand.c,v 1.83 2007/02/16 22:23:35 magnus Exp $ */
+/* $Cambridge: exim/src/src/expand.c,v 1.88 2007/06/27 11:01:51 ph10 Exp $ */
 
 /*************************************************
 *     Exim - an Internet mail transport agent    *
@@ -414,6 +414,7 @@ static var_entry var_table[] = {
   { "dk_testing",          vtype_dk_verify,   NULL },
 #endif
   { "dnslist_domain",      vtype_stringptr,   &dnslist_domain },
+  { "dnslist_matched",     vtype_stringptr,   &dnslist_matched },
   { "dnslist_text",        vtype_stringptr,   &dnslist_text },
   { "dnslist_value",       vtype_stringptr,   &dnslist_value },
   { "domain",              vtype_stringptr,   &deliver_domain },
@@ -452,6 +453,7 @@ static var_entry var_table[] = {
 #ifdef WITH_CONTENT_SCAN
   { "malware_name",        vtype_stringptr,   &malware_name },
 #endif
+  { "max_received_linelength", vtype_int,     &max_received_linelength },
   { "message_age",         vtype_int,         &message_age },
   { "message_body",        vtype_msgbody,     &message_body },
   { "message_body_end",    vtype_msgbody_end, &message_body_end },
@@ -1444,7 +1446,7 @@ while (last > first)
     return var_buffer;
 
     case vtype_load_avg:
-    sprintf(CS var_buffer, "%d", os_getloadavg()); /* load_average */
+    sprintf(CS var_buffer, "%d", OS_GETLOADAVG()); /* load_average */
     return var_buffer;
 
     case vtype_host_lookup:                    /* Lookup if not done so */
@@ -2373,7 +2375,6 @@ switch(cond_type)
 
     while (isspace(*s)) s++;
     if (*s++ != '{') goto COND_FAILED_CURLY_START;
-
     sub[0] = expand_string_internal(s, TRUE, &s, (yield == NULL));
     if (sub[0] == NULL) return NULL;
     if (*s++ != '}') goto COND_FAILED_CURLY_END;
@@ -2411,6 +2412,7 @@ switch(cond_type)
         {
         expand_string_message = string_sprintf("%s inside \"%s\" condition",
           expand_string_message, name);
+        iterate_item = save_iterate_item;
         return NULL;
         }
       DEBUG(D_expand) debug_printf("%s: condition evaluated to %s\n", name,
@@ -3699,11 +3701,11 @@ while (*s != 0)
       *domain++ = '\0';
 
       yield = string_cat(yield,&size,&ptr,US"prvs=",5);
-      string_cat(yield,&size,&ptr,sub_arg[0],Ustrlen(sub_arg[0]));
-      string_cat(yield,&size,&ptr,US"/",1);
       string_cat(yield,&size,&ptr,(sub_arg[2] != NULL) ? sub_arg[2] : US"0", 1);
       string_cat(yield,&size,&ptr,prvs_daystamp(7),3);
       string_cat(yield,&size,&ptr,p,6);
+      string_cat(yield,&size,&ptr,US"=",1);
+      string_cat(yield,&size,&ptr,sub_arg[0],Ustrlen(sub_arg[0]));
       string_cat(yield,&size,&ptr,US"@",1);
       string_cat(yield,&size,&ptr,domain,Ustrlen(domain));
 
@@ -3741,15 +3743,15 @@ while (*s != 0)
         case 3: goto EXPAND_FAILED;
         }
 
-      re = regex_must_compile(US"^prvs\\=(.+)\\/([0-9])([0-9]{3})([A-F0-9]{6})\\@(.+)$",
+      re = regex_must_compile(US"^prvs\\=([0-9])([0-9]{3})([A-F0-9]{6})\\=(.+)\\@(.+)$",
                               TRUE,FALSE);
 
       if (regex_match_and_setup(re,sub_arg[0],0,-1))
         {
-        uschar *local_part = string_copyn(expand_nstring[1],expand_nlength[1]);
-        uschar *key_num = string_copyn(expand_nstring[2],expand_nlength[2]);
-        uschar *daystamp = string_copyn(expand_nstring[3],expand_nlength[3]);
-        uschar *hash = string_copyn(expand_nstring[4],expand_nlength[4]);
+        uschar *local_part = string_copyn(expand_nstring[4],expand_nlength[4]);
+        uschar *key_num = string_copyn(expand_nstring[1],expand_nlength[1]);
+        uschar *daystamp = string_copyn(expand_nstring[2],expand_nlength[2]);
+        uschar *hash = string_copyn(expand_nstring[3],expand_nlength[3]);
         uschar *domain = string_copyn(expand_nstring[5],expand_nlength[5]);
 
         DEBUG(D_expand) debug_printf("prvscheck localpart: %s\n", local_part);
@@ -4780,6 +4782,8 @@ while (*s != 0)
           BOOL condresult;
           if (eval_condition(expr, &condresult) == NULL)
             {
+            iterate_item = save_iterate_item;
+            lookup_value = save_lookup_value;
             expand_string_message = string_sprintf("%s inside \"%s\" condition",
               expand_string_message, name);
             goto EXPAND_FAILED;
@@ -4799,6 +4803,7 @@ while (*s != 0)
           temp = expand_string_internal(expr, TRUE, NULL, skipping);
           if (temp == NULL)
             {
+            iterate_item = save_iterate_item;
             expand_string_message = string_sprintf("%s inside \"%s\" item",
               expand_string_message, name);
             goto EXPAND_FAILED;