#205 Fix FTBFS when building with OpenLDAP 2.5
Merged a year ago by abbra. Opened a year ago by sergiodj.
sergiodj/bind-dyndb-ldap fix-ftbfs-openldap-2.5  into  master

file modified
+12 -12
@@ -340,9 +340,9 @@ 

  		   const settings_set_t * const settings,

  		   ldapdb_rdatalist_t *rdatalist) ATTR_NONNULLS ATTR_CHECKRESULT;

  

- static isc_result_t ldap_connect(ldap_instance_t *ldap_inst,

+ static isc_result_t bdl_ldap_connect(ldap_instance_t *ldap_inst,

  		ldap_connection_t *ldap_conn, bool force) ATTR_NONNULLS ATTR_CHECKRESULT;

- static isc_result_t ldap_reconnect(ldap_instance_t *ldap_inst,

+ static isc_result_t bdl_ldap_reconnect(ldap_instance_t *ldap_inst,

  		ldap_connection_t *ldap_conn, bool force) ATTR_NONNULLS ATTR_CHECKRESULT;

  static isc_result_t handle_connection_error(ldap_instance_t *ldap_inst,

  		ldap_connection_t *ldap_conn, bool force) ATTR_NONNULLS;
@@ -2797,8 +2797,8 @@ 

   * credentials and settings are available from the ldap_inst.

   */

  static isc_result_t ATTR_NONNULLS ATTR_CHECKRESULT

- ldap_connect(ldap_instance_t *ldap_inst, ldap_connection_t *ldap_conn,

- 	     bool force)

+ bdl_ldap_connect(ldap_instance_t *ldap_inst, ldap_connection_t *ldap_conn,

+ 		 bool force)

  {

  	LDAP *ld = NULL;

  	int ret;
@@ -2842,9 +2842,9 @@ 

  	if (ldap_conn->handle != NULL)

  		ldap_unbind_ext_s(ldap_conn->handle, NULL, NULL);

  	ldap_conn->handle = ld;

- 	ld = NULL; /* prevent double-unbind from ldap_reconnect() and cleanup: */

+ 	ld = NULL; /* prevent double-unbind from bdl_ldap_reconnect() and cleanup: */

  

- 	CHECK(ldap_reconnect(ldap_inst, ldap_conn, force));

+ 	CHECK(bdl_ldap_reconnect(ldap_inst, ldap_conn, force));

  	return result;

  

  cleanup:
@@ -2861,8 +2861,8 @@ 

  }

  

  static isc_result_t ATTR_NONNULLS ATTR_CHECKRESULT

- ldap_reconnect(ldap_instance_t *ldap_inst, ldap_connection_t *ldap_conn,

- 	       bool force)

+ bdl_ldap_reconnect(ldap_instance_t *ldap_inst, ldap_connection_t *ldap_conn,

+ 		   bool force)

  {

  	isc_result_t result;

  	int ret = 0;
@@ -3036,7 +3036,7 @@ 

  reconnect:

  		if (ldap_conn->handle == NULL && force == false)

  			log_error("connection to the LDAP server was lost");

- 		result = ldap_connect(ldap_inst, ldap_conn, force);

+ 		result = bdl_ldap_connect(ldap_inst, ldap_conn, force);

  		if (result == ISC_R_SUCCESS)

  			log_info("successfully reconnected to LDAP server");

  		break;
@@ -3581,7 +3581,7 @@ 

  		 * successful

  		 * TODO: handle this case inside ldap_pool_getconnection()?

  		 */

- 		CHECK(ldap_connect(ldap_inst, ldap_conn, false));

+ 		CHECK(bdl_ldap_connect(ldap_inst, ldap_conn, false));

  	}

  	ret = ldap_delete_ext_s(ldap_conn->handle, str_buf(dn), NULL, NULL);

  	result = (ret == LDAP_SUCCESS) ? ISC_R_SUCCESS : ISC_R_FAILURE;
@@ -3717,7 +3717,7 @@ 

  	for (i = 0; i < pool->connections; i++) {

  		ldap_conn = NULL;

  		CHECK(new_ldap_connection(pool, &ldap_conn));

- 		result = ldap_connect(ldap_inst, ldap_conn, false);

+ 		result = bdl_ldap_connect(ldap_inst, ldap_conn, false);

  		/* Continue even if LDAP server is down */

  		if (result != ISC_R_NOTCONNECTED && result != ISC_R_TIMEDOUT &&

  		    result != ISC_R_SUCCESS) {
@@ -4769,7 +4769,7 @@ 

  			goto retry;

  		}

  

- 		result = ldap_connect(inst, conn, true);

+ 		result = bdl_ldap_connect(inst, conn, true);

  		if (result != ISC_R_SUCCESS) {

  			log_error_r("reconnection to LDAP failed");

  			goto retry;

The new version of OpenLDAP (2.5) exports the 'ldap_connect' symbol,
which conflicts with the function with the same name that is being
defined and used in src/ldap_helper.c:

libtool: compile: gcc -DHAVE_CONFIG_H -I. -I../../src -I.. -Wdate-time -D_FORTIFY_SOURCE=2 -Wall -Wextra -Werror -std=gnu99 -O2 -g -O2 -ffile-prefix-map=/<<PKGBUILDDIR>>=. -flto=auto -ffat-lto-objects -fstack-protector-strong -Wformat -Werror=format-security -fvisibility=hidden -fno-delete-null-pointer-checks -c ../../src/ldap_entry.c -fPIC -DPIC -o .libs/ldap_la-ldap_entry.o
../../src/ldap_helper.c:343:21: error: conflicting types for ‘ldap_connect’
343 | static isc_result_t ldap_connect(ldap_instance_t ldap_inst,
| ^~~~
In file included from ../../src/ldap_helper.c:52:
/usr/include/ldap.h:1554:1: note: previous declaration of ‘ldap_connect’ was here
1554 | ldap_connect( LDAP
ld );
| ^~~~

This commit fixes this FTBFS by renaming the 'ldap_connect' function
to 'bdl_ldap_connect'. While at it, it also renames the
'ldap_reconnect' function to 'bdl_ldap_reconnect'.

Signed-off-by: Sergio Durigan Junior sergiodj@sergiodj.net

LGTM. Thanks for the fix!

Pull-Request has been merged by abbra

a year ago
Metadata