From 22e164ff71c7d525c465e99fa52719d47730e03d Mon Sep 17 00:00:00 2001 From: ilylia Date: Tue, 19 Sep 2017 13:33:06 +0800 Subject: [PATCH] fix superfluous leading zeros --- packet.go | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/packet.go b/packet.go index 32e6c67..24d01ed 100644 --- a/packet.go +++ b/packet.go @@ -118,11 +118,13 @@ func readTagAndLength(conn *bufio.Reader, bytes *[]byte) (ret ldap.TagAndLength, } ret.Length <<= 8 ret.Length |= int(b) - if ret.Length == 0 { - // DER requires that lengths be minimal. - err = ldap.StructuralError{"superfluous leading zeros in length"} - return - } + // Compat some lib which use go-ldap or someone else, + // they encode int may have leading zeros when it's greater then 127 + // if ret.Length == 0 { + // // DER requires that lengths be minimal. + // err = ldap.StructuralError{"superfluous leading zeros in length"} + // return + // } } }