Skip to content

Commit

Permalink
Remove library version from libldap and liblber (#149)
Browse files Browse the repository at this point in the history
* Remove library version from libldap and liblber

* Add notes about OpenLDAP library finding on Linux
  • Loading branch information
joperator authored Jan 31, 2022
1 parent a126279 commit 397162a
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 3 deletions.
4 changes: 2 additions & 2 deletions LdapForNet/Native/NativeMethodsLinux.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ namespace LdapForNet.Native
{
internal static class NativeMethodsLinux
{
private const string LIB_LDAP_PATH = "ldap-2.4.so.2";
private const string LIB_LBER_PATH = "lber-2.4.so.2";
private const string LIB_LDAP_PATH = "ldap.so.2";
private const string LIB_LBER_PATH = "lber.so.2";
private const string LIB_GNUTLS = "libgnutls.so.30";

internal delegate int LDAP_SASL_INTERACT_PROC(IntPtr ld, uint flags, IntPtr defaults, IntPtr interact);
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ Help support the project:

For Linux\OSX you must ensure you have the latest OpenLDAP client libraries installed from http://www.openldap.org


For Linux you must also ensure that the appropriate [symlinks for `libldap.so.2` and `liblber.so.2`](linux.md) exist.

It works with any LDAP protocol compatible directory server (including Microsoft Active Directory).

Supported paswordless authentication (Kerberos) on all platforms (on Linux\OSX supported SASL GSSAPI (Kerberos) authentication!).
Expand Down
23 changes: 23 additions & 0 deletions linux.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Linux: Symlinks for `libldap.so.2` and `liblber.so.2`

After installing the OpenLDAP client libraries for Linux, you must ensure that the appropriate symlinks `libldap.so.2` and `liblber.so.2` exist in your library directory, which is usually `/lib` or `/usr/lib`.

They're usually created by default when installing the OpenLDAP client libraries package and refer directly or indirectly to the latest version of the corresponding library located in the same directory, for example:

```sh
root@linux ~ % ls -l /usr/lib/libldap.so.2
lrwxrwxrwx 1 root root 10 Jul 18 2021 /usr/lib/libldap.so.2 -> libldap.so
root@linux ~ % ls -l /usr/lib/libldap.so
lrwxrwxrwx 1 root root 21 Jul 18 2021 /usr/lib/libldap.so -> libldap-2.4.so.2.11.7
root@linux ~ % ls -l /usr/lib/liblber.so.2
lrwxrwxrwx 1 root root 10 Jul 18 2021 /usr/lib/liblber.so.2 -> liblber.so
root@linux ~ % ls -l /usr/lib/liblber.so
lrwxrwxrwx 1 root root 21 Jul 18 2021 /usr/lib/liblber.so -> liblber-2.4.so.2.11.7
```

If these symlinks do not exist, you can create direct links to the corresponding library using the following commands:

```sh
root@linux ~ % ln -s /usr/lib/libldap-2.X.so.2.Y.Z /usr/lib/libldap.so.2
root@linux ~ % ln -s /usr/lib/liblber-2.X.so.2.Y.Z /usr/lib/liblber.so.2
```

1 comment on commit 397162a

@st-he3
Copy link

@st-he3 st-he3 commented on 397162a Nov 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the symlink documentation should say create for ldap.so.2 and lber.so.2, not libldap.so.2 and liblber.so.2 based on the changes to NativeMethodsLinux above.
Because I had to create:
ln -s /usr/lib/x86_64-linux-gnu/libldap-2.4.so.2 /usr/lib/x86_64-linux-gnu/ldap.so.2
ln -s /usr/lib/x86_64-linux-gnu/liblber-2.4.so.2 /usr/lib/x86_64-linux-gnu/lber.so.2
And then it worked perfectly for me.

Please sign in to comment.