[ldapvi] [PATCH] Remove ldap_str2dn compatibility kludge

Florian Weimer fweimer at redhat.com
Sat Dec 17 22:05:02 CET 2022


This avoids calling the internal, undeclared ldap_bv2dn_x function.
This might be an actual bug because the internal function has since
added an additional argument (which would have to be specified as NULL
in this case).

OpenLDAP 2.2 was released in 2003, so this code should no longer
be needed.

---
 ldapvi/diff.c | 19 -------------------
 1 file changed, 19 deletions(-)

diff --git a/ldapvi/diff.c b/ldapvi/diff.c
index e2787a3..d144c09 100644
--- a/ldapvi/diff.c
+++ b/ldapvi/diff.c
@@ -210,26 +210,7 @@ frob_ava(tentry *entry, int mode, char *ad, char *data, int n)
 	return 0;
 }
 
-#if defined(LIBLDAP21)
-#warning compiling for libldap <= 2.1, running with >= 2.2 will result in segfault
 #define safe_str2dn ldap_str2dn
-#elif defined(LIBLDAP22)
-/*
- * the following is exactly equivalent to ldap_str2dn in libldap >= 2.2,
- * but will fail linking on 2.1.  This way we avoid calling the old 2.1
- * version of ldap_str2dn (leading to a segfault when accessing the result).
- */
-static void
-safe_str2dn(char *str, LDAPDN *out, int flags)
-{
-        struct berval bv;
-        bv.bv_val = str;
-        bv.bv_len = strlen(str);
-        ldap_bv2dn_x(&bv, out, flags);
-}
-#else
-#error oops
-#endif
 
 /*
  * Call frob_ava for every ava in DN's (first) RDN.

Related to:

  <https://fedoraproject.org/wiki/Changes/PortingToModernC>
  <https://fedoraproject.org/wiki/Toolchain/PortingToModernC>




More information about the ldapvi mailing list