directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From plusplusjia...@apache.org
Subject directory-kerby git commit: DIRKRB-475 The decoded asn1 object with the wrong tagFlags.
Date Thu, 26 Nov 2015 02:20:53 GMT
Repository: directory-kerby
Updated Branches:
  refs/heads/master e69ab4d5e -> 8194b2181


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/8194b218
Tree: http://git-wip-us.apache.org/repos/asf/directory-kerby/tree/8194b218
Diff: http://git-wip-us.apache.org/repos/asf/directory-kerby/diff/8194b218

Branch: refs/heads/master
Commit: 8194b218129a73ffb6f8af48aa06718a672ad3e7
Parents: e69ab4d
Author: plusplusjiajia <jiajia.li@intel.com>
Authored: Thu Nov 26 10:27:23 2015 +0800
Committer: plusplusjiajia <jiajia.li@intel.com>
Committed: Thu Nov 26 10:27:23 2015 +0800

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


http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/8194b218/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..74bf6e3 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(tagFlags, tagNo, new LimitedByteBuffer(content, length));
     }
 
     public void decode(int tagFlags, int tagNo,

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/8194b218/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..f5543f7 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
@@ -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/8194b218/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