pkgsrc/mail/policyd/patches/patch-ae
2008-03-03 11:45:17 +00:00

31 lines
1.1 KiB
Text

$NetBSD: patch-ae,v 1.1 2008/03/03 11:45:17 sketch Exp $
--- throttle_rcpt.c.orig 2007-08-20 07:42:05.000000000 +0100
+++ throttle_rcpt.c 2008-03-03 11:40:14.424059000 +0000
@@ -61,15 +61,18 @@
trcpt[fd] = atof(mysqlchar_array[fd][2]) / atof(mysqlchar_array[fd][1]) * 100;
/* percentage won, set attribute accordingly */
- switch (trcpt[fd])
- {
- case 0 ... 49: tattrib_array[fd][0] = 'a'; break;
- case 50 ... 89: tattrib_array[fd][0] = 'w'; break;
- case 90 ... 1000: tattrib_array[fd][0] = 'p'; break;
+ if (trcpt[fd] >= 0 && trcpt[fd] <= 49)
+ tattrib_array[fd][0] = 'a';
- default:
- logmessage("fatal: throttle_rcpt(): invalid tresult: %d\n", trcpt[fd]);
- }
+ else if (trcpt[fd] >= 50 && trcpt[fd] <= 89)
+ tattrib_array[fd][0] = 'w';
+
+ /* allow for big percentage overshoot */
+ else if (trcpt[fd] >= 90 && trcpt[fd] <= 1000)
+ tattrib_array[fd][0] = 'p';
+
+ else
+ logmessage("fatal: throttle_rcpt(): invalid tresult: %d\n", trcpt[fd]);
/* user is not in the database */
if(strlen(mysqlchar_array[fd][0]) < 2)