comparison src/dnsbl.cpp @ 290:bb69fdc3acaa

Unique ip connection limits only apply to authenticated connections
author Carl Byington <carl@five-ten-sg.com>
date Fri, 21 Mar 2014 13:55:46 -0700
parents 9bd5388bf469
children 9f0d9fcb58dd
comparison
equal deleted inserted replaced
289:6497944a9bd9 290:bb69fdc3acaa
1201 priv.assassin = new SpamAssassin(&priv, priv.ip, priv.helo, priv.mailaddr, priv.queueid); 1201 priv.assassin = new SpamAssassin(&priv, priv.ip, priv.helo, priv.mailaddr, priv.queueid);
1202 } 1202 }
1203 if (dccifd_port) { 1203 if (dccifd_port) {
1204 priv.dccifd = new DccInterface(dccifd_port, &priv, priv.ip, priv.helo, priv.mailaddr); 1204 priv.dccifd = new DccInterface(dccifd_port, &priv, priv.ip, priv.helo, priv.mailaddr);
1205 } 1205 }
1206 const char *uid = (priv.authenticated) ? priv.authenticated : priv.mailaddr; 1206 if (priv.authenticated) {
1207 if (priv.authenticated || dc.default_context->is_unauthenticated_limited(priv.mailaddr)) {
1208 int hourly, daily; 1207 int hourly, daily;
1209 add_auth_address(uid, hourly, daily, priv.ip); 1208 add_auth_address(priv.authenticated, hourly, daily, priv.ip);
1210 int h_limit = dc.default_context->find_address_limit(uid); 1209 int h_limit = dc.default_context->find_address_limit(priv.authenticated);
1211 int d_limit = dc.default_context->get_daily_address_multiple() * h_limit; 1210 int d_limit = dc.default_context->get_daily_address_multiple() * h_limit;
1212 if (debug_syslog > 1) { 1211 if (debug_syslog > 1) {
1213 char msg[maxlen]; 1212 char msg[maxlen];
1214 snprintf(msg, sizeof(msg), "connect for %s (%d %d addresses, %d %d limits)", uid, hourly, daily, h_limit, d_limit); 1213 snprintf(msg, sizeof(msg), "connect for %s (%d %d addresses, %d %d limits)", priv.authenticated, hourly, daily, h_limit, d_limit);
1215 my_syslog(&priv, msg); 1214 my_syslog(&priv, msg);
1216 } 1215 }
1217 if ((hourly > h_limit) || (daily > d_limit)){ 1216 if ((hourly > h_limit) || (daily > d_limit)){
1218 smfi_setreply(ctx, (char*)"550", (char*)"5.7.1", (char*)"unique connection ip address limit exceeded"); 1217 smfi_setreply(ctx, (char*)"550", (char*)"5.7.1", (char*)"unique connection ip address limit exceeded");
1219 return SMFIS_REJECT; 1218 return SMFIS_REJECT;