directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kayyag...@apache.org
Subject svn commit: r1053379 - in /directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos: components/KdcReqBody.java messages/ApReq.java messages/Authenticator.java messages/TgsReq.java
Date Tue, 28 Dec 2010 16:09:48 GMT
Author: kayyagari
Date: Tue Dec 28 16:09:47 2010
New Revision: 1053379

URL: http://svn.apache.org/viewvc?rev=1053379&view=rev
Log:
o fixed a wrong request length value being encoded
o added methods to reset the transient fields used in computing lengths

Modified:
    directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/components/KdcReqBody.java
    directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/messages/ApReq.java
    directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/messages/Authenticator.java
    directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/messages/TgsReq.java

Modified: directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/components/KdcReqBody.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/components/KdcReqBody.java?rev=1053379&r1=1053378&r2=1053379&view=diff
==============================================================================
--- directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/components/KdcReqBody.java
(original)
+++ directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/components/KdcReqBody.java
Tue Dec 28 16:09:47 2010
@@ -464,6 +464,8 @@ public class KdcReqBody extends Abstract
      */
     public int computeLength()
     {
+    	reset();
+    	
         // The KdcOptions length
         kdcOptionsLength = 1 + 1 + kdcOptions.getBytes().length;
         kdcReqBodySeqLength = 1 + TLV.getNbBytes( kdcOptionsLength ) + kdcOptionsLength;

@@ -725,6 +727,33 @@ public class KdcReqBody extends Abstract
 
     
     /**
+     * reset the transient fields used while computing length
+     */
+    private void reset()
+    {
+        kdcOptionsLength = 0;
+        cNameLength = 0;
+        realmLength = 0;
+        realmBytes = null;
+        sNameLength = 0;
+        fromLength = 0;
+        tillLength = 0;
+        rtimeLength = 0;
+        nonceLength = 0;
+        eTypeLength = 0;
+        eTypeSeqLength = 0;
+        eTypeLengths = null;
+        addressesLength = 0;
+        encAuthzDataLength = 0;
+        additionalTicketLength = 0;
+        additionalTicketSeqLength = 0;
+        additionalTicketsLengths = null;
+        kdcReqBodySeqLength = 0;
+        kdcReqBodyLength = 0;
+    }
+    
+    
+    /**
      * @see Object#toString()
      */
     public String toString()

Modified: directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/messages/ApReq.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/messages/ApReq.java?rev=1053379&r1=1053378&r2=1053379&view=diff
==============================================================================
--- directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/messages/ApReq.java
(original)
+++ directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/messages/ApReq.java
Tue Dec 28 16:09:47 2010
@@ -216,6 +216,8 @@ public class ApReq extends KerberosMessa
      */
     public int computeLength()
     {
+    	reset();
+    	
         // Compute the PVNO length.
         pvnoLength = 1 + 1 + Value.getNbBytes( getProtocolVersionNumber() );
 
@@ -327,6 +329,21 @@ public class ApReq extends KerberosMessa
 
 
     /**
+     * reset the transient fields used while computing length
+     */
+    private void reset()
+    {
+    	pvnoLength = 0;
+        msgTypeLength = 0;
+        apOptionsLength = 0;
+        ticketLength = 0;
+        authenticatorLength = 0;
+        apReqLength = 0;
+        apReqSeqLength = 0;	
+    }
+    
+    
+    /**
      * @see Object#toString()
      */
     public String toString()

Modified: directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/messages/Authenticator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/messages/Authenticator.java?rev=1053379&r1=1053378&r2=1053379&view=diff
==============================================================================
--- directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/messages/Authenticator.java
(original)
+++ directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/messages/Authenticator.java
Tue Dec 28 16:09:47 2010
@@ -326,6 +326,8 @@ public class Authenticator extends Kerbe
     @Override
     public int computeLength()
     {
+    	reset();
+    	
         // Compute the Authenticator version length.
         authenticatorVnoLength = 1 + 1 + Value.getNbBytes( getProtocolVersionNumber() );
         authenticatorSeqLength =  1 + TLV.getNbBytes( authenticatorVnoLength ) + authenticatorVnoLength;
@@ -530,7 +532,26 @@ public class Authenticator extends Kerbe
     }
 
 
-
+    /**
+     * reset the transient fields used while computing length
+     */
+    private void reset()
+    {
+    	authenticatorVnoLength = 0;
+        crealmLength = 0;
+        crealmBytes = null;
+        cnameLength = 0;
+        cksumLength = 0;
+        cusecLength = 0;
+        ctimeLength = 0;
+        subkeyLength = 0;
+        seqNumberLength = 0;
+        authorizationDataLength = 0;
+        authenticatorSeqLength = 0;
+        authenticatorLength = 0;	
+    }
+    
+    
     /**
      * @see Object#toString()
      */

Modified: directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/messages/TgsReq.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/messages/TgsReq.java?rev=1053379&r1=1053378&r2=1053379&view=diff
==============================================================================
--- directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/messages/TgsReq.java
(original)
+++ directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/messages/TgsReq.java
Tue Dec 28 16:09:47 2010
@@ -27,6 +27,7 @@ import org.apache.directory.shared.asn1.
 import org.apache.directory.shared.kerberos.KerberosConstants;
 import org.apache.directory.shared.kerberos.KerberosMessageType;
 import org.apache.directory.shared.kerberos.components.KdcReq;
+import org.apache.directory.shared.ldap.util.StringTools;
 
 
 /**
@@ -64,6 +65,9 @@ public class TgsReq extends KdcReq
      */
     public int computeLength()
     {
+    	kdcReqLength = 0;
+    	tgsReqLength = 0;
+    	
         kdcReqLength = super.computeLength();
         tgsReqLength = 1 + TLV.getNbBytes( kdcReqLength ) + kdcReqLength;
         
@@ -87,7 +91,7 @@ public class TgsReq extends KdcReq
         
         // The TGS-REQ SEQ Tag
         buffer.put( (byte)KerberosConstants.TGS_REQ_TAG );
-        buffer.put( TLV.getBytes( tgsReqLength ) );
+        buffer.put( TLV.getBytes( kdcReqLength ) );
         
         // The KDC-REQ --------------------------------------------------------
         super.encode( buffer );



Mime
View raw message