[sr-dev] git:master:362c6de0: ldap: rename private function ldap_connect

Daniel-Constantin Mierla miconda at gmail.com
Wed Dec 22 08:43:37 CET 2021


Module: kamailio
Branch: master
Commit: 362c6de08058948d0a70a1eeb14ec718f922b4e5
URL: https://github.com/kamailio/kamailio/commit/362c6de08058948d0a70a1eeb14ec718f922b4e5

Author: Sebastian Kemper <sebastian_ml at gmx.net>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2021-12-22T08:43:33+01:00

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 <sebastian_ml at gmx.net>

---

Modified: src/modules/ldap/ldap_connect.c
Modified: src/modules/ldap/ldap_connect.h
Modified: src/modules/ldap/ldap_mod.c

---

Diff:  https://github.com/kamailio/kamailio/commit/362c6de08058948d0a70a1eeb14ec718f922b4e5.diff
Patch: https://github.com/kamailio/kamailio/commit/362c6de08058948d0a70a1eeb14ec718f922b4e5.patch

---

diff --git a/src/modules/ldap/ldap_connect.c b/src/modules/ldap/ldap_connect.c
index 06850705e3..352db480ff 100644
--- 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 llevel)
 	return 0;
 }
 
-int ldap_connect(char *_ld_name)
+int oldap_connect(char *_ld_name)
 {
 	return ldap_connect_ex(_ld_name, L_DBG);
 }
diff --git a/src/modules/ldap/ldap_connect.h b/src/modules/ldap/ldap_connect.h
index 32a39e8c57..725e55cd90 100644
--- 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);
diff --git a/src/modules/ldap/ldap_mod.c b/src/modules/ldap/ldap_mod.c
index 4eb4118c5b..1fea95e458 100644
--- 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;




More information about the sr-dev mailing list