directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From trus...@apache.org
Subject svn commit: r332734 - /directory/network/trunk/src/java/org/apache/mina/filter/BlacklistFilter.java
Date Sat, 12 Nov 2005 05:39:31 GMT
Author: trustin
Date: Fri Nov 11 21:39:24 2005
New Revision: 332734

URL: http://svn.apache.org/viewcvs?rev=332734&view=rev
Log:
Made BlacklistFilter to block all possible events to be more secure as Niklas Therning suggested

Modified:
    directory/network/trunk/src/java/org/apache/mina/filter/BlacklistFilter.java

Modified: directory/network/trunk/src/java/org/apache/mina/filter/BlacklistFilter.java
URL: http://svn.apache.org/viewcvs/directory/network/trunk/src/java/org/apache/mina/filter/BlacklistFilter.java?rev=332734&r1=332733&r2=332734&view=diff
==============================================================================
--- directory/network/trunk/src/java/org/apache/mina/filter/BlacklistFilter.java (original)
+++ directory/network/trunk/src/java/org/apache/mina/filter/BlacklistFilter.java Fri Nov 11
21:39:24 2005
@@ -24,6 +24,7 @@
 import java.util.HashSet;
 import java.util.Set;
 
+import org.apache.mina.common.IdleStatus;
 import org.apache.mina.common.IoFilter;
 import org.apache.mina.common.IoFilterAdapter;
 import org.apache.mina.common.IoSession;
@@ -69,12 +70,64 @@
         }
     }
     
+    public void sessionOpened( NextFilter nextFilter, IoSession session ) throws Exception
+    {
+        if( !isBlocked( session ) )
+        {
+            // forward if not blocked
+            nextFilter.sessionOpened( session );
+        }
+        else
+        {
+            blockSession( session );
+        }
+    }
+
+    public void sessionClosed( NextFilter nextFilter, IoSession session ) throws Exception
+    {
+        if( !isBlocked( session ) )
+        {
+            // forward if not blocked
+            nextFilter.sessionClosed( session );
+        }
+        else
+        {
+            blockSession( session );
+        }
+    }
+
+    public void sessionIdle( NextFilter nextFilter, IoSession session, IdleStatus status
) throws Exception
+    {
+        if( !isBlocked( session ) )
+        {
+            // forward if not blocked
+            nextFilter.sessionIdle( session, status );
+        }
+        else
+        {
+            blockSession( session );
+        }
+    }
+
     public void messageReceived( NextFilter nextFilter, IoSession session, Object message
)
     {
         if( !isBlocked( session ) )
         {
             // forward if not blocked
             nextFilter.messageReceived( session, message );
+        }
+        else
+        {
+            blockSession( session );
+        }
+    }
+
+    public void messageSent( NextFilter nextFilter, IoSession session, Object message ) throws
Exception
+    {
+        if( !isBlocked( session ) )
+        {
+            // forward if not blocked
+            nextFilter.messageSent( session, message );
         }
         else
         {



Mime
View raw message