directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1043149 - /directory/apacheds/branches/apacheds-kerberos-codec-2.0/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/messages/Authenticator.java
Date Tue, 07 Dec 2010 17:57:47 GMT
Author: elecharny
Date: Tue Dec  7 17:57:47 2010
New Revision: 1043149

URL: http://svn.apache.org/viewvc?rev=1043149&view=rev
Log:
Reordered some code for better clarity

Modified:
    directory/apacheds/branches/apacheds-kerberos-codec-2.0/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/messages/Authenticator.java

Modified: directory/apacheds/branches/apacheds-kerberos-codec-2.0/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/messages/Authenticator.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/Authenticator.java?rev=1043149&r1=1043148&r2=1043149&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-kerberos-codec-2.0/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/messages/Authenticator.java
(original)
+++ directory/apacheds/branches/apacheds-kerberos-codec-2.0/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/messages/Authenticator.java
Tue Dec  7 17:57:47 2010
@@ -328,74 +328,53 @@ public class Authenticator extends Kerbe
     {
         // Compute the Authenticator version length.
         authenticatorVnoLength = 1 + 1 + Value.getNbBytes( getProtocolVersionNumber() );
+        authenticatorSeqLength =  1 + TLV.getNbBytes( authenticatorVnoLength ) + authenticatorVnoLength;
 
         // Compute the  crealm length.
         crealmBytes = StringTools.getBytesUtf8( crealm );
         crealmLength = 1 + TLV.getNbBytes( crealmBytes.length ) + crealmBytes.length;
+        authenticatorSeqLength += 1 + TLV.getNbBytes( crealmLength ) + crealmLength;
 
         // Compute the cname length
         cnameLength = cname.computeLength();
+        authenticatorSeqLength += 1 + TLV.getNbBytes( cnameLength ) + cnameLength;
         
         // Compute the cksum length if any
         if ( cksum != null )
         {
             cksumLength = cksum.computeLength();
+            authenticatorSeqLength += 1 + TLV.getNbBytes( cksumLength ) + cksumLength;
         }
 
         // Compute the cusec length
         cusecLength = 1 + 1 + Value.getNbBytes( cusec );
+        authenticatorSeqLength += 1 + TLV.getNbBytes( cusecLength ) + cusecLength;
 
         // Compute the ctime length
         ctimeLength = 1 + 1 + 0x0F;
+        authenticatorSeqLength += 1 + 1 + ctimeLength;
 
         // Compute the subkey length if any
         if ( subKey != null )
         {
             subkeyLength = subKey.computeLength();
+            authenticatorSeqLength += 1 + TLV.getNbBytes( subkeyLength ) + subkeyLength;
         }
 
         // Compute the seq-number  length if any
         if ( seqNumber != null )
         {
             seqNumberLength = 1 + 1 + Value.getNbBytes( seqNumber );
+            authenticatorSeqLength += 1 + TLV.getNbBytes( seqNumberLength ) + seqNumberLength;
         }
         
         // Compute the authorization-data length if any
         if ( authorizationData != null )
         {
             authorizationDataLength = authorizationData.computeLength();
-        }
-
-
-        // Compute the sequence size
-        authenticatorSeqLength = 
-            1 + TLV.getNbBytes( authenticatorVnoLength ) + authenticatorVnoLength +
-            1 + TLV.getNbBytes( crealmLength ) + crealmLength +
-            1 + TLV.getNbBytes( cnameLength ) + cnameLength + 
-            1 + TLV.getNbBytes( cusecLength ) + cusecLength +
-            1 + TLV.getNbBytes( ctimeLength ) + ctimeLength;
-
-        // The optional fields
-        if ( cksum != null )
-        {
-            authenticatorSeqLength += 1 + TLV.getNbBytes( cksumLength ) + cksumLength;
-        }
-
-        if ( subKey != null )
-        {
-            authenticatorSeqLength += 1 + TLV.getNbBytes( subkeyLength ) + subkeyLength;
-        }
-
-        if ( seqNumber != null )
-        {
-            authenticatorSeqLength += 1 + TLV.getNbBytes( seqNumberLength ) + seqNumberLength;
-        }
-
-        if ( authorizationData != null )
-        {
             authenticatorSeqLength += 1 + TLV.getNbBytes( authorizationDataLength ) + authorizationDataLength;
         }
-        
+
         // compute the global size
         authenticatorLength = 1 + TLV.getNbBytes( authenticatorSeqLength ) + authenticatorSeqLength;
         



Mime
View raw message