LDAP消息结构

时间:2018-08-15 16:47:46

标签: networking ldap protocols

我试图了解LDAP消息的结构,尤其是searchResEntry类型,以便进行一些解析。使用Wireshark作为指南,我有一个大致的了解,但是我找不到关于实际数据结构的更多细节。例如,似乎每个块都以

开头
 0x30 0x84 0x0 0x0

然后,从该位置开始,该块的实际数据之前的剩余字节有一些可变性。例如searchResEntry的前17个字节是

30 84 00 00 0b 8f 02 01 0c 64 84 00 00 0b 86 04 3b

30 84 00 00 - block header
0b 8f - size of entire searchResEntry remaining
02 - I believe represents a type code where the next byte (01) is a length and 0c is the messageId.
64 84 00 00 - No idea
0b 86 - size of entire searchResEntry remaining
04 - some type code
3b - length of block data

但是,其他以30 84 00 00开头的块的长度不是17个字节。

我看过rfc4511,但是它们只是提供了一种无用的表示法,实际上并没有描述字节的含义。

searchResultEntry ::= [APPLICATION 4] SEQUENCE {
             objectName      LDAPDN,
             attributes      PartialAttributeList }

我也看过Wireshark的packet-ldap.c,但很难理解。我不认为要找到对数据结构布局和相关标志的良好描述会很困难。

1 个答案:

答案 0 :(得分:0)

LDAP协议是根据ASN.1 BER编码规则编码的,该规则是ITU定义的标准。完整的规范在这里:https://www.itu.int/ITU-T/studygroups/com17/languages/X.690-0207.pdf