[Pkg-voip-commits] r9936 - in /kamailio/trunk/debian/patches: ./ upstream/

maniac-guest at alioth.debian.org maniac-guest at alioth.debian.org
Tue Aug 28 08:00:35 UTC 2012


Author: maniac-guest
Date: Tue Aug 28 08:00:34 2012
New Revision: 9936

URL: http://svn.debian.org/wsvn/pkg-voip/?sc=1&rev=9936
Log:
upstream fixes

Added:
    kamailio/trunk/debian/patches/upstream/0016-modules-db_postgres-libpq-requires-null-terminated-s.patch
    kamailio/trunk/debian/patches/upstream/0017-modules_k-pua-transaction-not-ended-before-calling-s.patch
    kamailio/trunk/debian/patches/upstream/0018-modules_k-rls-Some-incorrect-pkg_free-calls-in-DB-on.patch
Modified:
    kamailio/trunk/debian/patches/series

Modified: kamailio/trunk/debian/patches/series
URL: http://svn.debian.org/wsvn/pkg-voip/kamailio/trunk/debian/patches/series?rev=9936&op=diff
==============================================================================
--- kamailio/trunk/debian/patches/series (original)
+++ kamailio/trunk/debian/patches/series Tue Aug 28 08:00:34 2012
@@ -9,6 +9,9 @@
 upstream/0012-modules-lcr-modules_k-regex-Fix-stack-overflow-from-.patch
 upstream/0013-modules_k-rls-Fixed-memory-leak-in-rls-under-some-er.patch
 upstream/0014-modules_k-rls-Fixed-incorrect-table-version-check.patch
+upstream/0016-modules-db_postgres-libpq-requires-null-terminated-s.patch
+upstream/0017-modules_k-pua-transaction-not-ended-before-calling-s.patch
+upstream/0018-modules_k-rls-Some-incorrect-pkg_free-calls-in-DB-on.patch
 no_lib64_on_64_bits.patch
 no_INSTALL_file.patch
 plumb_md5.patch

Added: kamailio/trunk/debian/patches/upstream/0016-modules-db_postgres-libpq-requires-null-terminated-s.patch
URL: http://svn.debian.org/wsvn/pkg-voip/kamailio/trunk/debian/patches/upstream/0016-modules-db_postgres-libpq-requires-null-terminated-s.patch?rev=9936&op=file
==============================================================================
--- kamailio/trunk/debian/patches/upstream/0016-modules-db_postgres-libpq-requires-null-terminated-s.patch (added)
+++ kamailio/trunk/debian/patches/upstream/0016-modules-db_postgres-libpq-requires-null-terminated-s.patch Tue Aug 28 08:00:34 2012
@@ -1,0 +1,67 @@
+From fb51d3815292c27245b26d1f4a4f6c9b190f9200 Mon Sep 17 00:00:00 2001
+From: Peter Dunkley <peter.dunkley at crocodile-rcs.com>
+Date: Tue, 21 Aug 2012 15:19:51 +0100
+Subject: [PATCH] modules/db_postgres: libpq requires null terminated string,
+ but Kamailio internal str type is not (necessarily)
+ null-terminated
+
+- Found and fixed by Paul Pankhurst @ Crocodile RCS
+(cherry picked from commit f20713462410211370e762abb463f0ceafd36d8d)
+---
+ modules/db_postgres/km_dbase.c |   16 +++++++++++++++-
+ 1 file changed, 15 insertions(+), 1 deletion(-)
+
+diff --git a/modules/db_postgres/km_dbase.c b/modules/db_postgres/km_dbase.c
+index d2be696..6c21b05 100644
+--- a/modules/db_postgres/km_dbase.c
++++ b/modules/db_postgres/km_dbase.c
+@@ -163,6 +163,7 @@ void db_postgres_close(db1_con_t* _h)
+  */
+ static int db_postgres_submit_query(const db1_con_t* _con, const str* _s)
+ {
++	char *s=NULL;
+ 	int i, retries;
+ 	ExecStatusType pqresult;
+ 
+@@ -199,17 +200,29 @@ static int db_postgres_submit_query(const db1_con_t* _con, const str* _s)
+ 	else
+ 		retries = pg_retries;
+ 
++	s = pkg_malloc((_s->len+1)*sizeof(char));
++	if (s==NULL)
++	{
++		LM_ERR("%p db_postgres_submit_query Out of Memory: Query: %.*s\n", _con, _s->len, _s->s);
++		return -1;
++	}
++
++	memcpy( s, _s->s, _s->len );
++	s[_s->len] = '\0';
++
+ 	for(i = 0; i <= retries; i++) {
+ 		/* free any previous query that is laying about */
+ 		db_postgres_free_query(_con);
+ 		/* exec the query */
+-		if (PQsendQuery(CON_CONNECTION(_con), _s->s)) {
++
++		if (PQsendQuery(CON_CONNECTION(_con), s)) {
+ 			pqresult = PQresultStatus(CON_RESULT(_con));
+ 			if((pqresult!=PGRES_FATAL_ERROR)
+ 					|| (PQstatus(CON_CONNECTION(_con))==CONNECTION_OK))
+ 			{
+ 				LM_DBG("sending query ok: %p (%d) - [%.*s]\n",
+ 						_con, pqresult, _s->len, _s->s);
++				pkg_free(s);
+ 				return 0;
+ 			}
+ 			LM_WARN("postgres result check failed with code %d (%s)\n",
+@@ -226,6 +239,7 @@ static int db_postgres_submit_query(const db1_con_t* _con, const str* _s)
+ 	}
+ 	LM_ERR("%p PQsendQuery Error: %s Query: %.*s\n", _con,
+ 	PQerrorMessage(CON_CONNECTION(_con)), _s->len, _s->s);
++	pkg_free(s);
+ 	return -1;
+ }
+ 
+-- 
+1.7.10.4
+

Added: kamailio/trunk/debian/patches/upstream/0017-modules_k-pua-transaction-not-ended-before-calling-s.patch
URL: http://svn.debian.org/wsvn/pkg-voip/kamailio/trunk/debian/patches/upstream/0017-modules_k-pua-transaction-not-ended-before-calling-s.patch?rev=9936&op=file
==============================================================================
--- kamailio/trunk/debian/patches/upstream/0017-modules_k-pua-transaction-not-ended-before-calling-s.patch (added)
+++ kamailio/trunk/debian/patches/upstream/0017-modules_k-pua-transaction-not-ended-before-calling-s.patch Tue Aug 28 08:00:34 2012
@@ -1,0 +1,55 @@
+From 9de930d083af681fc85fc4cee90dfadbbaadb89c Mon Sep 17 00:00:00 2001
+From: Peter Dunkley <peter.dunkley at crocodile-rcs.com>
+Date: Tue, 21 Aug 2012 15:21:03 +0100
+Subject: [PATCH] modules_k/pua: transaction not ended before calling
+ send_publish() from TM call-back
+
+- Found by Hugh Waite @ Crocodile RCS and fixed by Peter Dunkley
+  @ Crocodile RCS
+(cherry picked from commit b9e77beaee850303ffa736cb4043d21a1806fa4f)
+---
+ modules_k/pua/send_publish.c |   14 +++++++++++++-
+ 1 file changed, 13 insertions(+), 1 deletion(-)
+
+diff --git a/modules_k/pua/send_publish.c b/modules_k/pua/send_publish.c
+index 3bc8702..97935c1 100644
+--- a/modules_k/pua/send_publish.c
++++ b/modules_k/pua/send_publish.c
+@@ -207,6 +207,7 @@ void publ_cback_func(struct cell *t, int type, struct tmcb_params *ps)
+ 	db1_res_t *res=NULL;
+ 	ua_pres_t dbpres;
+ 	str pres_uri={0,0}, watcher_uri={0,0}, extra_headers={0,0};
++	int end_transaction = 1;
+ 
+ 	memset(&dbpres, 0, sizeof(dbpres));
+ 	dbpres.pres_uri = &pres_uri;
+@@ -275,6 +276,17 @@ void publ_cback_func(struct cell *t, int type, struct tmcb_params *ps)
+ 			publ.extra_headers= hentity->extra_headers;
+ 			publ.cb_param= hentity->cb_param;
+ 
++			if (dbmode == PUA_DB_ONLY && pua_dbf.end_transaction)
++			{
++				if (pua_dbf.end_transaction(pua_db) < 0)
++				{
++					LM_ERR("in end_transaction\n");
++					goto error;
++				}
++			}
++
++			end_transaction = 0;
++
+ 			if(send_publish(&publ)< 0)
+ 			{
+ 				LM_ERR("when trying to send PUBLISH\n");
+@@ -432,7 +444,7 @@ done:
+ 
+ 	if (res) free_results_puadb(res);
+ 
+-	if (dbmode == PUA_DB_ONLY && pua_dbf.end_transaction)
++	if (dbmode == PUA_DB_ONLY && pua_dbf.end_transaction && end_transaction)
+ 	{
+ 		if (pua_dbf.end_transaction(pua_db) < 0)
+ 		{
+-- 
+1.7.10.4
+

Added: kamailio/trunk/debian/patches/upstream/0018-modules_k-rls-Some-incorrect-pkg_free-calls-in-DB-on.patch
URL: http://svn.debian.org/wsvn/pkg-voip/kamailio/trunk/debian/patches/upstream/0018-modules_k-rls-Some-incorrect-pkg_free-calls-in-DB-on.patch?rev=9936&op=file
==============================================================================
--- kamailio/trunk/debian/patches/upstream/0018-modules_k-rls-Some-incorrect-pkg_free-calls-in-DB-on.patch (added)
+++ kamailio/trunk/debian/patches/upstream/0018-modules_k-rls-Some-incorrect-pkg_free-calls-in-DB-on.patch Tue Aug 28 08:00:34 2012
@@ -1,0 +1,63 @@
+From aae4e4537eefa525d03874aaf165048a09d1febf Mon Sep 17 00:00:00 2001
+From: Peter Dunkley <peter.dunkley at crocodile-rcs.com>
+Date: Tue, 21 Aug 2012 15:21:54 +0100
+Subject: [PATCH] modules_k/rls: Some incorrect pkg_free() calls in DB only
+ code
+
+- Found and fixed by Hugh Waite @ Crocodile RCS
+(cherry picked from commit 9b77e69de0953f9f6f48d4c1cf06f7e593469912)
+---
+ modules_k/rls/rls_db.c |   16 +++++++---------
+ 1 file changed, 7 insertions(+), 9 deletions(-)
+
+diff --git a/modules_k/rls/rls_db.c b/modules_k/rls/rls_db.c
+index 052a0e7..97ac7d6 100644
+--- a/modules_k/rls/rls_db.c
++++ b/modules_k/rls/rls_db.c
+@@ -798,6 +798,13 @@ int get_dialog_subscribe_rlsdb(subs_t *subs)
+ 	r_version = VAL_INT(&values[version_col]);
+ 	r_record_route = (char *)VAL_STRING(&values[rroute_col]);
+ 
++	if ( r_remote_cseq >= subs->remote_cseq)
++	{
++		LM_DBG("stored cseq= %d\n", r_remote_cseq);
++		rls_dbf.free_result(rls_db, result);
++		return(401); /*stale cseq code */
++	}
++
+ 	if(strlen(r_pres_uri) > 0)
+ 	{
+ 		subs->pres_uri.s =
+@@ -805,7 +812,6 @@ int get_dialog_subscribe_rlsdb(subs_t *subs)
+ 		if(subs->pres_uri.s==NULL)
+ 		{
+ 			LM_ERR( "Out of Memory\n" );
+- 			pkg_free(subs->pres_uri.s);
+ 			rls_dbf.free_result(rls_db, result);
+ 			return(-1);
+ 		}
+@@ -814,13 +820,6 @@ int get_dialog_subscribe_rlsdb(subs_t *subs)
+ 		subs->pres_uri.len= strlen(r_pres_uri);
+ 	}
+ 
+-	if ( r_remote_cseq >= subs->remote_cseq)
+-	{
+-		LM_DBG("stored cseq= %d\n", r_remote_cseq);
+-		rls_dbf.free_result(rls_db, result);
+-		return(401); /*stale cseq code */
+-	}
+-
+ 	if(strlen(r_record_route) > 0)
+ 	{
+ 		subs->record_route.s =
+@@ -828,7 +827,6 @@ int get_dialog_subscribe_rlsdb(subs_t *subs)
+ 		if(subs->record_route.s==NULL)
+ 		{
+ 			LM_ERR( "Out of Memory\n" );
+- 			pkg_free(subs->record_route.s);
+ 			rls_dbf.free_result(rls_db, result);
+ 			return(-1);
+ 		}
+-- 
+1.7.10.4
+




More information about the Pkg-voip-commits mailing list