Re: [Exim] message_size too small?

Etusivu
Poista viesti
Vastaa
Lähettäjä: John Dalbec
Päiväys:  
Vastaanottaja: exim-users
Aihe: Re: [Exim] message_size too small?
This is a multi-part message in MIME format.
--
Philip Hazel wrote:
> On Tue, 5 Nov 2002, John Dalbec wrote:
>>Yes, I think you're right. Is there any way to have these added headers
>>included in the message_size at quota_warn time? Or is there a way to
>>determine the size of the added headers?
>
>
> No, there isn't. Sorry.
>
> In fact, my view now is that quota_warn_threshold is not as useful as I
> first imagined it would be. (We have stopped using it on our servers).
> People who want to do warning things are probably better off writing a
> separate application that scans mailboxes and checks their sizes over a
> a period rather than instantly. However, given that it exists, it ought
> to work...
>


It looks as though the warning logic could be moved after the actual
writing of the message (I've attached a patch).  I tried doing this and
rebuilt Exim and was able to generate a quota warning message with the
new Exim version.  Then transport_write_message and
transport_write_string could be changed to track the length of what
they're writing, perhaps in a new global variable.  Wouldn't that fix
the problem?
John
--
--- exim-4.10-unpatched/src/transports/appendfile.c.orig    Wed Nov  6 09:45:20 2002
+++ exim-4.10-unpatched/src/transports/appendfile.c    Wed Nov  6 09:46:17 2002
@@ -2359,22 +2359,6 @@
     }
   }


-/* If there is a quota warning threshold and we are going to cross it with this
-message, set the SPECIAL_WARN flag in the address, to cause a warning message
-to be sent. */
-
-if (ob->quota_warn_threshold_value > 0)
-  {
-  int threshold = ob->quota_warn_threshold_value;
-  if (ob->quota_warn_threshold_is_percent)
-    threshold = (int)(((double)ob->quota_value * threshold) / 100);
-  DEBUG(D_transport)
-    debug_printf("quota threshold = %d old size = %d message size = %d\n",
-      threshold, saved_size, message_size);
-  if (saved_size <= threshold && saved_size + message_size > threshold)
-    addr->special_action = SPECIAL_WARN;
-  }
-
 /* If we are writing in MBX format, what we actually do is to write the message
 to a temporary file, and then copy it to the real file once we know its size.
 This is the most straightforward way of getting the correct length in the
@@ -2472,6 +2456,22 @@


 if (yield == OK && ob->use_bsmtp &&
   !transport_write_string(fd, ".%s\n", cr)) yield = DEFER;
+
+/* If there is a quota warning threshold and we are going to cross it with this
+message, set the SPECIAL_WARN flag in the address, to cause a warning message
+to be sent. */
+
+if (ob->quota_warn_threshold_value > 0)
+  {
+  int threshold = ob->quota_warn_threshold_value;
+  if (ob->quota_warn_threshold_is_percent)
+    threshold = (int)(((double)ob->quota_value * threshold) / 100);
+  DEBUG(D_transport)
+    debug_printf("quota threshold = %d old size = %d message size = %d\n",
+      threshold, saved_size, message_size);
+  if (saved_size <= threshold && saved_size + message_size > threshold)
+    addr->special_action = SPECIAL_WARN;
+  }



/* If MBX format is being used, all that writing was to the temporary file.

--