From 362c6de08058948d0a70a1eeb14ec718f922b4e5 Mon Sep 17 00:00:00 2001 From: Sebastian Kemper Date: Wed, 15 Dec 2021 23:30:38 +0100 Subject: [PATCH] ldap: rename private function ldap_connect When compiling against openldap 2.6.0 kamailio's private ldap_connect() clashes with openldap's own. curl dealt with a similar issue earlier (see [1]). Simply rename the function to avoid the issue. In file included from ldap_api_fn.c:37: ldap_connect.h:34:12: error: conflicting types for 'ldap_connect'; have 'int(char *)' 34 | extern int ldap_connect(char *_ld_name); | ^~~~~~~~~~~~ In file included from ldap_api_fn.c:33: /home/sk/tmp/sdk/openwrt-sdk-ath79-generic_gcc-11.2.0_musl.Linux-x86_64/staging_dir/target-mips_24kc_musl/usr/include/ldap.h:1555:1: note: previous declaration of 'ldap_connect' with type 'int(LDAP *)' {aka 'int(struct ldap *)'} 1555 | ldap_connect( LDAP *ld ); | ^~~~~~~~~~~~ make[5]: *** [../../Makefile.rules:100: ldap_api_fn.o] Error 1 make[4]: *** [Makefile:511: modules] Error 1 [1] https://github.com/curl/curl/commit/8bdde6b14ce3b5fd71c772a578fcbd4b6fa6df19 Signed-off-by: Sebastian Kemper --- src/modules/ldap/ldap_connect.c | 2 +- src/modules/ldap/ldap_connect.h | 2 +- src/modules/ldap/ldap_mod.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) --- a/src/modules/ldap/ldap_connect.c +++ b/src/modules/ldap/ldap_connect.c @@ -185,7 +185,7 @@ int ldap_connect_ex(char *_ld_name, int return 0; } -int ldap_connect(char *_ld_name) +int oldap_connect(char *_ld_name) { return ldap_connect_ex(_ld_name, L_DBG); } --- a/src/modules/ldap/ldap_connect.h +++ b/src/modules/ldap/ldap_connect.h @@ -31,7 +31,7 @@ #include "../../core/str.h" #include "../../core/dprint.h" -extern int ldap_connect(char *_ld_name); +extern int oldap_connect(char *_ld_name); extern int ldap_disconnect(char *_ld_name); extern int ldap_reconnect(char *_ld_name); extern int ldap_get_vendor_version(char **_version); --- a/src/modules/ldap/ldap_mod.c +++ b/src/modules/ldap/ldap_mod.c @@ -167,7 +167,7 @@ static int child_init(int rank) return -1; } - if(ldap_connect(ld_name) != 0) { + if(oldap_connect(ld_name) != 0) { LM_ERR("[%s]: failed to connect to LDAP host(s)\n", ld_name); ldap_disconnect(ld_name); return -1;