Date: Saturday, November 13, 2021 @ 20:55:42
  Author: foutrelis
Revision: 1046148

Rename ldap_connect to fix conflict with openldap

In file included from ldap_connect.c:38:
ldap_connect.h:46:12: error: conflicting types for 'ldap_connect'; have 
'int(char *, struct ld_conn *)'
   46 | extern int ldap_connect(char* _ld_name, struct ld_conn* conn);
      |            ^~~~~~~~~~~~
In file included from ldap_connect.c:35:
/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 );
      | ^~~~~~~~~~~~

Added:
  opensips/trunk/openldap-2.5.patch
Modified:
  opensips/trunk/PKGBUILD

--------------------+
 PKGBUILD           |    4 +++
 openldap-2.5.patch |   57 +++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 61 insertions(+)

Modified: PKGBUILD
===================================================================
--- PKGBUILD    2021-11-13 20:55:20 UTC (rev 1046147)
+++ PKGBUILD    2021-11-13 20:55:42 UTC (rev 1046148)
@@ -22,13 +22,17 @@
 install=opensips.install
 options=('!emptydirs' 'zipman' '!makeflags' 'docs')
 source=(https://opensips.org/pub/opensips/${pkgver}/opensips-${pkgver}.tar.gz
+        openldap-2.5.patch
        opensips.service)
 sha256sums=('557b33db1436d8212ac122f299481bee3f2957f060a2bc0b4256430faf8b3bbc'
+            '48069c579676e6d38673152b22481624d98cf17ce7ae46bdff51f7df61c03c5e'
             'c2fec4be085b108db10834fa9832e98d696c2de6408f85f96cf89c13bf6be819')
 
 prepare() {
   cd "$srcdir"/$pkgname-$pkgver/
 
+  patch -Np1 -i ../openldap-2.5.patch
+
   sed -i 's|sbin|bin|g' Makefile
   sed -i 's|bin-dir = sbin/|bin-dir = bin/|' Makefile.defs
 }

Added: openldap-2.5.patch
===================================================================
--- openldap-2.5.patch                          (rev 0)
+++ openldap-2.5.patch  2021-11-13 20:55:42 UTC (rev 1046148)
@@ -0,0 +1,57 @@
+diff -upr opensips-3.1.2.orig/modules/ldap/ldap_api_fn.c 
opensips-3.1.2/modules/ldap/ldap_api_fn.c
+--- opensips-3.1.2.orig/modules/ldap/ldap_api_fn.c     2021-05-06 
17:40:16.000000000 +0300
++++ opensips-3.1.2/modules/ldap/ldap_api_fn.c  2021-11-13 22:51:36.709798951 
+0200
+@@ -118,7 +118,7 @@ struct ld_conn* get_ldap_connection(stru
+               return NULL;
+       }
+ 
+-      if (ldap_connect(lds->name, NULL) < 0) {
++      if (opensips_ldap_connect(lds->name, NULL) < 0) {
+                       LM_ERR("failed to create new ldap connection!\n");
+                       return NULL;
+       }
+diff -upr opensips-3.1.2.orig/modules/ldap/ldap_connect.c 
opensips-3.1.2/modules/ldap/ldap_connect.c
+--- opensips-3.1.2.orig/modules/ldap/ldap_connect.c    2021-05-06 
17:40:16.000000000 +0300
++++ opensips-3.1.2/modules/ldap/ldap_connect.c 2021-11-13 22:51:36.709798951 
+0200
+@@ -113,7 +113,7 @@ error:
+ }
+ 
+ 
+-int ldap_connect(char* _ld_name, struct ld_conn* conn)
++int opensips_ldap_connect(char* _ld_name, struct ld_conn* conn)
+ {
+       int rc;
+       int ldap_proto_version;
+@@ -411,7 +411,7 @@ int ldap_reconnect(char* _ld_name, struc
+               return -1;
+       }
+ 
+-      if ((rc = ldap_connect(_ld_name, conn)) != 0)
++      if ((rc = opensips_ldap_connect(_ld_name, conn)) != 0)
+       {
+               LM_ERR("[%s]: reconnect failed\n",
+                               _ld_name);
+diff -upr opensips-3.1.2.orig/modules/ldap/ldap_connect.h 
opensips-3.1.2/modules/ldap/ldap_connect.h
+--- opensips-3.1.2.orig/modules/ldap/ldap_connect.h    2021-05-06 
17:40:16.000000000 +0300
++++ opensips-3.1.2/modules/ldap/ldap_connect.h 2021-11-13 22:51:38.336506198 
+0200
+@@ -43,7 +43,7 @@
+ /* forward declaration for this structure */
+ struct ld_conn;
+ 
+-extern int ldap_connect(char* _ld_name, struct ld_conn* conn);
++extern int opensips_ldap_connect(char* _ld_name, struct ld_conn* conn);
+ extern int ldap_disconnect(char* _ld_name, struct ld_conn* conn);
+ extern int ldap_reconnect(char* _ld_name, struct ld_conn* conn);
+ extern int ldap_get_vendor_version(char** _version);
+diff -upr opensips-3.1.2.orig/modules/ldap/ldap_mod.c 
opensips-3.1.2/modules/ldap/ldap_mod.c
+--- opensips-3.1.2.orig/modules/ldap/ldap_mod.c        2021-05-06 
17:40:16.000000000 +0300
++++ opensips-3.1.2/modules/ldap/ldap_mod.c     2021-11-13 22:51:36.709798951 
+0200
+@@ -186,7 +186,7 @@ static int child_init(int rank)
+               }
+ 
+               /* won't check for null in get_ld_session since it's barely 
been initialized */
+-              if (ldap_connect(ld_name, &get_ld_session(ld_name)->conn_s) != 
0)
++              if (opensips_ldap_connect(ld_name, 
&get_ld_session(ld_name)->conn_s) != 0)
+               {
+                       LM_ERR("[%s]: failed to connect to LDAP host(s)\n", 
ld_name);
+                       ldap_disconnect(ld_name, NULL);

Reply via email to