tags:

views:

253

answers:

2

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?

A: 

This question is not easy to answer without knowing specifics of libraries you need.

I would say if C++ library based on Qt and available in source code - that'd be the front runner for sure. And if C++ library depends on some other not-Qt framework - don't even try to mix it with Qt.

C-based libraries generally have less dependencies, though a bit awkward and require more attention to details (initialization / deinitialization) comparing to C++ (destructing class usually means releasing all tied to it resources).

AlexanderVX
Do you know specific LDAP libs?
ypnos
+2  A: 

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)

Dan Head