control: tags -1 patch pending

Attached debdiff

G.
diff -Nru opensips-2.2.2/debian/changelog opensips-2.2.2/debian/changelog
--- opensips-2.2.2/debian/changelog     2016-12-07 23:14:57.000000000 +0100
+++ opensips-2.2.2/debian/changelog     2019-08-12 15:06:43.000000000 +0200
@@ -1,3 +1,16 @@
+opensips (2.2.2-3.1) unstable; urgency=medium
+
+  [ Gianfranco Costamagna ]
+  * Non-maintainer upload
+  * d/p/mysql-fixes.patch: Adapt to new mariadb-10.3 reconnect functions
+    Closes: #918393
+
+  [ Unit193 <[email protected]> ]
+  * d/p/json-c-0.13.patch: Grab two commits to fix FTBFS with json-c 0.13.
+    Closes: #904660
+
+ -- Gianfranco Costamagna <[email protected]>  Mon, 12 Aug 2019 
15:06:43 +0200
+
 opensips (2.2.2-3) unstable; urgency=medium
 
   * debian/patches:
diff -Nru opensips-2.2.2/debian/patches/json-c-0.13.patch 
opensips-2.2.2/debian/patches/json-c-0.13.patch
--- opensips-2.2.2/debian/patches/json-c-0.13.patch     1970-01-01 
01:00:00.000000000 +0100
+++ opensips-2.2.2/debian/patches/json-c-0.13.patch     2019-08-12 
15:06:43.000000000 +0200
@@ -0,0 +1,255 @@
+Subject: [PATCH] modules/json: Properly detect json-c version and adaptions
+ for v0.13
+Subject: [PATCH] mongodb: remove deprecated is_error() in json-c 0.13
+
+--- a/modules/cachedb_mongodb/cachedb_mongodb_json.c
++++ b/modules/cachedb_mongodb/cachedb_mongodb_json.c
+@@ -162,7 +162,7 @@ int json_to_bson(char *json,bson *bb)
+       LM_DBG("Trying to convert [%s]\n",json);
+ 
+       obj=json_tokener_parse(json);
+-      if (is_error(obj)) {
++      if (!obj) {
+               LM_ERR("Failed to parse JSON: %s\n",json);
+               return -2;
+       }
+diff --git a/modules/json/Makefile b/modules/json/Makefile
+index 5c514655be..479bec7018 100644
+--- a/modules/json/Makefile
++++ b/modules/json/Makefile
+@@ -2,7 +2,7 @@
+ #
+ # Memcached implementation for memcache API.
+ #
+-# 
++#
+ # WARNING: do not run this directly, it should be run by the master Makefile
+ 
+ include ../../Makefile.defs
+@@ -23,8 +23,23 @@ ifeq ($(JSON_BUILDER),)
+       DEFS += -I$(LOCALBASE)/include -I$(SYSBASE)/include
+       LIBS += -L$(LOCALBASE)/lib -ljson
+ else
+-      JSON_LIB_VER = $(shell $(JSON_BUILDER) --modversion | sed  
"s/\.\([0-9]\)\./.0\1./g" | sed  "s/\.\([0-9]\)\$$/.0\1/g" | tr -d "." | sed -e 
"s/^0*//" )
+-      DEFS += $(shell $(JSON_BUILDER) --cflags) 
-DJSON_LIB_VERSION=$(JSON_LIB_VER)
++      JSON_PKG_VER = $(shell $(JSON_BUILDER) --modversion)
++      JSON_PKG_MAJOR = $(shell \
++              ver_tmp=`echo '$(JSON_PKG_VER)' | cut -f1 -d.`; \
++              if [ -z "$$ver_tmp" ]; then ver_tmp=0; fi; \
++              echo "$$ver_tmp";)
++      JSON_PKG_MINOR = $(shell \
++              ver_tmp=`echo '$(JSON_PKG_VER)' | cut -f2 -d.`; \
++              if [ -z "$$ver_tmp" ]; then ver_tmp=0; fi; \
++              echo "$$ver_tmp";)
++      JSON_PKG_MICRO = $(shell \
++              ver_tmp=`echo '$(JSON_PKG_VER)' | cut -f3 -d.`; \
++              if [ -z "$$ver_tmp" ]; then ver_tmp=0; fi; \
++              echo "$$ver_tmp";)
++      DEFS += $(shell $(JSON_BUILDER) --cflags) \
++              -DJSON_PKG_MAJOR=$(JSON_PKG_MAJOR) \
++              -DJSON_PKG_MINOR=$(JSON_PKG_MINOR) \
++              -DJSON_PKG_MICRO=$(JSON_PKG_MICRO)
+       LIBS += $(shell $(JSON_BUILDER) --libs)
+ endif
+ 
+diff --git a/modules/json/array_del.c b/modules/json/array_del.c
+index b23f6d3b39..9be6e2f847 100644
+--- a/modules/json/array_del.c
++++ b/modules/json/array_del.c
+@@ -22,27 +22,34 @@
+  * History:
+  * ---------
+  *  2009-09-04  first version (andreidragus)
++ *  2017-12-12  use opensips_json_c_helper.h (besser82)
+  */
+ 
+-#include <json.h>
+-#include <json_object_private.h>
++#include "opensips_json_c_helper.h"
+ 
+-void array_list_del_idx( struct array_list * arr, int idx)
++#if JSON_C_VERSION_NUM < JSON_C_VER_013
++void array_list_del_idx(struct array_list * arr, int idx)
+ {
+       int i;
+ 
+-      if( idx >= arr->length)
++      if(idx >= arr->length)
+               return;
+ 
+ 
+       arr->free_fn(arr->array[idx]);
+       arr->length--;
+ 
+-      for( i=idx; i<arr->length; i++ )
++      for(i=idx; i<arr->length; i++)
+               arr->array[i]  = arr->array[i+1];
+ };
++#endif
+ 
+ void json_object_array_del(struct json_object* obj, int idx)
+ {
++#if JSON_C_VERSION_NUM >= JSON_C_VER_013
++      struct array_list * arr = json_object_get_array(obj);
++      array_list_del_idx(arr, idx, arr->length);
++#else
+       array_list_del_idx(obj->o.c_array, idx);
++#endif
+ };
+diff --git a/modules/json/json.c b/modules/json/json.c
+index 452e4a8010..c709e44cf3 100644
+--- a/modules/json/json.c
++++ b/modules/json/json.c
+@@ -22,6 +22,7 @@
+  * History:
+  * ---------
+  *  2009-09-04  first version (andreidragus)
++ *  2017-12-12  use opensips_json_c_helper.h (besser82)
+  */
+ 
+ 
+@@ -43,14 +44,9 @@
+ #include "../../mi/mi.h"
+ #include "../tm/tm_load.h"
+ #include "../rr/api.h"
++#include "opensips_json_c_helper.h"
+ 
+ 
+-#include <json.h>
+-#include <json_object_private.h>
+-
+-
+-#define JSON_BUFF_SIZE 4096
+-
+ enum
+ {
+       TAG_KEY = 1,
+@@ -93,7 +89,7 @@ typedef struct _json_name
+ }json_name;
+ 
+ pv_json_t * all;
+-char buff[JSON_BUFF_SIZE];
++char buff[JSON_FILE_BUF_SIZE];
+ 
+ static int mod_init(void);
+ static int child_init(int );
+@@ -297,19 +293,16 @@ json_t * get_object(pv_json_t * var, pv_param_t* pvp ,  
json_tag ** tag,
+                               !json_object_is_type( cur_obj, json_type_object 
) )
+                               goto error;
+ 
+-#if JSON_LIB_VERSION < 10
++#if JSON_C_VERSION_NUM >= JSON_C_VER_010
++                      if (!json_object_object_get_ex( cur_obj,buff, &cur_obj 
) &&
++                              tag == NULL)
++                              goto error;
++#else
+                       cur_obj = json_object_object_get( cur_obj, buff );
+ 
+                       if( cur_obj == NULL && tag == NULL)
+                               goto error;
+-#else
+-                      if (!json_object_object_get_ex( cur_obj,buff, &cur_obj 
) &&
+-                              tag == NULL)
+-                              goto error;
+ #endif
+-
+-
+-
+               }
+ 
+               if( cur_tag->type & TAG_IDX )
+@@ -417,7 +410,7 @@ int pv_get_json (struct sip_msg* msg,  pv_param_t* pvp, 
pv_value_t* val)
+       {
+               val->flags = PV_VAL_STR;
+               val->rs.s = (char*)json_object_get_string( obj );
+-#if JSON_LIB_VERSION >= 10
++#if JSON_C_VERSION_NUM >= JSON_C_VER_010
+               val->rs.len = json_object_get_string_len( obj );
+ #else
+               val->rs.len = strlen(val->rs.s);
+@@ -589,7 +582,7 @@ int pv_set_json (struct sip_msg* msg,  pv_param_t* pvp, 
int flag ,
+               if (obj == NULL)
+               {
+                       LM_ERR("Error parsing json: %s\n",
+-#if JSON_LIB_VERSION >= 10
++#if JSON_C_VERSION_NUM >= JSON_C_VER_010
+                               json_tokener_error_desc(parse_status)
+ #else
+                               json_tokener_errors[(unsigned long)obj]
+diff --git a/modules/json/opensips_json_c_helper.h 
b/modules/json/opensips_json_c_helper.h
+new file mode 100644
+index 0000000000..71c5c21899
+--- /dev/null
++++ b/modules/json/opensips_json_c_helper.h
+@@ -0,0 +1,70 @@
++/*
++ * Copyright (C) 2017 Björn Esser <[email protected]>
++ *
++ * This file is part of opensips, a free SIP server.
++ *
++ * opensips is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License as published by
++ * the Free Software Foundation; either version 2 of the License, or
++ * (at your option) any later version.
++ *
++ * opensips is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++ * GNU General Public License for more details.
++ *
++ * You should have received a copy of the GNU General Public License
++ * along with this program; if not, write to the Free Software
++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 
USA.
++ *
++ *
++ * History:
++ * ---------
++ *  2017-12-12 first version (besser82)
++ */
++
++#ifndef OPENSIPS_JSON_C_HELPER_H
++#define OPENSIPS_JSON_C_HELPER_H
++
++// If those are not defined, we assume to build against json-c v0.9.
++// Starting with v0.11 there is json_c_version.h, which we prefer
++// anyways, so there are no regressions in this case.  Everything
++// conditionalized for v0.10 or later doesn't produce any fallout,
++// when we are asuming v0.9 and building against v0.10.
++#ifndef JSON_PKG_MAJOR
++#define JSON_PKG_MAJOR        0
++#endif
++#ifndef JSON_PKG_MINOR
++#define JSON_PKG_MINOR        9
++#endif
++#ifndef JSON_PKG_MICRO
++#define JSON_PKG_MICRO        0
++#endif
++
++// json.h automatically includes json_c_version.h, if available.
++#include <json.h>
++
++// We prefer JSON_C_VERSION_NUM defined in json_c_version.h.  If it is
++// not defined, we construct it the same way from our JSON_PKG_* defines.
++#ifndef JSON_C_VERSION_NUM
++#define JSON_C_VERSION_NUM (JSON_PKG_MAJOR << 16) | \
++                         (JSON_PKG_MINOR << 8)  | \
++                          JSON_PKG_MICRO
++#endif
++
++// Macros for checking specific versions.
++#define JSON_C_VER_010 (10 << 8)
++#define JSON_C_VER_013 (13 << 8)
++
++// json_object_private.h is gone and not needed anymore in json-c v0.13+.
++#if JSON_C_VERSION_NUM < JSON_C_VER_013
++#include <json_object_private.h>
++#endif
++
++// Newer versions of json-c define this in their headers, so we prefer
++// their definition in that case.
++#ifndef JSON_FILE_BUF_SIZE
++#define JSON_FILE_BUF_SIZE 4096
++#endif
++
++#endif // OPENSIPS_JSON_C_HELPER_H
+
diff -Nru opensips-2.2.2/debian/patches/mysql-fixes.patch 
opensips-2.2.2/debian/patches/mysql-fixes.patch
--- opensips-2.2.2/debian/patches/mysql-fixes.patch     1970-01-01 
01:00:00.000000000 +0100
+++ opensips-2.2.2/debian/patches/mysql-fixes.patch     2019-08-12 
15:06:43.000000000 +0200
@@ -0,0 +1,36 @@
+Description: Fix build failure with new Mariadb-10.3
+Bug-Debian: https://bugs.debian.org/918393
+Author: Gianfranco Costamagna <[email protected]>
+Last-Update: 2019-08-12
+
+--- opensips-2.2.2.orig/modules/db_mysql/dbase.c
++++ opensips-2.2.2/modules/db_mysql/dbase.c
+@@ -35,7 +35,6 @@
+ #include <mysql/mysql.h>
+ #include <mysql/errmsg.h>
+ #include <mysql/mysqld_error.h>
+-#include <mysql/mysql_version.h>
+ #include "../../mem/mem.h"
+ #include "../../dprint.h"
+ #include "../../db/db_query.h"
+--- opensips-2.2.2.orig/modules/db_mysql/my_con.c
++++ opensips-2.2.2/modules/db_mysql/my_con.c
+@@ -22,7 +22,7 @@
+ #include "my_con.h"
+ #include "db_mysql.h"
+ #include "dbase.h"
+-#include <mysql/mysql_version.h>
++#include <mysql/mysql.h>
+ #include "../../mem/mem.h"
+ #include "../../dprint.h"
+ #include "../../ut.h"
+@@ -65,7 +65,8 @@ int db_mysql_connect(struct my_con* ptr)
+               return -1;
+       }
+       /* force no auto reconnection */
+-      ptr->con->reconnect = 0;
++      my_bool reconnect = 0;
++      mysql_options(ptr->con, MYSQL_OPT_RECONNECT, &reconnect);
+ 
+       LM_DBG("connection type is %s\n", mysql_get_host_info(ptr->con));
+       LM_DBG("protocol version is %d\n", mysql_get_proto_info(ptr->con));
diff -Nru opensips-2.2.2/debian/patches/series 
opensips-2.2.2/debian/patches/series
--- opensips-2.2.2/debian/patches/series        2016-12-07 23:14:57.000000000 
+0100
+++ opensips-2.2.2/debian/patches/series        2019-08-12 15:06:43.000000000 
+0200
@@ -5,3 +5,5 @@
 fix-spellchecks.patch
 fix-radcli.patch
 port-tls-1.1.0.patch
+json-c-0.13.patch
+mysql-fixes.patch

Reply via email to