Browse code

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@gmx.net>
(cherry picked from commit 362c6de08058948d0a70a1eeb14ec718f922b4e5)

Sebastian Kemper authored on 15/12/2021 22:30:38 • Daniel-Constantin Mierla committed on 26/01/2022 12:35:23
Showing 3 changed files
... ...
@@ -185,7 +185,7 @@ int ldap_connect_ex(char *_ld_name, int llevel)
185 185
 	return 0;
186 186
 }
187 187
 
188
-int ldap_connect(char *_ld_name)
188
+int oldap_connect(char *_ld_name)
189 189
 {
190 190
 	return ldap_connect_ex(_ld_name, L_DBG);
191 191
 }
... ...
@@ -31,7 +31,7 @@
31 31
 #include "../../core/str.h"
32 32
 #include "../../core/dprint.h"
33 33
 
34
-extern int ldap_connect(char *_ld_name);
34
+extern int oldap_connect(char *_ld_name);
35 35
 extern int ldap_disconnect(char *_ld_name);
36 36
 extern int ldap_reconnect(char *_ld_name);
37 37
 extern int ldap_get_vendor_version(char **_version);
... ...
@@ -167,7 +167,7 @@ static int child_init(int rank)
167 167
 			return -1;
168 168
 		}
169 169
 
170
-		if(ldap_connect(ld_name) != 0) {
170
+		if(oldap_connect(ld_name) != 0) {
171 171
 			LM_ERR("[%s]: failed to connect to LDAP host(s)\n", ld_name);
172 172
 			ldap_disconnect(ld_name);
173 173
 			return -1;