bug-mailfromd
Re: [Bug-mailfromd] Postfix and mailfromd
Hi Mehmet,
> tbf_rate.c: In function check_tbf_rate:
> tbf_rate.c:125: error: expected ) before PRIu64
> tbf_rate.c:125: error: expected ) before PRIu64
Please, apply the attached patch.
> if not rateok($mail_addr "-" $client_addr, interval("5 minutes"), 20)
> tempfail 450 4.7.0 "Mail sending rate exceeded. Try again later"
> fi
> done
>
> Seems to be working except during my tests I don't necessarily get
> denied after 20 mails, but sometimes 3 or 5 mails.
The rateok function (as well as the other rate functions) is not
supposed to limit the *number* of mails. Instead it limits the
message sending *rate* (hence its name). That is, in your setup
rateok limits the message stream to about 0.067 messages/sec. This means
that it won't allow more than 3 messages per 45.45 seconds or
more than 5 messages per 75.78 seconds, which is what you experience.
> I am also getting the following error messages every time I send a
These are not error messages, but normal run-time notices. If they
bug you, add the following command line option to the mailfromd
command line: --gacopyz-log=err.
Regards,
Sergey
diff --git a/mfd/tbf_rate.c b/mfd/tbf_rate.c
index 7aa2998..b6918c7 100644
--- a/mfd/tbf_rate.c
+++ b/mfd/tbf_rate.c
@@ -24,6 +24,7 @@
#include <mailutils/mailutils.h>
#include "mailfromd.h"
+#include "inttypes.h"
/*
This implements a classical token bucket filter algorithm, with