# HG changeset patch # User Carl Byington # Date 1342901154 25200 # Node ID 582cfb9c4031310e43e03739f7e9d8fb0b6131ab # Parent 89578e4f9c87bc3623c5987ae358bd1ad2fc130c fix unauthenticated rate limit bug for empty mail from diff -r 89578e4f9c87 -r 582cfb9c4031 src/context.cpp --- a/src/context.cpp Sat Jul 21 12:47:19 2012 -0700 +++ b/src/context.cpp Sat Jul 21 13:05:54 2012 -0700 @@ -854,10 +854,10 @@ bool CONTEXT::is_unauthenticated_limited(const char *user) { - if (!user) return false; rcpt_rates::iterator i = rcpt_per_hour.find(user); // look for sender user@email limiting if (i != rcpt_per_hour.end()) return true; // found user@email limiting const char *f = strchr(user, '@'); + if (!f) return false; i = rcpt_per_hour.find(f); // look for sender @domain limiting return (i != rcpt_per_hour.end()); // found @domain limiting } diff -r 89578e4f9c87 -r 582cfb9c4031 src/dnsbl.cpp --- a/src/dnsbl.cpp Sat Jul 21 12:47:19 2012 -0700 +++ b/src/dnsbl.cpp Sat Jul 21 13:05:54 2012 -0700 @@ -1051,11 +1051,13 @@ // const char *to_lower_string(const char *email); const char *to_lower_string(const char *email) { + if (!email) return strdup("<>"); int n = strlen(email); + if (n == 0) return strdup("<>"); if (email[0] == '<') { // assume it also ends with > n -= 2; - if (n < 1) return strdup(email); // return "<>" + if (n < 1) return strdup("<>"); email++; } if ((email[0] == '\'') && (email[n-1] == '\'') && (n > 2)) {