directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1039961 - in /directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec: actions/ adAndOr/ adKdcIssued/ apRep/ apRep/actions/ apReq/ apReq/actions/ asRep/ asRep/actions/ asReq/actions/ encApRepPart/ e...
Date Sun, 28 Nov 2010 22:12:02 GMT
Author: elecharny
Date: Sun Nov 28 22:12:01 2010
New Revision: 1039961

URL: http://svn.apache.org/viewvc?rev=1039961&view=rev
Log:
o Improved the way we use the AbstractReadMsgType in all the messages
o Fixed many problems in the containers hierarchy

Modified:
    directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/actions/AbstractReadMsgType.java
    directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/adAndOr/AdAndOrContainer.java
    directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/adKdcIssued/AdKdcIssuedContainer.java
    directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/apRep/ApRepContainer.java
    directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/apRep/actions/CheckMsgType.java
    directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/apReq/ApReqContainer.java
    directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/apReq/actions/CheckMsgType.java
    directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/asRep/AsRepContainer.java
    directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/asRep/actions/StoreKdcRep.java
    directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/asReq/actions/StoreKdcReq.java
    directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encApRepPart/EncApRepPartContainer.java
    directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encAsRepPart/EncAsRepPartContainer.java
    directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encTgsRepPart/EncTgsRepPartContainer.java
    directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/kdcRep/actions/CheckMsgType.java
    directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/kdcReq/actions/CheckMsgType.java
    directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/krbCred/actions/CheckMsgType.java
    directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/krbError/actions/CheckMsgType.java
    directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/krbPriv/actions/CheckMsgType.java
    directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/krbSafe/actions/CheckMsgType.java
    directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/paEncTsEnc/PaEncTsEncContainer.java
    directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/tgsRep/actions/StoreKdcRep.java
    directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/tgsReq/actions/StoreKdcReq.java

Modified: directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/actions/AbstractReadMsgType.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/actions/AbstractReadMsgType.java?rev=1039961&r1=1039960&r2=1039961&view=diff
==============================================================================
--- directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/actions/AbstractReadMsgType.java
(original)
+++ directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/actions/AbstractReadMsgType.java
Sun Nov 28 22:12:01 2010
@@ -29,6 +29,8 @@ import org.apache.directory.shared.asn1.
 import org.apache.directory.shared.asn1.util.IntegerDecoderException;
 import org.apache.directory.shared.i18n.I18n;
 import org.apache.directory.shared.kerberos.KerberosMessageType;
+import org.apache.directory.shared.kerberos.codec.kdcRep.KdcRepContainer;
+import org.apache.directory.shared.kerberos.codec.kdcReq.KdcReqContainer;
 import org.apache.directory.shared.ldap.util.StringTools;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -44,8 +46,8 @@ public abstract class AbstractReadMsgTyp
     /** The logger */
     private static final Logger LOG = LoggerFactory.getLogger( AbstractReadMsgType.class
);
 
-    /** Speedup for logs */
-    private static final boolean IS_DEBUG = LOG.isDebugEnabled();
+    /** The msgType to decode */
+    private KerberosMessageType msgType = null;
 
     /**
      * Instantiates a new StoreMsgType action.
@@ -57,13 +59,13 @@ public abstract class AbstractReadMsgTyp
 
     
     /**
-     * verifies whether the given message type is acceptable for the ASN.1 object type
-     * present in the container
-     * 
-     * @param krbMsgType the message type
-     * @throws DecoderException if the message type is not acceptable for the ASN.1 object
present in the container
+     * Instantiates a new StoreMsgType action.
      */
-    protected abstract void verifyMsgType( KerberosMessageType krbMsgType, Asn1Container
container ) throws DecoderException;
+    public AbstractReadMsgType( String name, KerberosMessageType msgType )
+    {
+        super( name );
+        this.msgType = msgType;
+    }
 
     
     /**
@@ -86,15 +88,48 @@ public abstract class AbstractReadMsgTyp
 
         try
         {
-            int msgType = IntegerDecoder.parse( value );
-            KerberosMessageType krbMsgType = KerberosMessageType.getTypeByValue( msgType
);
+            int msgTypeValue = IntegerDecoder.parse( value );
+            
+            if ( msgType != null )
+            {
+                if ( msgType.getValue() == msgTypeValue )
+                {
+                    LOG.debug( "msg-type : {}", msgType );
+                    
+                    return;
+                }
+
+                String message = I18n.err( I18n.ERR_04070, StringTools.dumpBytes( value.getData()
) );
+                LOG.error( message );
 
-            if ( IS_DEBUG )
+                // This will generate a PROTOCOL_ERROR
+                throw new DecoderException( message );
+            }
+            else
             {
-                LOG.debug( "msg-type : {}", krbMsgType );
+                KerberosMessageType messageType = KerberosMessageType.getTypeByValue( msgTypeValue
);
+                
+                if ( container instanceof KdcReqContainer )
+                {
+                    if ( ((KdcReqContainer)container).getKdcReq().getMessageType() == messageType
)
+                    {
+                        return;
+                    }
+                }
+                else if ( container instanceof KdcRepContainer )
+                {
+                    if ( ((KdcRepContainer)container).getKdcRep().getMessageType() == messageType
)
+                    {
+                        return;
+                    }
+                }
+                
+                String message = I18n.err( I18n.ERR_04070, StringTools.dumpBytes( value.getData()
) );
+                LOG.error( message );
+
+                // This will generate a PROTOCOL_ERROR
+                throw new DecoderException( message );
             }
-            
-            verifyMsgType( krbMsgType, container );
         }
         catch ( IntegerDecoderException ide )
         {

Modified: directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/adAndOr/AdAndOrContainer.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/adAndOr/AdAndOrContainer.java?rev=1039961&r1=1039960&r2=1039961&view=diff
==============================================================================
--- directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/adAndOr/AdAndOrContainer.java
(original)
+++ directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/adAndOr/AdAndOrContainer.java
Sun Nov 28 22:12:01 2010
@@ -19,7 +19,7 @@
  */
 package org.apache.directory.shared.kerberos.codec.adAndOr;
 
-import org.apache.directory.shared.kerberos.codec.kdcReq.KdcReqContainer;
+import org.apache.directory.shared.asn1.ber.AbstractContainer;
 import org.apache.directory.shared.kerberos.components.AdAndOr;
 
 
@@ -28,7 +28,7 @@ import org.apache.directory.shared.kerbe
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class AdAndOrContainer extends KdcReqContainer
+public class AdAndOrContainer extends AbstractContainer
 {
     /** An AD-AND-OR container */
     private AdAndOr adAndOr = new AdAndOr();

Modified: directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/adKdcIssued/AdKdcIssuedContainer.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/adKdcIssued/AdKdcIssuedContainer.java?rev=1039961&r1=1039960&r2=1039961&view=diff
==============================================================================
--- directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/adKdcIssued/AdKdcIssuedContainer.java
(original)
+++ directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/adKdcIssued/AdKdcIssuedContainer.java
Sun Nov 28 22:12:01 2010
@@ -19,7 +19,7 @@
  */
 package org.apache.directory.shared.kerberos.codec.adKdcIssued;
 
-import org.apache.directory.shared.kerberos.codec.kdcReq.KdcReqContainer;
+import org.apache.directory.shared.asn1.ber.AbstractContainer;
 import org.apache.directory.shared.kerberos.components.AdKdcIssued;
 
 
@@ -28,7 +28,7 @@ import org.apache.directory.shared.kerbe
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class AdKdcIssuedContainer extends KdcReqContainer
+public class AdKdcIssuedContainer extends AbstractContainer
 {
     /** An AdKdcIssued container */
     private AdKdcIssued adKdcIssued = new AdKdcIssued();

Modified: directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/apRep/ApRepContainer.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/apRep/ApRepContainer.java?rev=1039961&r1=1039960&r2=1039961&view=diff
==============================================================================
--- directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/apRep/ApRepContainer.java
(original)
+++ directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/apRep/ApRepContainer.java
Sun Nov 28 22:12:01 2010
@@ -19,7 +19,7 @@
  */
 package org.apache.directory.shared.kerberos.codec.apRep;
 
-import org.apache.directory.shared.kerberos.codec.kdcReq.KdcReqContainer;
+import org.apache.directory.shared.asn1.ber.AbstractContainer;
 import org.apache.directory.shared.kerberos.messages.ApRep;
 
 
@@ -28,7 +28,7 @@ import org.apache.directory.shared.kerbe
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class ApRepContainer extends KdcReqContainer
+public class ApRepContainer extends AbstractContainer
 {
     /** An AP-REP container */
     private ApRep apRep;

Modified: directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/apRep/actions/CheckMsgType.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/apRep/actions/CheckMsgType.java?rev=1039961&r1=1039960&r2=1039961&view=diff
==============================================================================
--- directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/apRep/actions/CheckMsgType.java
(original)
+++ directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/apRep/actions/CheckMsgType.java
Sun Nov 28 22:12:01 2010
@@ -20,52 +20,22 @@
 package org.apache.directory.shared.kerberos.codec.apRep.actions;
 
 
-import org.apache.directory.shared.asn1.ber.Asn1Container;
-import org.apache.directory.shared.asn1.codec.DecoderException;
-import org.apache.directory.shared.i18n.I18n;
 import org.apache.directory.shared.kerberos.KerberosMessageType;
 import org.apache.directory.shared.kerberos.codec.actions.AbstractReadMsgType;
-import org.apache.directory.shared.kerberos.codec.apRep.ApRepContainer;
-import org.apache.directory.shared.kerberos.messages.ApRep;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 
 /**
- * The action used to store the msg-type
+ * The action used to store the AP-REP msg-type
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
 public class CheckMsgType extends AbstractReadMsgType
 {
-    /** The logger */
-    private static final Logger LOG = LoggerFactory.getLogger( CheckMsgType.class );
-
     /**
      * Instantiates a new CheckMsgType action.
      */
     public CheckMsgType()
     {
-        super( "AP-REP msg-type" );
-    }
-
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    protected void verifyMsgType( KerberosMessageType krbMsgType, Asn1Container container
) throws DecoderException
-    {
-        ApRepContainer apRepContainer = ( ApRepContainer ) container;
-        ApRep apRep = apRepContainer.getApRep();
-
-        // The message type must be the expected one
-        if ( krbMsgType != apRep.getMessageType() )
-        {
-            LOG.error( I18n.err( I18n.ERR_04070, krbMsgType, "The msg-type should be AP-REP"
) );
-
-            // This will generate a PROTOCOL_ERROR
-            throw new DecoderException( "The msg-type should be AP-REP" );
-        }
+        super( "AP-REP msg-type", KerberosMessageType.AP_REP );
     }
 }

Modified: directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/apReq/ApReqContainer.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/apReq/ApReqContainer.java?rev=1039961&r1=1039960&r2=1039961&view=diff
==============================================================================
--- directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/apReq/ApReqContainer.java
(original)
+++ directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/apReq/ApReqContainer.java
Sun Nov 28 22:12:01 2010
@@ -19,7 +19,7 @@
  */
 package org.apache.directory.shared.kerberos.codec.apReq;
 
-import org.apache.directory.shared.kerberos.codec.kdcReq.KdcReqContainer;
+import org.apache.directory.shared.asn1.ber.AbstractContainer;
 import org.apache.directory.shared.kerberos.messages.ApReq;
 
 
@@ -28,7 +28,7 @@ import org.apache.directory.shared.kerbe
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class ApReqContainer extends KdcReqContainer
+public class ApReqContainer extends AbstractContainer
 {
     /** An AP-REQ container */
     private ApReq apReq;

Modified: directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/apReq/actions/CheckMsgType.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/apReq/actions/CheckMsgType.java?rev=1039961&r1=1039960&r2=1039961&view=diff
==============================================================================
--- directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/apReq/actions/CheckMsgType.java
(original)
+++ directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/apReq/actions/CheckMsgType.java
Sun Nov 28 22:12:01 2010
@@ -20,52 +20,22 @@
 package org.apache.directory.shared.kerberos.codec.apReq.actions;
 
 
-import org.apache.directory.shared.asn1.ber.Asn1Container;
-import org.apache.directory.shared.asn1.codec.DecoderException;
-import org.apache.directory.shared.i18n.I18n;
 import org.apache.directory.shared.kerberos.KerberosMessageType;
 import org.apache.directory.shared.kerberos.codec.actions.AbstractReadMsgType;
-import org.apache.directory.shared.kerberos.codec.apReq.ApReqContainer;
-import org.apache.directory.shared.kerberos.messages.ApReq;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 
 /**
- * The action used to store the msg-type
+ * The action used to store the AP-REQ msg-type
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
 public class CheckMsgType extends AbstractReadMsgType
 {
-    /** The logger */
-    private static final Logger LOG = LoggerFactory.getLogger( CheckMsgType.class );
-
     /**
      * Instantiates a new CheckMsgType action.
      */
     public CheckMsgType()
     {
-        super( "AP-REQ msg-type" );
-    }
-
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    protected void verifyMsgType( KerberosMessageType krbMsgType, Asn1Container container
) throws DecoderException
-    {
-        ApReqContainer apReqContainer = ( ApReqContainer ) container;
-        ApReq apReq = apReqContainer.getApReq();
-
-        // The message type must be the expected one
-        if ( krbMsgType != apReq.getMessageType() )
-        {
-            LOG.error( I18n.err( I18n.ERR_04070, krbMsgType, "The msg-type should be AP-REQ"
) );
-
-            // This will generate a PROTOCOL_ERROR
-            throw new DecoderException( "The msg-type should be AP-REQ" );
-        }
+        super( "AP-REQ msg-type", KerberosMessageType.AP_REQ );
     }
 }

Modified: directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/asRep/AsRepContainer.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/asRep/AsRepContainer.java?rev=1039961&r1=1039960&r2=1039961&view=diff
==============================================================================
--- directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/asRep/AsRepContainer.java
(original)
+++ directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/asRep/AsRepContainer.java
Sun Nov 28 22:12:01 2010
@@ -19,7 +19,7 @@
  */
 package org.apache.directory.shared.kerberos.codec.asRep;
 
-import org.apache.directory.shared.kerberos.codec.kdcReq.KdcReqContainer;
+import org.apache.directory.shared.kerberos.codec.kdcRep.KdcRepContainer;
 import org.apache.directory.shared.kerberos.messages.AsRep;
 
 
@@ -28,7 +28,7 @@ import org.apache.directory.shared.kerbe
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class AsRepContainer extends KdcReqContainer
+public class AsRepContainer extends KdcRepContainer
 {
     /** An AS-REP container */
     private AsRep asRep;

Modified: directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/asRep/actions/StoreKdcRep.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/asRep/actions/StoreKdcRep.java?rev=1039961&r1=1039960&r2=1039961&view=diff
==============================================================================
--- directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/asRep/actions/StoreKdcRep.java
(original)
+++ directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/asRep/actions/StoreKdcRep.java
Sun Nov 28 22:12:01 2010
@@ -26,6 +26,7 @@ import org.apache.directory.shared.asn1.
 import org.apache.directory.shared.asn1.ber.tlv.TLV;
 import org.apache.directory.shared.asn1.codec.DecoderException;
 import org.apache.directory.shared.i18n.I18n;
+import org.apache.directory.shared.kerberos.KerberosMessageType;
 import org.apache.directory.shared.kerberos.codec.KerberosMessageGrammar;
 import org.apache.directory.shared.kerberos.codec.asRep.AsRepContainer;
 import org.apache.directory.shared.kerberos.codec.kdcRep.KdcRepContainer;
@@ -101,6 +102,11 @@ public class StoreKdcRep extends Grammar
         // Update the parent
         container.updateParent();
         
+        if ( asRep.getMessageType() != KerberosMessageType.AS_REP )
+        {
+            throw new DecoderException( "Bad message type" );
+        }
+        
         asRepContainer.setAsRep( asRep );
 
         if ( IS_DEBUG )

Modified: directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/asReq/actions/StoreKdcReq.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/asReq/actions/StoreKdcReq.java?rev=1039961&r1=1039960&r2=1039961&view=diff
==============================================================================
--- directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/asReq/actions/StoreKdcReq.java
(original)
+++ directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/asReq/actions/StoreKdcReq.java
Sun Nov 28 22:12:01 2010
@@ -26,6 +26,7 @@ import org.apache.directory.shared.asn1.
 import org.apache.directory.shared.asn1.ber.tlv.TLV;
 import org.apache.directory.shared.asn1.codec.DecoderException;
 import org.apache.directory.shared.i18n.I18n;
+import org.apache.directory.shared.kerberos.KerberosMessageType;
 import org.apache.directory.shared.kerberos.codec.KerberosMessageGrammar;
 import org.apache.directory.shared.kerberos.codec.asReq.AsReqContainer;
 import org.apache.directory.shared.kerberos.codec.kdcReq.KdcReqContainer;
@@ -101,6 +102,11 @@ public class StoreKdcReq extends Grammar
         // Update the parent
         container.updateParent();
         
+        if ( asReq.getMessageType() != KerberosMessageType.AS_REQ )
+        {
+            throw new DecoderException( "Bad message type" );
+        }
+        
         asReqContainer.setAsReq( asReq );
 
         if ( IS_DEBUG )

Modified: directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encApRepPart/EncApRepPartContainer.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encApRepPart/EncApRepPartContainer.java?rev=1039961&r1=1039960&r2=1039961&view=diff
==============================================================================
--- directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encApRepPart/EncApRepPartContainer.java
(original)
+++ directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encApRepPart/EncApRepPartContainer.java
Sun Nov 28 22:12:01 2010
@@ -19,7 +19,7 @@
  */
 package org.apache.directory.shared.kerberos.codec.encApRepPart;
 
-import org.apache.directory.shared.kerberos.codec.kdcReq.KdcReqContainer;
+import org.apache.directory.shared.asn1.ber.AbstractContainer;
 import org.apache.directory.shared.kerberos.messages.EncApRepPart;
 
 
@@ -28,7 +28,7 @@ import org.apache.directory.shared.kerbe
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class EncApRepPartContainer extends KdcReqContainer
+public class EncApRepPartContainer extends AbstractContainer
 {
     /** An EncApRepPart container */
     private EncApRepPart encApRepPart = new EncApRepPart();

Modified: directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encAsRepPart/EncAsRepPartContainer.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encAsRepPart/EncAsRepPartContainer.java?rev=1039961&r1=1039960&r2=1039961&view=diff
==============================================================================
--- directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encAsRepPart/EncAsRepPartContainer.java
(original)
+++ directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encAsRepPart/EncAsRepPartContainer.java
Sun Nov 28 22:12:01 2010
@@ -19,7 +19,7 @@
  */
 package org.apache.directory.shared.kerberos.codec.encAsRepPart;
 
-import org.apache.directory.shared.kerberos.codec.kdcReq.KdcReqContainer;
+import org.apache.directory.shared.asn1.ber.AbstractContainer;
 import org.apache.directory.shared.kerberos.messages.EncAsRepPart;
 
 
@@ -28,7 +28,7 @@ import org.apache.directory.shared.kerbe
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class EncAsRepPartContainer extends KdcReqContainer
+public class EncAsRepPartContainer extends AbstractContainer
 {
     /** An EncAsRepPart container */
     private EncAsRepPart encAsRepPart = new EncAsRepPart();

Modified: directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encTgsRepPart/EncTgsRepPartContainer.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encTgsRepPart/EncTgsRepPartContainer.java?rev=1039961&r1=1039960&r2=1039961&view=diff
==============================================================================
--- directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encTgsRepPart/EncTgsRepPartContainer.java
(original)
+++ directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encTgsRepPart/EncTgsRepPartContainer.java
Sun Nov 28 22:12:01 2010
@@ -19,7 +19,7 @@
  */
 package org.apache.directory.shared.kerberos.codec.encTgsRepPart;
 
-import org.apache.directory.shared.kerberos.codec.kdcReq.KdcReqContainer;
+import org.apache.directory.shared.asn1.ber.AbstractContainer;
 import org.apache.directory.shared.kerberos.messages.EncTgsRepPart;
 
 
@@ -28,7 +28,7 @@ import org.apache.directory.shared.kerbe
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class EncTgsRepPartContainer extends KdcReqContainer
+public class EncTgsRepPartContainer extends AbstractContainer
 {
     /** An EncTgsRepPart container */
     private EncTgsRepPart encTgsRepPart = new EncTgsRepPart();

Modified: directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/kdcRep/actions/CheckMsgType.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/kdcRep/actions/CheckMsgType.java?rev=1039961&r1=1039960&r2=1039961&view=diff
==============================================================================
--- directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/kdcRep/actions/CheckMsgType.java
(original)
+++ directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/kdcRep/actions/CheckMsgType.java
Sun Nov 28 22:12:01 2010
@@ -20,27 +20,16 @@
 package org.apache.directory.shared.kerberos.codec.kdcRep.actions;
 
 
-import org.apache.directory.shared.asn1.ber.Asn1Container;
-import org.apache.directory.shared.asn1.codec.DecoderException;
-import org.apache.directory.shared.i18n.I18n;
-import org.apache.directory.shared.kerberos.KerberosMessageType;
 import org.apache.directory.shared.kerberos.codec.actions.AbstractReadMsgType;
-import org.apache.directory.shared.kerberos.codec.kdcRep.KdcRepContainer;
-import org.apache.directory.shared.kerberos.components.KdcRep;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 
 /**
- * The action used to store the msg-type
+ * The action used to store the KDC-REP msg-type
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
 public class CheckMsgType extends AbstractReadMsgType
 {
-    /** The logger */
-    private static final Logger LOG = LoggerFactory.getLogger( CheckMsgType.class );
-
     /**
      * Instantiates a new CheckMsgType action.
      */
@@ -48,24 +37,4 @@ public class CheckMsgType extends Abstra
     {
         super( "KDC-REP msg-type" );
     }
-
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    protected void verifyMsgType( KerberosMessageType krbMsgType, Asn1Container container
) throws DecoderException
-    {
-        KdcRepContainer kdcRepContainer = ( KdcRepContainer ) container;
-        KdcRep kdcRep = kdcRepContainer.getKdcRep();
-
-        // The message type must be the expected one
-        if ( krbMsgType != kdcRep.getMessageType() )
-        {
-            LOG.error( I18n.err( I18n.ERR_04070, krbMsgType, "The msg-type should be AS-REQ
or TGS-REQ" ) );
-
-            // This will generate a PROTOCOL_ERROR
-            throw new DecoderException( "The msg-type should be AS-REQ or TGS-REQ" );
-        }
-    }
 }

Modified: directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/kdcReq/actions/CheckMsgType.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/kdcReq/actions/CheckMsgType.java?rev=1039961&r1=1039960&r2=1039961&view=diff
==============================================================================
--- directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/kdcReq/actions/CheckMsgType.java
(original)
+++ directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/kdcReq/actions/CheckMsgType.java
Sun Nov 28 22:12:01 2010
@@ -20,54 +20,21 @@
 package org.apache.directory.shared.kerberos.codec.kdcReq.actions;
 
 
-import org.apache.directory.shared.asn1.ber.Asn1Container;
-import org.apache.directory.shared.asn1.codec.DecoderException;
-import org.apache.directory.shared.i18n.I18n;
-import org.apache.directory.shared.kerberos.KerberosMessageType;
 import org.apache.directory.shared.kerberos.codec.actions.AbstractReadMsgType;
-import org.apache.directory.shared.kerberos.codec.kdcReq.KdcReqContainer;
-import org.apache.directory.shared.kerberos.components.KdcReq;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 
 /**
- * The action used to store the msg-type
+ * The action used to store the KDC-REQ msg-type
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
 public class CheckMsgType extends AbstractReadMsgType
 {
-    /** The logger */
-    private static final Logger LOG = LoggerFactory.getLogger( CheckMsgType.class );
-
-
     /**
-     * Instantiates a new StoreMsgType action.
+     * Instantiates a new CheckMsgType action.
      */
     public CheckMsgType()
     {
         super( "KDC-REQ msg-type" );
     }
-
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    protected void verifyMsgType( KerberosMessageType krbMsgType, Asn1Container container
) throws DecoderException
-    {
-        KdcReqContainer kdcReqContainer = ( KdcReqContainer ) container;
-
-        KdcReq kdcReq = kdcReqContainer.getKdcReq();
-
-        // The message type must be the expected one
-        if ( krbMsgType != kdcReq.getMessageType() )
-        {
-            LOG.error( I18n.err( I18n.ERR_04070, krbMsgType, "The msg-type should be AS-REQ
or TGS-REQ" ) );
-
-            // This will generate a PROTOCOL_ERROR
-            throw new DecoderException( "The msg-type should be AS-REQ or TGS-REQ" );
-        }
-    }
 }

Modified: directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/krbCred/actions/CheckMsgType.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/krbCred/actions/CheckMsgType.java?rev=1039961&r1=1039960&r2=1039961&view=diff
==============================================================================
--- directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/krbCred/actions/CheckMsgType.java
(original)
+++ directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/krbCred/actions/CheckMsgType.java
Sun Nov 28 22:12:01 2010
@@ -20,49 +20,22 @@
 package org.apache.directory.shared.kerberos.codec.krbCred.actions;
 
 
-import org.apache.directory.shared.asn1.ber.Asn1Container;
-import org.apache.directory.shared.asn1.codec.DecoderException;
-import org.apache.directory.shared.i18n.I18n;
 import org.apache.directory.shared.kerberos.KerberosMessageType;
 import org.apache.directory.shared.kerberos.codec.actions.AbstractReadMsgType;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 
 /**
- * The action used to check the msg-type
+ * The action used to check the KRB-CRED msg-type
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
 public class CheckMsgType extends AbstractReadMsgType
 {
-    /** The logger */
-    private static final Logger LOG = LoggerFactory.getLogger( CheckMsgType.class );
-
-
     /**
      * Instantiates a new CheckMsgType action.
      */
     public CheckMsgType()
     {
-        super( "KRB-CRED msg-type" );
-    }
-
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    protected void verifyMsgType( KerberosMessageType krbMsgType, Asn1Container container
) throws DecoderException
-    {
-        // The message type must be the expected one
-        if ( krbMsgType != KerberosMessageType.KRB_CRED )
-        {
-            String msg = "The msg-type should be KRB-CRED";
-            LOG.error( I18n.err( I18n.ERR_04070, krbMsgType, msg ) );
-
-            // This will generate a PROTOCOL_ERROR
-            throw new DecoderException( msg );
-        }
+        super( "KRB-CRED msg-type", KerberosMessageType.KRB_CRED );
     }
-}
+}
\ No newline at end of file

Modified: directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/krbError/actions/CheckMsgType.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/krbError/actions/CheckMsgType.java?rev=1039961&r1=1039960&r2=1039961&view=diff
==============================================================================
--- directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/krbError/actions/CheckMsgType.java
(original)
+++ directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/krbError/actions/CheckMsgType.java
Sun Nov 28 22:12:01 2010
@@ -20,49 +20,22 @@
 package org.apache.directory.shared.kerberos.codec.krbError.actions;
 
 
-import org.apache.directory.shared.asn1.ber.Asn1Container;
-import org.apache.directory.shared.asn1.codec.DecoderException;
-import org.apache.directory.shared.i18n.I18n;
 import org.apache.directory.shared.kerberos.KerberosMessageType;
 import org.apache.directory.shared.kerberos.codec.actions.AbstractReadMsgType;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 
 /**
- * The action used to store the msg-type
+ * The action used to check the KRB-ERROR msg-type
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
 public class CheckMsgType extends AbstractReadMsgType
 {
-    /** The logger */
-    private static final Logger LOG = LoggerFactory.getLogger( CheckMsgType.class );
-
-
     /**
-     * Instantiates a new StoreMsgType action.
+     * Instantiates a new CheckMsgType action.
      */
     public CheckMsgType()
     {
-        super( "KRB-ERROR msg-type" );
-    }
-
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    protected void verifyMsgType( KerberosMessageType krbMsgType, Asn1Container container
) throws DecoderException
-    {
-        // The message type must be the expected one
-        if ( krbMsgType != KerberosMessageType.KRB_ERROR )
-        {
-            String msg = "The msg-type should be KRB-ERROR";
-            LOG.error( I18n.err( I18n.ERR_04070, krbMsgType, msg ) );
-
-            // This will generate a PROTOCOL_ERROR
-            throw new DecoderException( msg );
-        }
+        super( "KRB-ERROR msg-type", KerberosMessageType.KRB_ERROR );
     }
 }

Modified: directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/krbPriv/actions/CheckMsgType.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/krbPriv/actions/CheckMsgType.java?rev=1039961&r1=1039960&r2=1039961&view=diff
==============================================================================
--- directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/krbPriv/actions/CheckMsgType.java
(original)
+++ directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/krbPriv/actions/CheckMsgType.java
Sun Nov 28 22:12:01 2010
@@ -20,49 +20,22 @@
 package org.apache.directory.shared.kerberos.codec.krbPriv.actions;
 
 
-import org.apache.directory.shared.asn1.ber.Asn1Container;
-import org.apache.directory.shared.asn1.codec.DecoderException;
-import org.apache.directory.shared.i18n.I18n;
 import org.apache.directory.shared.kerberos.KerberosMessageType;
 import org.apache.directory.shared.kerberos.codec.actions.AbstractReadMsgType;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 
 /**
- * The action used to store the msg-type
+ * The action used to check the KRB-PRIV msg-type
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
 public class CheckMsgType extends AbstractReadMsgType
 {
-    /** The logger */
-    private static final Logger LOG = LoggerFactory.getLogger( CheckMsgType.class );
-
-
     /**
      * Instantiates a new CheckMsgType action.
      */
     public CheckMsgType()
     {
-        super( "KRB-PRIV msg-type" );
-    }
-
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    protected void verifyMsgType( KerberosMessageType krbMsgType, Asn1Container container
) throws DecoderException
-    {
-        // The message type must be the expected one
-        if ( krbMsgType != KerberosMessageType.KRB_PRIV )
-        {
-            String msg = "The msg-type should be KRB-PRIV";
-            LOG.error( I18n.err( I18n.ERR_04070, krbMsgType, msg ) );
-
-            // This will generate a PROTOCOL_ERROR
-            throw new DecoderException( msg );
-        }
+        super( "KRB-PRIV msg-type", KerberosMessageType.KRB_PRIV );
     }
 }

Modified: directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/krbSafe/actions/CheckMsgType.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/krbSafe/actions/CheckMsgType.java?rev=1039961&r1=1039960&r2=1039961&view=diff
==============================================================================
--- directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/krbSafe/actions/CheckMsgType.java
(original)
+++ directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/krbSafe/actions/CheckMsgType.java
Sun Nov 28 22:12:01 2010
@@ -20,49 +20,22 @@
 package org.apache.directory.shared.kerberos.codec.krbSafe.actions;
 
 
-import org.apache.directory.shared.asn1.ber.Asn1Container;
-import org.apache.directory.shared.asn1.codec.DecoderException;
-import org.apache.directory.shared.i18n.I18n;
 import org.apache.directory.shared.kerberos.KerberosMessageType;
 import org.apache.directory.shared.kerberos.codec.actions.AbstractReadMsgType;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 
 /**
- * The action used to store the msg-type
+ * The action used to check the KRB-SAFE msg-type
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
 public class CheckMsgType extends AbstractReadMsgType
 {
-    /** The logger */
-    private static final Logger LOG = LoggerFactory.getLogger( CheckMsgType.class );
-
-
     /**
      * Instantiates a new CheckMsgType action.
      */
     public CheckMsgType()
     {
-        super( "KRB-SAFE msg-type" );
-    }
-
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    protected void verifyMsgType( KerberosMessageType krbMsgType, Asn1Container container
) throws DecoderException
-    {
-        // The message type must be the expected one
-        if ( krbMsgType != KerberosMessageType.KRB_SAFE )
-        {
-            String msg = "The msg-type should be KRB-SAFE";
-            LOG.error( I18n.err( I18n.ERR_04070, krbMsgType, msg ) );
-
-            // This will generate a PROTOCOL_ERROR
-            throw new DecoderException( msg );
-        }
+        super( "KRB-SAFE msg-type", KerberosMessageType.KRB_SAFE );
     }
 }

Modified: directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/paEncTsEnc/PaEncTsEncContainer.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/paEncTsEnc/PaEncTsEncContainer.java?rev=1039961&r1=1039960&r2=1039961&view=diff
==============================================================================
--- directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/paEncTsEnc/PaEncTsEncContainer.java
(original)
+++ directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/paEncTsEnc/PaEncTsEncContainer.java
Sun Nov 28 22:12:01 2010
@@ -19,7 +19,7 @@
  */
 package org.apache.directory.shared.kerberos.codec.paEncTsEnc;
 
-import org.apache.directory.shared.kerberos.codec.kdcReq.KdcReqContainer;
+import org.apache.directory.shared.asn1.ber.AbstractContainer;
 import org.apache.directory.shared.kerberos.components.PaEncTsEnc;
 
 
@@ -28,7 +28,7 @@ import org.apache.directory.shared.kerbe
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class PaEncTsEncContainer extends KdcReqContainer
+public class PaEncTsEncContainer extends AbstractContainer
 {
     /** An PA-ENC-TS-ENC container */
     private PaEncTsEnc paEncTsEnc = new PaEncTsEnc();

Modified: directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/tgsRep/actions/StoreKdcRep.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/tgsRep/actions/StoreKdcRep.java?rev=1039961&r1=1039960&r2=1039961&view=diff
==============================================================================
--- directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/tgsRep/actions/StoreKdcRep.java
(original)
+++ directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/tgsRep/actions/StoreKdcRep.java
Sun Nov 28 22:12:01 2010
@@ -26,6 +26,7 @@ import org.apache.directory.shared.asn1.
 import org.apache.directory.shared.asn1.ber.tlv.TLV;
 import org.apache.directory.shared.asn1.codec.DecoderException;
 import org.apache.directory.shared.i18n.I18n;
+import org.apache.directory.shared.kerberos.KerberosMessageType;
 import org.apache.directory.shared.kerberos.codec.KerberosMessageGrammar;
 import org.apache.directory.shared.kerberos.codec.kdcRep.KdcRepContainer;
 import org.apache.directory.shared.kerberos.codec.tgsRep.TgsRepContainer;
@@ -101,6 +102,12 @@ public class StoreKdcRep extends Grammar
         // Update the parent
         container.updateParent();
         
+        if ( tgsRep.getMessageType() != KerberosMessageType.TGS_REP )
+        {
+            throw new DecoderException( "Bad message type" );
+        }
+        
+
         tgsRepContainer.setTgsRep( tgsRep );
 
         if ( IS_DEBUG )

Modified: directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/tgsReq/actions/StoreKdcReq.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/tgsReq/actions/StoreKdcReq.java?rev=1039961&r1=1039960&r2=1039961&view=diff
==============================================================================
--- directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/tgsReq/actions/StoreKdcReq.java
(original)
+++ directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/tgsReq/actions/StoreKdcReq.java
Sun Nov 28 22:12:01 2010
@@ -26,6 +26,7 @@ import org.apache.directory.shared.asn1.
 import org.apache.directory.shared.asn1.ber.tlv.TLV;
 import org.apache.directory.shared.asn1.codec.DecoderException;
 import org.apache.directory.shared.i18n.I18n;
+import org.apache.directory.shared.kerberos.KerberosMessageType;
 import org.apache.directory.shared.kerberos.codec.KerberosMessageGrammar;
 import org.apache.directory.shared.kerberos.codec.kdcReq.KdcReqContainer;
 import org.apache.directory.shared.kerberos.codec.tgsReq.TgsReqContainer;
@@ -101,6 +102,11 @@ public class StoreKdcReq extends Grammar
         // Update the parent
         container.updateParent();
         
+        if ( tgsReq.getMessageType() != KerberosMessageType.TGS_REQ )
+        {
+            throw new DecoderException( "Bad message type" );
+        }
+        
         tgsReqContainer.setTgsReq( tgsReq );
 
         if ( IS_DEBUG )



Mime
View raw message