directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1043481 - in /directory/apacheds/branches/apacheds-kerberos-codec-2.0/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos: components/ messages/
Date Wed, 08 Dec 2010 16:13:16 GMT
Author: elecharny
Date: Wed Dec  8 16:13:15 2010
New Revision: 1043481

URL: http://svn.apache.org/viewvc?rev=1043481&view=rev
Log:
o Fixed some initialization issues in the computeLength() method

Modified:
    directory/apacheds/branches/apacheds-kerberos-codec-2.0/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/components/AuthorizationData.java
    directory/apacheds/branches/apacheds-kerberos-codec-2.0/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/components/KdcRep.java
    directory/apacheds/branches/apacheds-kerberos-codec-2.0/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/components/KdcReq.java
    directory/apacheds/branches/apacheds-kerberos-codec-2.0/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/components/KdcReqBody.java
    directory/apacheds/branches/apacheds-kerberos-codec-2.0/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/components/LastReq.java
    directory/apacheds/branches/apacheds-kerberos-codec-2.0/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/components/TypedData.java
    directory/apacheds/branches/apacheds-kerberos-codec-2.0/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/messages/KrbError.java

Modified: directory/apacheds/branches/apacheds-kerberos-codec-2.0/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/components/AuthorizationData.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-kerberos-codec-2.0/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/components/AuthorizationData.java?rev=1043481&r1=1043480&r2=1043481&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-kerberos-codec-2.0/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/components/AuthorizationData.java
(original)
+++ directory/apacheds/branches/apacheds-kerberos-codec-2.0/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/components/AuthorizationData.java
Wed Dec  8 16:13:15 2010
@@ -77,8 +77,8 @@ public class AuthorizationData extends A
     public AuthorizationData()
     {
     }
-
-
+    
+    
     /**
      * Compute the AuthorizationData length
      * <pre>
@@ -102,6 +102,7 @@ public class AuthorizationData extends A
         authorizationDataSeqLen = new int[authorizationData.size()];
         adTypeTagLen = new int[authorizationData.size()];
         adDataTagLen = new int[authorizationData.size()];
+        authorizationDataSeqSeqLen = 0;
         
         for ( AuthorizationDataEntry ad : authorizationData )
         {

Modified: directory/apacheds/branches/apacheds-kerberos-codec-2.0/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/components/KdcRep.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-kerberos-codec-2.0/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/components/KdcRep.java?rev=1043481&r1=1043480&r2=1043481&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-kerberos-codec-2.0/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/components/KdcRep.java
(original)
+++ directory/apacheds/branches/apacheds-kerberos-codec-2.0/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/components/KdcRep.java
Wed Dec  8 16:13:15 2010
@@ -233,7 +233,7 @@ public class KdcRep extends KerberosMess
     {
         this.encKdcRepPart = encKdcRepPart;
     }
-
+    
     
     /**
      * Compute the KDC-REP length
@@ -292,6 +292,7 @@ public class KdcRep extends KerberosMess
         {
             paDataLengths = new int[paData.size()];
             int pos = 0;
+            paDataSeqLength = 0;
             
             for ( PaData paDataElem : paData )
             {

Modified: directory/apacheds/branches/apacheds-kerberos-codec-2.0/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/components/KdcReq.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-kerberos-codec-2.0/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/components/KdcReq.java?rev=1043481&r1=1043480&r2=1043481&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-kerberos-codec-2.0/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/components/KdcReq.java
(original)
+++ directory/apacheds/branches/apacheds-kerberos-codec-2.0/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/components/KdcReq.java
Wed Dec  8 16:13:15 2010
@@ -129,7 +129,7 @@ public abstract class KdcReq extends Ker
     {
         this.kdcReqBody = kdcReqBody;
     }
-
+    
     
     /**
      * Compute the KDC-REQ length
@@ -175,6 +175,7 @@ public abstract class KdcReq extends Ker
         {
             paDataLengths = new int[paData.size()];
             int pos = 0;
+            paDataSeqLength = 0;
             
             for ( PaData paDataElem : paData )
             {

Modified: directory/apacheds/branches/apacheds-kerberos-codec-2.0/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/components/KdcReqBody.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-kerberos-codec-2.0/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/components/KdcReqBody.java?rev=1043481&r1=1043480&r2=1043481&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-kerberos-codec-2.0/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/components/KdcReqBody.java
(original)
+++ directory/apacheds/branches/apacheds-kerberos-codec-2.0/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/components/KdcReqBody.java
Wed Dec  8 16:13:15 2010
@@ -392,7 +392,7 @@ public class KdcReqBody extends Abstract
     {
         this.till = till;
     }
-
+    
     
     /**
      * Compute the KdcReqBody length
@@ -466,44 +466,53 @@ public class KdcReqBody extends Abstract
     {
         // The KdcOptions length
         kdcOptionsLength = 1 + 1 + kdcOptions.getBytes().length;
-        
+        kdcReqBodySeqLength = 1 + TLV.getNbBytes( kdcOptionsLength ) + kdcOptionsLength;

+
         // The cname length
         if ( cName != null )
         {
             cNameLength = cName.computeLength();
+            kdcReqBodySeqLength += 1 + TLV.getNbBytes( cNameLength ) + cNameLength;
         }
 
         // Compute the realm length.
         realmBytes = StringTools.getBytesUtf8( realm );
         realmLength = 1 + TLV.getNbBytes( realmBytes.length ) + realmBytes.length;
-        
+        kdcReqBodySeqLength += 1 + TLV.getNbBytes( realmLength ) + realmLength;
+
         // The sname length
         if ( sName != null )
         {
             sNameLength = sName.computeLength();
+            kdcReqBodySeqLength += 1 + TLV.getNbBytes( sNameLength ) + sNameLength;
         }
 
         // The from length
         if ( from != null )
         {
             fromLength = 1 + 1 + 0x0F;
+            kdcReqBodySeqLength += 1 + 1 + fromLength;
         }
 
         // The till length
         tillLength = 1 + 1 + 0x0F;
+        kdcReqBodySeqLength += 1 + 1 + tillLength;
 
         // The rtime length
         if ( rtime != null )
         {
             rtimeLength = 1 + 1 + 0x0F;
+            kdcReqBodySeqLength += 1 + 1 + rtimeLength;
         }
 
         // The nonce length
         nonceLength = 1 + 1 + Value.getNbBytes( nonce );
-        
+        kdcReqBodySeqLength += 1 + 1 + nonceLength;
+
         // The eType length
         eTypeLengths = new int[eType.size()];
         int pos = 0;
+        eTypeSeqLength = 0;
         
         for ( EncryptionType encryptionType : eType )
         {
@@ -513,23 +522,27 @@ public class KdcReqBody extends Abstract
         }
         
         eTypeLength = 1 + TLV.getNbBytes( eTypeSeqLength ) + eTypeSeqLength;
-        
+        kdcReqBodySeqLength += 1 + TLV.getNbBytes( eTypeLength ) + eTypeLength;
+
         // The Addresses length
         if ( addresses != null )
         {
             addressesLength = addresses.computeLength();
+            kdcReqBodySeqLength += 1 + TLV.getNbBytes( addressesLength ) + addressesLength;
         }
         
         // The EncAuthorizationData length
         if ( encAuthorizationData != null )
         {
             encAuthzDataLength = encAuthorizationData.computeLength();
+            kdcReqBodySeqLength += 1 + TLV.getNbBytes( encAuthzDataLength ) + encAuthzDataLength;
         }
         
         // The additionalTickets length
         if ( additionalTickets.size() != 0 )
         {
             additionalTicketsLengths = new int[additionalTickets.size()];
+            additionalTicketSeqLength = 0;
             pos = 0;
             
             for ( Ticket ticket : additionalTickets )
@@ -540,52 +553,9 @@ public class KdcReqBody extends Abstract
             }
             
             additionalTicketLength = 1 + TLV.getNbBytes( additionalTicketSeqLength ) + additionalTicketSeqLength;
-        }
-
-        // Compute the sequence size.
-        // The mandatory fields first
-        kdcReqBodySeqLength = 1 + TLV.getNbBytes( kdcOptionsLength ) + kdcOptionsLength;

-        kdcReqBodySeqLength += 1 + TLV.getNbBytes( realmLength ) + realmLength;
-        kdcReqBodySeqLength += 1 + 1 + tillLength;
-        kdcReqBodySeqLength += 1 + 1 + nonceLength;
-        kdcReqBodySeqLength += 1 + TLV.getNbBytes( eTypeLength ) + eTypeLength;
-        
-        // The optional fields
-        if ( cName != null )
-        {
-            kdcReqBodySeqLength += 1 + TLV.getNbBytes( cNameLength ) + cNameLength;
-        }
-        
-        if ( sName != null )
-        {
-            kdcReqBodySeqLength += 1 + TLV.getNbBytes( sNameLength ) + sNameLength;
-        }
-        
-        if ( from != null )
-        {
-            kdcReqBodySeqLength += 1 + 1 + fromLength;
-        }
-        
-        if ( rtime != null )
-        {
-            kdcReqBodySeqLength += 1 + 1 + rtimeLength;
-        }
-
-        if ( addresses != null )
-        {
-            kdcReqBodySeqLength += 1 + TLV.getNbBytes( addressesLength ) + addressesLength;
-        }
-        
-        if ( encAuthorizationData != null )
-        {
-            kdcReqBodySeqLength += 1 + TLV.getNbBytes( encAuthzDataLength ) + encAuthzDataLength;
-        }
-        
-        if ( additionalTickets.size() != 0 )
-        {
             kdcReqBodySeqLength += 1 + TLV.getNbBytes( additionalTicketLength ) + additionalTicketLength;
         }
-        
+
         // compute the global size
         kdcReqBodyLength = 1 + TLV.getNbBytes( kdcReqBodySeqLength ) + kdcReqBodySeqLength;
         

Modified: directory/apacheds/branches/apacheds-kerberos-codec-2.0/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/components/LastReq.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-kerberos-codec-2.0/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/components/LastReq.java?rev=1043481&r1=1043480&r2=1043481&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-kerberos-codec-2.0/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/components/LastReq.java
(original)
+++ directory/apacheds/branches/apacheds-kerberos-codec-2.0/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/components/LastReq.java
Wed Dec  8 16:13:15 2010
@@ -153,8 +153,8 @@ public class LastReq extends AbstractAsn
     {
         return lastReqs;
     }
-
-
+    
+    
     /**
      * Compute the LastReq length
      * 
@@ -180,7 +180,7 @@ public class LastReq extends AbstractAsn
         lastReqSeqLen = new int[lastReqs.size()];
         lrTypeTagLen = new int[lastReqs.size()];
         lrValueTagLen = new int[lastReqs.size()];
-        lastReqSeqLen = new int[lastReqs.size()];
+        lastReqSeqSeqLen = 0;
         
         for ( LastReqEntry lre : lastReqs )
         {

Modified: directory/apacheds/branches/apacheds-kerberos-codec-2.0/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/components/TypedData.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-kerberos-codec-2.0/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/components/TypedData.java?rev=1043481&r1=1043480&r2=1043481&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-kerberos-codec-2.0/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/components/TypedData.java
(original)
+++ directory/apacheds/branches/apacheds-kerberos-codec-2.0/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/components/TypedData.java
Wed Dec  8 16:13:15 2010
@@ -158,8 +158,8 @@ public class TypedData extends AbstractA
     {
         return typedDataList;
     }
-
-
+    
+    
     /**
      * Compute the TypedData length
      * <pre>
@@ -183,6 +183,7 @@ public class TypedData extends AbstractA
         typedDataSeqLength = new int[typedDataList.size()];
         dataTypeTagLength = new int[typedDataList.size()];
         dataValueTagLength = new int[typedDataList.size()];
+        typedDataSeqSeqLength = 0;
 
         for ( TD td : typedDataList )
         {

Modified: directory/apacheds/branches/apacheds-kerberos-codec-2.0/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/messages/KrbError.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-kerberos-codec-2.0/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/messages/KrbError.java?rev=1043481&r1=1043480&r2=1043481&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-kerberos-codec-2.0/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/messages/KrbError.java
(original)
+++ directory/apacheds/branches/apacheds-kerberos-codec-2.0/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/messages/KrbError.java
Wed Dec  8 16:13:15 2010
@@ -399,96 +399,82 @@ public class KrbError extends KerberosMe
      */
     public int computeLength()
     {
+        // The PVNO
         pvnoLength = 1 + 1 + 1;
+        krbErrorSeqLength = 1 + TLV.getNbBytes( pvnoLength ) + pvnoLength;
 
+        // The message type
         msgTypeLength = 1 + 1 + Value.getNbBytes( getMessageType().getValue() );
+        krbErrorSeqLength += 1 + TLV.getNbBytes( msgTypeLength ) + msgTypeLength;
 
+        // The ctime, if any
         if ( cTime != null )
         {
             cTimeLength = 1 + 1 + 0x0F;
+            krbErrorSeqLength += 1 + TLV.getNbBytes( cTimeLength ) + cTimeLength;
         }
 
+        // The cusec, if any
         if ( cusec != null )
         {
             int cusecLen = Value.getNbBytes( cusec );
             cusecLength = 1 + TLV.getNbBytes( cusecLen ) + cusecLen;
+            krbErrorSeqLength += 1 + TLV.getNbBytes( cusecLength ) + cusecLength;
         }
 
+        // The stime
         sTimeLength = 1 + 1 + 0x0F;
+        krbErrorSeqLength += 1 + TLV.getNbBytes( sTimeLength ) + sTimeLength;
 
+        // The susec
         int susecLen = Value.getNbBytes( susec );
         susecLength = 1 + TLV.getNbBytes( susecLen ) + susecLen;
+        krbErrorSeqLength += 1 + TLV.getNbBytes( susecLength ) + susecLength;
 
+        // The error-code
         errorCodeLength = 1 + 1 + Value.getNbBytes( errorCode.getOrdinal() );
+        krbErrorSeqLength += 1 + TLV.getNbBytes( errorCodeLength ) + errorCodeLength;
 
+        // The crealm, if any
         if ( cRealm != null )
         {
             crealmBytes = StringTools.getBytesUtf8( cRealm );
             cRealmLength = 1 + TLV.getNbBytes( crealmBytes.length ) + crealmBytes.length;
+            krbErrorSeqLength += 1 + TLV.getNbBytes( cRealmLength ) + cRealmLength;
         }
 
+        // The cname if any
         if ( cName != null )
         {
             cNameLength = cName.computeLength();
+            krbErrorSeqLength += 1 + TLV.getNbBytes( cNameLength ) + cNameLength;
         }
 
+        // The realm
         realmBytes = StringTools.getBytesUtf8( realm );
         realmLength = 1 + TLV.getNbBytes( realmBytes.length ) + realmBytes.length;
+        krbErrorSeqLength += 1 + TLV.getNbBytes( realmLength ) + realmLength;
 
+        // The sname
         sNameLength = sName.computeLength();
+        krbErrorSeqLength += 1 + TLV.getNbBytes( sNameLength ) + sNameLength;
 
+        // The e-text, if any
         if ( eText != null )
         {
             eTextBytes = StringTools.getBytesUtf8( eText );
             eTextLength = 1 + TLV.getNbBytes( eTextBytes.length ) + eTextBytes.length;
-        }
-
-        if ( eData != null )
-        {
-            eDataLength = 1 + TLV.getNbBytes( eData.length ) + eData.length;
-        }
-        
-        // Compute the sequence size.
-        // The mandatory fields first
-        krbErrorSeqLength = 1 + TLV.getNbBytes( pvnoLength ) + pvnoLength;
-        krbErrorSeqLength += 1 + TLV.getNbBytes( msgTypeLength ) + msgTypeLength;
-        krbErrorSeqLength += 1 + TLV.getNbBytes( sTimeLength ) + sTimeLength;
-        krbErrorSeqLength += 1 + TLV.getNbBytes( susecLength ) + susecLength;
-        krbErrorSeqLength += 1 + TLV.getNbBytes( errorCodeLength ) + errorCodeLength;
-        krbErrorSeqLength += 1 + TLV.getNbBytes( realmLength ) + realmLength;
-        krbErrorSeqLength += 1 + TLV.getNbBytes( sNameLength ) + sNameLength;
-
-        // The optional fields then
-        if ( cTime != null )
-        {
-            krbErrorSeqLength += 1 + TLV.getNbBytes( cTimeLength ) + cTimeLength;
-        }
-
-        if ( cusec != null )
-        {
-            krbErrorSeqLength += 1 + TLV.getNbBytes( cusecLength ) + cusecLength;
-        }
-
-        if ( cRealm != null )
-        {
-            krbErrorSeqLength += 1 + TLV.getNbBytes( cRealmLength ) + cRealmLength;
-        }
-
-        if ( cName != null )
-        {
-            krbErrorSeqLength += 1 + TLV.getNbBytes( cNameLength ) + cNameLength;
-        }
-
-        if ( eText != null )
-        {
             krbErrorSeqLength += 1 + TLV.getNbBytes( eTextLength ) + eTextLength;
         }
 
+        // The e-data, if any
         if ( eData != null )
         {
+            eDataLength = 1 + TLV.getNbBytes( eData.length ) + eData.length;
             krbErrorSeqLength += 1 + TLV.getNbBytes( eDataLength ) + eDataLength;
         }
-        
+
+        // The global sequence length
         krbErrorLength = 1 + TLV.getNbBytes( krbErrorSeqLength ) + krbErrorSeqLength;
 
         return 1 + TLV.getNbBytes( krbErrorLength ) + krbErrorLength;



Mime
View raw message