LDAP c++ API choice

11,075

Solution 1

I've actually written a C++ wrapper for OpenLDAP's C API for my day job and it wasn't my most enjoyable experience.

I didn't find a suitable C++ wrapper out there for my purposes (this was in 2006 so things may have changed since). I wound up directly interacting with the C api, which wasn't terrible but it does have some oddities. Assuming you go to the C/OpenLDAP route I can offer you a couple of tips.

Something that I found a little weird, the C API is defined in RFC1823 which means that pretty much every library has the same API.

In the case of OpenLDAP however a number of the RFC1823 API calls have been deprecated, particularly around the authentication parts. Depending on who distributed your OpenLDAP library and what version it is will determine if these deprecated functions have been disabled.

The main changes to avoid the deprecated API are switching from ldap_init() and ldap_open() to ldap_initialize() and using ldap_sasl_bind() (which confusingly handles all types of auth)

Solution 2

I found following c++ wrapper useful. Open Source C++ wrapper

Share:
11,075
ypnos
Author by

ypnos

Updated on August 21, 2022

Comments

  • ypnos
    ypnos over 1 year

    I would like to write my own LDAP client under Linux, specific to our local environment. Most probably I will use QT4 to provide a shiny frontend without much hassle.

    I found that there seems to be no standard C++ library for this. OpenLDAP provides a C API and there should also be a C++ API (experimental?) somewhere..

    Do I need to use the C stuff or is there a C++ API out there worth of recommendation?