+ if (!graylist.isWhitelisted(conn.getRemoteAddress()) && !conn.getRemoteAddress().isLoopbackAddress()) {
+ long when = graylist.getGrayListTimestamp(conn.getRemoteAddress(), from+"", to+"");
+ if (when == 0 || System.currentTimeMillis() - when > GRAYLIST_MAXWAIT) {
+ graylist.setGrayListTimestamp(conn.getRemoteAddress(), from+"", to+"", System.currentTimeMillis());
+ conn.println("451 you are graylisted; please try back in one hour to be whitelisted");
+ Log.warn(conn.getRemoteAddress().toString(), "451 you are graylisted; please try back in one hour to be whitelisted");
+ conn.flush();
+ continue;
+ } else if (System.currentTimeMillis() - when > GRAYLIST_MINWAIT) {
+ graylist.addWhitelist(conn.getRemoteAddress());
+ conn.println("354 (you have been whitelisted) Enter message, ending with \".\" on a line by itself");
+ Log.warn(conn.getRemoteAddress().toString(), "has been whitelisted");
+ } else {
+ conn.println("451 you are still graylisted (since "+new java.util.Date(when)+")");
+ conn.flush();
+ Log.warn(conn.getRemoteAddress().toString(), "451 you are still graylisted (since "+new java.util.Date(when)+")");
+ continue;
+ }
+ } else {
+ conn.println("354 Enter message, ending with \".\" on a line by itself");
+ }