Choosing an LDAP C ++ API

I would like to write my own LDAP client for Linux, specific to our local environment. Most likely, I will use QT4 to provide a brilliant interface without much hassle.

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

Do I need to use C material or is there a C ++ API there?

+4
source share
3 answers

I actually wrote C ++, a wrapper for the OpenLDAP C API for my daily work, and it was not a very pleasant experience.

I did not find a suitable C ++ shell for my purposes (this was in 2006, so everything has changed since then). I ended up interacting directly with the C api, which was horrible, but it had some oddities. Assuming you are on the C / OpenLDAP route, I can offer you a couple of tips.

Something that I found a bit strange, the C API is defined in RFC1823 , which means that almost every library has the same API.

In the case of OpenLDAP, however, many of the RFC1823 API calls are outdated, especially around authentication parts. Depending on who distributed your OpenLDAP library and which version it will determine if these legacy features have been disabled.

The main changes to avoid obsolete APIs are switching from ldap_init() and ldap_open() to ldap_initialize() and using ldap_sasl_bind() (which confuses all auth types)

+5
source

I found the following C ++ shell useful. Open shell c ++

+1
source

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

I would say if the C ++ library is based on Qt and available in the source code, it will surely be the front runner. And if the C ++ library depends on some other non-Qt infrastructure - don't even try to mix it with Qt.

C-based libraries usually have fewer dependencies, although they are slightly inconvenient and require more attention to detail (initialization / deinitialization) compared to C ++ (a destructive class usually means freeing up all the resources bound to it).

0
source

Source: https://habr.com/ru/post/1307386/


All Articles