Descending the browse hierarchy from an LDAP reflector

As an example, let’s look at how we might perform a hierarchy descent in the navigation of Lightweight Directory Access Protocol (LDAP) information provided by a custom LDAP reflector in a jabber:iq:browse context.[3] Each time, the link to the next level is via the item’s JID, which is the target of the browse query.

First, we send an initial query:

SEND: <iq type="get" id="browser_JCOM_15" to="ldap.yak">
        <query xmlns="jabber:iq:browse"></query>
      </iq>

In answer to the initial query to what is effectively the LDAP root represented by the JID of the LDAP component itself (ldap.yak, no username prefix), the initial hierarchy level containing People and Groups is returned, wrapped in a pseudoroot:

RECV: <iq type='result' to='dj@yak/winjab' from='ldap.yak' id='browser_JCOM_15'>
        <query xmlns='jabber:iq:browse'>
          <item name='root entry' xmlns='jabber:iq:browse' jid='ldap.yak'>
            <item name='ou=People' jid='ou=People@ldap.yak'/>
            <item name='ou=Groups' jid='ou=Groups@ldap.yak'/>
          </item>
        </query>
      </iq>

We see the items presented to us and choose to descend the path marked Groups; our second browse request is made to the JID that represents that item, ou=Groups@ldap.yak:

SEND: <iq type="get" id="browser_JCOM_17" to="ou=People@ldap.yak">
        <query xmlns="jabber:iq:browse"></query>
      </iq>

The LDAP reflector component receives the IQ packet addressed to the JID ou=People@ldap.yak and interprets the username part of the JID (ou=People ...

Get Programming Jabber now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.