directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kayyag...@apache.org
Subject svn commit: r1039623 - in /directory/apacheds/trunk/kerberos-codec/src: main/java/org/apache/directory/shared/kerberos/components/AuthorizationData.java test/java/org/apache/directory/shared/kerberos/codec/AuthorizationDataDecoderTest.java
Date Sat, 27 Nov 2010 08:09:39 GMT
Author: kayyagari
Date: Sat Nov 27 08:09:39 2010
New Revision: 1039623

URL: http://svn.apache.org/viewvc?rev=1039623&view=rev
Log:
o fixed a bug in encode method (counter is not incremented)
o updated the test case to demonstrate the issue and the working of fix
o fixed a type in javadoc
o removed a line doing redundant initialization

Modified:
    directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/components/AuthorizationData.java
    directory/apacheds/trunk/kerberos-codec/src/test/java/org/apache/directory/shared/kerberos/codec/AuthorizationDataDecoderTest.java

Modified: directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/components/AuthorizationData.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/components/AuthorizationData.java?rev=1039623&r1=1039622&r2=1039623&view=diff
==============================================================================
--- directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/components/AuthorizationData.java
(original)
+++ directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/components/AuthorizationData.java
Sat Nov 27 08:09:39 2010
@@ -165,11 +165,11 @@ public class AuthorizationData extends A
      *  |
      *  +-- 0x30 L2 The AD sequence
      *       |
-     *       +--> 0xA1 L3 adType tag
+     *       +--> 0xA0 L3 adType tag
      *       |     |
      *       |     +--> 0x02 L3-1 adType (int)
      *       |
-     *       +--> 0xA2 L4 adData tag
+     *       +--> 0xA1 L4 adData tag
      *             |
      *             +--> 0x04 L<4-1 adData (OCTET STRING)
      * </pre>
@@ -181,7 +181,6 @@ public class AuthorizationData extends A
         authorizationDataSeqLen = new int[authorizationData.size()];
         adTypeTagLen = new int[authorizationData.size()];
         adDataTagLen = new int[authorizationData.size()];
-        authorizationDataSeqLen = new int[authorizationData.size()];
         
         for ( AD ad : authorizationData )
         {
@@ -236,6 +235,8 @@ public class AuthorizationData extends A
                 buffer.put( ( byte ) KerberosConstants.AUTHORIZATION_DATA_ADDATA_TAG );
                 buffer.put( TLV.getBytes( adDataTagLen[i] ) );
                 Value.encode( buffer, ad.adData );
+                
+                i++;
             }
         }
         catch ( BufferOverflowException boe )

Modified: directory/apacheds/trunk/kerberos-codec/src/test/java/org/apache/directory/shared/kerberos/codec/AuthorizationDataDecoderTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-codec/src/test/java/org/apache/directory/shared/kerberos/codec/AuthorizationDataDecoderTest.java?rev=1039623&r1=1039622&r2=1039623&view=diff
==============================================================================
--- directory/apacheds/trunk/kerberos-codec/src/test/java/org/apache/directory/shared/kerberos/codec/AuthorizationDataDecoderTest.java
(original)
+++ directory/apacheds/trunk/kerberos-codec/src/test/java/org/apache/directory/shared/kerberos/codec/AuthorizationDataDecoderTest.java
Sat Nov 27 08:09:39 2010
@@ -50,21 +50,21 @@ public class AuthorizationDataDecoderTes
     {
         Asn1Decoder kerberosDecoder = new Asn1Decoder();
 
-        ByteBuffer stream = ByteBuffer.allocate( 0x24 );
+        ByteBuffer stream = ByteBuffer.allocate( 0x21 );
         
         stream.put( new byte[]
             { 
-              0x30, 0x22,
+              0x30, 0x1F,
                 0x30, 0x0F,
                   (byte)0xA0, 0x03,                 // ad-type
                     0x02, 0x01, 0x02,
                   (byte)0xA1, 0x08,                 // ad-data
                     0x04, 0x06, 'a', 'b', 'c', 'd', 'e', 'f',
-                0x30, 0x0F,
+                0x30, 0x0C,
                   (byte)0xA0, 0x03,                 // ad-type
                     0x02, 0x01, 0x02,
-                  (byte)0xA1, 0x08,                 // ad-data
-                    0x04, 0x06, 'g', 'h', 'i', 'j', 'k', 'l'
+                  (byte)0xA1, 0x05,                 // ad-data
+                    0x04, 0x03, 'g', 'h', 'i'
             } );
 
         String decodedPdu = StringTools.dumpBytes( stream.array() );
@@ -87,7 +87,7 @@ public class AuthorizationDataDecoderTes
         assertNotNull( authData.getAuthorizationData().size() );
         assertEquals( 2, authData.getAuthorizationData().size() );
         
-        String[] expected = new String[]{ "abcdef", "ghijkl" };
+        String[] expected = new String[]{ "abcdef", "ghi" };
         int i = 0;
         
         for ( AuthorizationData.AD ad : authData.getAuthorizationData() )
@@ -105,7 +105,7 @@ public class AuthorizationDataDecoderTes
             bb = authData.encode( bb );
     
             // Check the length
-            assertEquals( 0x24, bb.limit() );
+            assertEquals( 0x21, bb.limit() );
     
             String encodedPdu = StringTools.dumpBytes( bb.array() );
     
@@ -229,5 +229,4 @@ public class AuthorizationDataDecoderTes
         kerberosDecoder.decode( stream, authDataContainer );
         fail();
     }
-
 }



Mime
View raw message