Changeset 144
- Timestamp:
- 04/14/06 19:48:36 (3 years ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/Jsmtpd-spf/src/org/jsmtpd/plugins/smtpExtensions/GreyList.java
r125 r144 55 55 */ 56 56 public class GreyList implements ISmtpExtension { 57 private Map<String,Date> greylist = Collections.synchronizedMap(new HashMap<String,Date>());58 private Map<String,Date> greenList = Collections.synchronizedMap(new HashMap<String,Date>());57 private Map<String,Date> greylist; 58 private Map<String,Date> greenList; 59 59 private Log log = LogFactory.getLog(GreyList.class); 60 60 private long greytime=30*1000; // Have to remain in gl for 30sec 61 61 private long greentime = 3600 * 1000; // Once in green list, stay for 1 hour. 62 62 private IACL acl; 63 private Set<String> bypassFrom=new HashSet<String>(); 63 64 64 65 public boolean smtpTrigger(String command, IProtocolHandler protocol) { … … 75 76 if (command==null) { 76 77 log.error("Null command, skipping..."); 77 return false; 78 return false;info 78 79 } 79 80 80 81 if (command.toLowerCase().contains("rcpt")) { 81 82 log.debug("rcpt command issued, checking..."); 83 String remoteHost= ((InetSocketAddress) protocol.getSock().getRemoteSocketAddress()).getAddress().getHostAddress(); 84 85 if (bypassFrom.contains(remoteHost)) { 86 log.debug("Bypassed from config : "+remoteHost); 87 return false; 88 } 82 89 if (protocol.isRelayed()) { 83 log. info("Protocol is marked relayed.");90 log.debug("Protocol is marked relayed."); 84 91 return false; 85 92 } 86 93 87 String remoteHost= ((InetSocketAddress) protocol.getSock().getRemoteSocketAddress()).getAddress().getHostAddress();94 88 95 if (acl.isValidRelay(remoteHost)) { 89 log. info("ACL said remote is to be relayed.");96 log.debug("ACL said remote is to be relayed."); 90 97 return false; 91 98 } … … 150 157 151 158 public void initPlugin() throws PluginInitException { 159 greylist=Collections.synchronizedMap(new HashMap<String,Date>()); 160 greenList=Collections.synchronizedMap(new HashMap<String,Date>()); 152 161 acl = PluginStore.getInstance().getAcl(); 153 162 if (acl==null) { … … 210 219 this.greytime = greytime; 211 220 } 212 213 221 222 public void setBypassFrom(Set<String> bypassFrom) { 223 this.bypassFrom = bypassFrom; 224 } 225 226 public void setBypass (String ip ) { 227 bypassFrom.add(ip); 228 } 214 229 }
