Some time ago I added code to fetch the rootdse on connection, but didn't publicize it too much.
Attached find 2 patches.
1) Rework the way we store data fetched from the rootdse so the it is more useful and is actually attached to the ldap handle.
2) Check controls are supported before using them.
Simo.