4ee9985431c0590df2c9a406a7e5678cefefb0d3
[feed/telephony.git] / net / kamailio / patches / 160-ldap-rename-private-function-ldap_connect.patch
1 From 362c6de08058948d0a70a1eeb14ec718f922b4e5 Mon Sep 17 00:00:00 2001
2 From: Sebastian Kemper <sebastian_ml@gmx.net>
3 Date: Wed, 15 Dec 2021 23:30:38 +0100
4 Subject: [PATCH] ldap: rename private function ldap_connect
5
6 When compiling against openldap 2.6.0 kamailio's private ldap_connect() clashes
7 with openldap's own. curl dealt with a similar issue earlier (see [1]).
8
9 Simply rename the function to avoid the issue.
10
11 In file included from ldap_api_fn.c:37:
12 ldap_connect.h:34:12: error: conflicting types for 'ldap_connect'; have 'int(char *)'
13 34 | extern int ldap_connect(char *_ld_name);
14 | ^~~~~~~~~~~~
15 In file included from ldap_api_fn.c:33:
16 /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 *)'}
17 1555 | ldap_connect( LDAP *ld );
18 | ^~~~~~~~~~~~
19 make[5]: *** [../../Makefile.rules:100: ldap_api_fn.o] Error 1
20 make[4]: *** [Makefile:511: modules] Error 1
21
22 [1] https://github.com/curl/curl/commit/8bdde6b14ce3b5fd71c772a578fcbd4b6fa6df19
23
24 Signed-off-by: Sebastian Kemper <sebastian_ml@gmx.net>
25 ---
26 src/modules/ldap/ldap_connect.c | 2 +-
27 src/modules/ldap/ldap_connect.h | 2 +-
28 src/modules/ldap/ldap_mod.c | 2 +-
29 3 files changed, 3 insertions(+), 3 deletions(-)
30
31 --- a/src/modules/ldap/ldap_connect.c
32 +++ b/src/modules/ldap/ldap_connect.c
33 @@ -185,7 +185,7 @@ int ldap_connect_ex(char *_ld_name, int
34 return 0;
35 }
36
37 -int ldap_connect(char *_ld_name)
38 +int oldap_connect(char *_ld_name)
39 {
40 return ldap_connect_ex(_ld_name, L_DBG);
41 }
42 --- a/src/modules/ldap/ldap_connect.h
43 +++ b/src/modules/ldap/ldap_connect.h
44 @@ -31,7 +31,7 @@
45 #include "../../core/str.h"
46 #include "../../core/dprint.h"
47
48 -extern int ldap_connect(char *_ld_name);
49 +extern int oldap_connect(char *_ld_name);
50 extern int ldap_disconnect(char *_ld_name);
51 extern int ldap_reconnect(char *_ld_name);
52 extern int ldap_get_vendor_version(char **_version);
53 --- a/src/modules/ldap/ldap_mod.c
54 +++ b/src/modules/ldap/ldap_mod.c
55 @@ -167,7 +167,7 @@ static int child_init(int rank)
56 return -1;
57 }
58
59 - if(ldap_connect(ld_name) != 0) {
60 + if(oldap_connect(ld_name) != 0) {
61 LM_ERR("[%s]: failed to connect to LDAP host(s)\n", ld_name);
62 ldap_disconnect(ld_name);
63 return -1;