# HG changeset patch # User carl # Date 1159308586 25200 # Node ID 9d0bc30b45769e09a2b15b849a4428b5254dc7f4 # Parent a6190f7798f4214688c48741f2a7d241c7d1b3ad add smtp auth rate limits diff -r a6190f7798f4 -r 9d0bc30b4576 src/dnsbl.cpp --- a/src/dnsbl.cpp Tue Sep 26 14:17:00 2006 -0700 +++ b/src/dnsbl.cpp Tue Sep 26 15:09:46 2006 -0700 @@ -149,8 +149,14 @@ int incr_rcpt_count(char *user) { pthread_mutex_lock(&rate_mutex); rcpt_rates::iterator i = rcpt_counts.find(user); - int c = (i == rcpt_counts.end()) ? 0 : (*i).second; - rcpt_counts[user] = c++; + int c = 1; + if (i == rcpt_counts.end()) { + user = strdup(user); + rcpt_counts[user] = c; + } + else { + c = (*i).second++; + } pthread_mutex_unlock(&rate_mutex); return c; } @@ -1173,6 +1179,10 @@ // three minutes thru each loop, 20 loops per hour // clear the recipient counts pthread_mutex_lock(&rate_mutex); + for (rcpt_rates::iterator i=rcpt_counts.begin(); i!=rcpt_counts.end(); i++) { + char *x = (*i).first; + free(x); + } rcpt_counts.clear(); pthread_mutex_unlock(&rate_mutex); loop = 0;