directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From plusplusjia...@apache.org
Subject [01/17] directory-kerby git commit: DIRKRB-475 The decoded asn1 object with the wrong tagFlags.
Date Fri, 27 Nov 2015 08:18:11 GMT
Repository: directory-kerby
Updated Branches:
  refs/heads/pkinit-support b9485672c -> 67c2bb6e2


DIRKRB-475 The decoded asn1 object with the wrong tagFlags.


Project: http://git-wip-us.apache.org/repos/asf/directory-kerby/repo
Commit: http://git-wip-us.apache.org/repos/asf/directory-kerby/commit/5706da2e
Tree: http://git-wip-us.apache.org/repos/asf/directory-kerby/tree/5706da2e
Diff: http://git-wip-us.apache.org/repos/asf/directory-kerby/diff/5706da2e

Branch: refs/heads/pkinit-support
Commit: 5706da2ebb7cc5aea15dcb186efe2995de28f6af
Parents: c307970
Author: plusplusjiajia <jiajia.li@intel.com>
Authored: Thu Nov 26 10:16:56 2015 +0800
Committer: plusplusjiajia <jiajia.li@intel.com>
Committed: Thu Nov 26 10:16:56 2015 +0800

----------------------------------------------------------------------
 .../main/java/org/apache/kerby/asn1/type/AbstractAsn1Type.java   | 3 ++-
 .../java/org/apache/kerby/kerberos/kerb/codec/CodecTest.java     | 4 +++-
 .../src/main/java/org/apache/kerby/kerberos/kerb/KrbCodec.java   | 3 ++-
 3 files changed, 7 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/5706da2e/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/AbstractAsn1Type.java
----------------------------------------------------------------------
diff --git a/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/AbstractAsn1Type.java b/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/AbstractAsn1Type.java
index f0fbf35..305f986 100644
--- a/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/AbstractAsn1Type.java
+++ b/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/AbstractAsn1Type.java
@@ -209,9 +209,10 @@ public abstract class AbstractAsn1Type<T> implements Asn1Type {
     protected void decode(LimitedByteBuffer content) throws IOException {
         int tag = readTag(content);
         int tagNo = readTagNo(content, tag);
+        int tagFlags = tag & 0xe0;
         int length = readLength(content);
 
-        decode(tag, tagNo, new LimitedByteBuffer(content, length));
+        decode(tagNo, tagNo, new LimitedByteBuffer(content, length));
     }
 
     public void decode(int tagFlags, int tagNo,

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/5706da2e/kerby-kerb/kerb-core-test/src/test/java/org/apache/kerby/kerberos/kerb/codec/CodecTest.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core-test/src/test/java/org/apache/kerby/kerberos/kerb/codec/CodecTest.java
b/kerby-kerb/kerb-core-test/src/test/java/org/apache/kerby/kerberos/kerb/codec/CodecTest.java
index da6c7ce..8c005b4 100644
--- a/kerby-kerb/kerb-core-test/src/test/java/org/apache/kerby/kerberos/kerb/codec/CodecTest.java
+++ b/kerby-kerb/kerb-core-test/src/test/java/org/apache/kerby/kerberos/kerb/codec/CodecTest.java
@@ -19,8 +19,8 @@
  */
 package org.apache.kerby.kerberos.kerb.codec;
 
-import org.apache.kerby.kerberos.kerb.KrbException;
 import org.apache.kerby.kerberos.kerb.KrbCodec;
+import org.apache.kerby.kerberos.kerb.KrbException;
 import org.apache.kerby.kerberos.kerb.spec.base.CheckSum;
 import org.apache.kerby.kerberos.kerb.spec.base.CheckSumType;
 import org.junit.Test;
@@ -41,5 +41,7 @@ public class CodecTest {
         assertThat(restored).isNotNull();
         assertThat(restored.getCksumtype()).isEqualTo(mcs.getCksumtype());
         assertThat(mcs.getChecksum()).isEqualTo(restored.getChecksum());
+        assertThat(restored.tagNo()).isEqualTo(mcs.tagNo());
+        assertThat(restored.tagFlags()).isEqualTo(mcs.tagFlags());
     }
 }

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/5706da2e/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/KrbCodec.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/KrbCodec.java
b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/KrbCodec.java
index fd3d4ba..4827961 100644
--- a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/KrbCodec.java
+++ b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/KrbCodec.java
@@ -67,6 +67,7 @@ public class KrbCodec {
         LimitedByteBuffer limitedBuffer = new LimitedByteBuffer(byteBuffer);
         int tag = AbstractAsn1Type.readTag(limitedBuffer);
         int tagNo = AbstractAsn1Type.readTagNo(limitedBuffer, tag);
+        int tagFlags = tag & 0xe0;
         int length = AbstractAsn1Type.readLength(limitedBuffer);
         LimitedByteBuffer valueBuffer = new LimitedByteBuffer(limitedBuffer, length);
 
@@ -89,7 +90,7 @@ public class KrbCodec {
         } else {
             throw new IOException("To be supported krb message type with tag: " + tag);
         }
-        msg.decode(tag, tagNo, valueBuffer);
+        msg.decode(tagFlags, tagNo, valueBuffer);
 
         return msg;
     }


Mime
View raw message