directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1041038 - in /directory/apacheds/branches/apacheds-kerberos-codec-2.0: kerberos-codec/ protocol-kerberos/ protocol-kerberos/src/main/java/org/apache/directory/server/kerberos/protocol/
Date Wed, 01 Dec 2010 15:01:54 GMT
Author: elecharny
Date: Wed Dec  1 15:01:54 2010
New Revision: 1041038

URL: http://svn.apache.org/viewvc?rev=1041038&view=rev
Log:
o Updated the pom to include the kerberos-codec in the build
o Injcted the kerberos-decoder into the kerberos protocol handler (it has compilation failures
atm)

Modified:
    directory/apacheds/branches/apacheds-kerberos-codec-2.0/kerberos-codec/pom.xml
    directory/apacheds/branches/apacheds-kerberos-codec-2.0/protocol-kerberos/pom.xml
    directory/apacheds/branches/apacheds-kerberos-codec-2.0/protocol-kerberos/src/main/java/org/apache/directory/server/kerberos/protocol/KerberosTcpDecoder.java
    directory/apacheds/branches/apacheds-kerberos-codec-2.0/protocol-kerberos/src/main/java/org/apache/directory/server/kerberos/protocol/KerberosUdpDecoder.java

Modified: directory/apacheds/branches/apacheds-kerberos-codec-2.0/kerberos-codec/pom.xml
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-kerberos-codec-2.0/kerberos-codec/pom.xml?rev=1041038&r1=1041037&r2=1041038&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-kerberos-codec-2.0/kerberos-codec/pom.xml (original)
+++ directory/apacheds/branches/apacheds-kerberos-codec-2.0/kerberos-codec/pom.xml Wed Dec
 1 15:01:54 2010
@@ -62,5 +62,23 @@
       <artifactId>shared-ldap</artifactId>
     </dependency>
   </dependencies>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-source-plugin</artifactId>
+        <executions>
+          <execution>
+            <id>attach-sources</id>
+            <phase>verify</phase>
+            <goals>
+              <goal>jar</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
 </project>
 

Modified: directory/apacheds/branches/apacheds-kerberos-codec-2.0/protocol-kerberos/pom.xml
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-kerberos-codec-2.0/protocol-kerberos/pom.xml?rev=1041038&r1=1041037&r2=1041038&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-kerberos-codec-2.0/protocol-kerberos/pom.xml (original)
+++ directory/apacheds/branches/apacheds-kerberos-codec-2.0/protocol-kerberos/pom.xml Wed
Dec  1 15:01:54 2010
@@ -54,6 +54,11 @@
 
     <dependency>
       <groupId>${project.groupId}</groupId>
+      <artifactId>apacheds-kerberos-codec</artifactId>
+    </dependency>
+
+    <dependency>
+      <groupId>${project.groupId}</groupId>
       <artifactId>apacheds-protocol-shared</artifactId>
     </dependency>
 

Modified: directory/apacheds/branches/apacheds-kerberos-codec-2.0/protocol-kerberos/src/main/java/org/apache/directory/server/kerberos/protocol/KerberosTcpDecoder.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-kerberos-codec-2.0/protocol-kerberos/src/main/java/org/apache/directory/server/kerberos/protocol/KerberosTcpDecoder.java?rev=1041038&r1=1041037&r2=1041038&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-kerberos-codec-2.0/protocol-kerberos/src/main/java/org/apache/directory/server/kerberos/protocol/KerberosTcpDecoder.java
(original)
+++ directory/apacheds/branches/apacheds-kerberos-codec-2.0/protocol-kerberos/src/main/java/org/apache/directory/server/kerberos/protocol/KerberosTcpDecoder.java
Wed Dec  1 15:01:54 2010
@@ -105,8 +105,6 @@ public class KerberosTcpDecoder extends 
         LdapMessageContainer messageContainer = ( LdapMessageContainer ) session
             .getAttribute( "messageContainer" );
         
-        
-        
         while ( buf.hasRemaining() )
         {
             try

Modified: directory/apacheds/branches/apacheds-kerberos-codec-2.0/protocol-kerberos/src/main/java/org/apache/directory/server/kerberos/protocol/KerberosUdpDecoder.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-kerberos-codec-2.0/protocol-kerberos/src/main/java/org/apache/directory/server/kerberos/protocol/KerberosUdpDecoder.java?rev=1041038&r1=1041037&r2=1041038&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-kerberos-codec-2.0/protocol-kerberos/src/main/java/org/apache/directory/server/kerberos/protocol/KerberosUdpDecoder.java
(original)
+++ directory/apacheds/branches/apacheds-kerberos-codec-2.0/protocol-kerberos/src/main/java/org/apache/directory/server/kerberos/protocol/KerberosUdpDecoder.java
Wed Dec  1 15:01:54 2010
@@ -21,12 +21,20 @@ package org.apache.directory.server.kerb
 
 
 import java.io.IOException;
+import java.nio.ByteBuffer;
 
 import org.apache.directory.server.kerberos.shared.io.decoder.KdcRequestDecoder;
+import org.apache.directory.shared.asn1.ber.Asn1Decoder;
+import org.apache.directory.shared.asn1.ber.tlv.TLVStateEnum;
+import org.apache.directory.shared.asn1.codec.DecoderException;
+import org.apache.directory.shared.kerberos.codec.KerberosMessageContainer;
+import org.apache.directory.shared.ldap.codec.LdapDecoder;
 import org.apache.mina.core.buffer.IoBuffer;
 import org.apache.mina.core.session.IoSession;
 import org.apache.mina.filter.codec.ProtocolDecoderAdapter;
 import org.apache.mina.filter.codec.ProtocolDecoderOutput;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 
 /**
@@ -34,11 +42,57 @@ import org.apache.mina.filter.codec.Prot
  */
 public class KerberosUdpDecoder extends ProtocolDecoderAdapter
 {
+    /** The logger */
+    private static Logger LOG = LoggerFactory.getLogger( LdapDecoder.class );
+
+    /** A speedup for logger */
+    private static final boolean IS_DEBUG = LOG.isDebugEnabled();
+
     private KdcRequestDecoder decoder = new KdcRequestDecoder();
 
+    /** The ASN 1 decoder instance */
+    private Asn1Decoder asn1Decoder = new Asn1Decoder();
 
     public void decode( IoSession session, IoBuffer in, ProtocolDecoderOutput out ) throws
IOException
     {
-        out.write( decoder.decode( in.buf() ) );
+        ByteBuffer buf = in.buf();
+        KerberosMessageContainer kerberosMessageContainer = ( KerberosMessageContainer )
session.getAttribute( "kerberosMessageContainer" );
+
+        if ( kerberosMessageContainer == null )
+        {
+            kerberosMessageContainer = new KerberosMessageContainer();
+            session.setAttribute( "kerberosMessageContainer", kerberosMessageContainer );
+            kerberosMessageContainer.setStream( buf );
+        }
+        
+        while ( buf.hasRemaining() )
+        {
+            try
+            {
+                asn1Decoder.decode( buf, kerberosMessageContainer );
+
+                if ( kerberosMessageContainer.getState() == TLVStateEnum.PDU_DECODED )
+                {
+                    if ( IS_DEBUG )
+                    {
+                        LOG.debug( "Decoded KerberosMessage : " + kerberosMessageContainer.getMessage()
);
+                        buf.mark();
+                    }
+        
+                    out.write( kerberosMessageContainer.getMessage() );
+        
+                    kerberosMessageContainer.clean();
+                }
+            }
+            catch ( DecoderException de )
+            {
+                buf.clear();
+                kerberosMessageContainer.clean();
+            }
+            catch ( Exception e )
+            {
+                e.printStackTrace();
+            }
+        }
     }
 }



Mime
View raw message