mirror of https://github.com/sipwise/kamailio.git
* renamed already merged upstream fixes Change-Id: I639f8fb4213284e25da29ab98529d3b50cc41a03changes/71/11471/1
parent
86e3621307
commit
cd6c25c74b
@ -0,0 +1,31 @@
|
|||||||
|
From 4180f5bf64b6b4338f99ba0eb7d2146ef86c088e Mon Sep 17 00:00:00 2001
|
||||||
|
From: Minh Phan <pqminh@gmail.com>
|
||||||
|
Date: Fri, 27 Jan 2017 09:06:08 +0100
|
||||||
|
Subject: [PATCH] topoh: safety check to avoid crash when there is no via
|
||||||
|
header
|
||||||
|
|
||||||
|
- based on GH #952
|
||||||
|
|
||||||
|
(cherry picked from commit 2367fb52aa94bd06fcbadce7f9ecccdcf6e36c83)
|
||||||
|
---
|
||||||
|
modules/topoh/th_msg.c | 4 ++++
|
||||||
|
1 file changed, 4 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/modules/topoh/th_msg.c b/modules/topoh/th_msg.c
|
||||||
|
index 40a956e81..a070c2705 100644
|
||||||
|
--- a/modules/topoh/th_msg.c
|
||||||
|
+++ b/modules/topoh/th_msg.c
|
||||||
|
@@ -954,6 +954,10 @@ int th_add_hdr_cookie(sip_msg_t *msg)
|
||||||
|
struct via_param *th_get_via_cookie(sip_msg_t *msg, struct via_body *via)
|
||||||
|
{
|
||||||
|
struct via_param *p;
|
||||||
|
+
|
||||||
|
+ if (!via) {
|
||||||
|
+ return NULL;
|
||||||
|
+ }
|
||||||
|
for(p=via->param_lst; p; p=p->next)
|
||||||
|
{
|
||||||
|
if(p->name.len==th_cookie_name.len
|
||||||
|
--
|
||||||
|
2.11.0
|
||||||
|
|
@ -0,0 +1,37 @@
|
|||||||
|
From 76765a2e5ca9649d19c3b49a5122e4eaa68e8778 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Ovidiu Sas <osas@voipembedded.com>
|
||||||
|
Date: Mon, 30 Jan 2017 15:26:30 -0500
|
||||||
|
Subject: [PATCH] =?UTF-8?q?kazoo:=20fix=20compiler=20warning:=20=E2=80=98j?=
|
||||||
|
=?UTF-8?q?son=5Fobj=E2=80=99=20may=20be=20used=20uninitialized=20in=20thi?=
|
||||||
|
=?UTF-8?q?s=20function=20[-Wuninitialized]=20=20-=20closes=20#954?=
|
||||||
|
MIME-Version: 1.0
|
||||||
|
Content-Type: text/plain; charset=UTF-8
|
||||||
|
Content-Transfer-Encoding: 8bit
|
||||||
|
|
||||||
|
---
|
||||||
|
modules/kazoo/kz_amqp.c | 3 ++-
|
||||||
|
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/modules/kazoo/kz_amqp.c b/modules/kazoo/kz_amqp.c
|
||||||
|
index 2b8a5e905..69127cfa3 100644
|
||||||
|
--- a/modules/kazoo/kz_amqp.c
|
||||||
|
+++ b/modules/kazoo/kz_amqp.c
|
||||||
|
@@ -2496,13 +2496,14 @@ void kz_send_targeted_cmd(int server_id, amqp_bytes_t body)
|
||||||
|
kz_amqp_cmd_ptr cmd = NULL;
|
||||||
|
json_object* JObj = NULL;
|
||||||
|
char* payload = kz_local_amqp_bytes_dup(body);
|
||||||
|
+ json_obj_ptr json_obj = NULL;
|
||||||
|
|
||||||
|
if(payload == NULL) {
|
||||||
|
LM_ERR("error allocating message payload\n");
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
|
||||||
|
- json_obj_ptr json_obj = kz_json_parse(payload );
|
||||||
|
+ json_obj = kz_json_parse(payload );
|
||||||
|
if (json_obj == NULL) {
|
||||||
|
LM_ERR("error parsing json payload\n");
|
||||||
|
goto error;
|
||||||
|
--
|
||||||
|
2.11.0
|
||||||
|
|
@ -0,0 +1,46 @@
|
|||||||
|
From 42f5515df93a182fd33a6c48f1a9dd1850e91965 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Victor Seva <linuxmaniac@torreviejawireless.org>
|
||||||
|
Date: Wed, 1 Feb 2017 12:53:28 +0100
|
||||||
|
Subject: [PATCH] core: avoid overrun-buffer-arg
|
||||||
|
|
||||||
|
> Overrunning array ((struct a_rdata *)rr->rdata)->ip of 4 bytes
|
||||||
|
> by passing it to a function which accesses it at byte offset 15
|
||||||
|
> using argument len (which evaluates to 16)
|
||||||
|
|
||||||
|
(cherry picked from commit 5640f696f5364bb88732807f5f87b4afb7a97ba6)
|
||||||
|
---
|
||||||
|
dns_cache.c | 11 ++++++++++-
|
||||||
|
1 file changed, 10 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/dns_cache.c b/dns_cache.c
|
||||||
|
index 21b780ee0..c4b910d26 100644
|
||||||
|
--- a/dns_cache.c
|
||||||
|
+++ b/dns_cache.c
|
||||||
|
@@ -2362,6 +2362,7 @@ inline static struct hostent* dns_entry2he(struct dns_hash_entry* e)
|
||||||
|
int af, len;
|
||||||
|
struct dns_rr* rr;
|
||||||
|
unsigned char rr_no;
|
||||||
|
+ unsigned char *ip;
|
||||||
|
ticks_t now;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
@@ -2389,7 +2390,15 @@ inline static struct hostent* dns_entry2he(struct dns_hash_entry* e)
|
||||||
|
for(i=0; rr && (i<DNS_HE_MAX_ADDR); i++,
|
||||||
|
rr=dns_entry_get_rr(e, &rr_no, now)){
|
||||||
|
p_addr[i]=&address[i*len];
|
||||||
|
- memcpy(p_addr[i], ((struct a_rdata*)rr->rdata)->ip, len);
|
||||||
|
+ switch(e->type){
|
||||||
|
+ case T_A:
|
||||||
|
+ ip = ((struct a_rdata*)rr->rdata)->ip;
|
||||||
|
+ break;
|
||||||
|
+ case T_AAAA:
|
||||||
|
+ ip = ((struct aaaa_rdata*)rr->rdata)->ip6;
|
||||||
|
+ break;
|
||||||
|
+ }
|
||||||
|
+ memcpy(p_addr[i], ip, len);
|
||||||
|
}
|
||||||
|
if (i==0){
|
||||||
|
LM_DBG("no good records found (%d) for %.*s (%d)\n",
|
||||||
|
--
|
||||||
|
2.11.0
|
||||||
|
|
@ -0,0 +1,72 @@
|
|||||||
|
From 6c6f25b581e083068e9b3832e8f0235a24a88021 Mon Sep 17 00:00:00 2001
|
||||||
|
From: grumvalski <federico.cabiddu@gmail.com>
|
||||||
|
Date: Thu, 2 Feb 2017 15:28:16 +0100
|
||||||
|
Subject: [PATCH] http_async_client: handle 100 Continue from server
|
||||||
|
|
||||||
|
(cherry-picked from commit de1c5397847a3660182832a040d9e9c2e737e654)
|
||||||
|
---
|
||||||
|
modules/http_async_client/async_http.c | 27 ++++++++++++++++++++++++---
|
||||||
|
1 file changed, 24 insertions(+), 3 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/modules/http_async_client/async_http.c b/modules/http_async_client/async_http.c
|
||||||
|
index 24dc8ba72..4b6c33c4f 100644
|
||||||
|
--- a/modules/http_async_client/async_http.c
|
||||||
|
+++ b/modules/http_async_client/async_http.c
|
||||||
|
@@ -45,7 +45,7 @@
|
||||||
|
#include "../../dprint.h"
|
||||||
|
#include "../../ut.h"
|
||||||
|
#include "../../cfg/cfg_struct.h"
|
||||||
|
-#include "../../lib/kcore/faked_msg.h"
|
||||||
|
+#include "../../fmsg.h"
|
||||||
|
#include "../../modules/tm/tm_load.h"
|
||||||
|
|
||||||
|
#include "async_http.h"
|
||||||
|
@@ -122,6 +122,7 @@ void async_http_cb(struct http_m_reply *reply, void *param)
|
||||||
|
unsigned int tlabel;
|
||||||
|
struct cell *t = NULL;
|
||||||
|
char *p;
|
||||||
|
+ str newbuf = {0, 0};
|
||||||
|
sip_msg_t *fmsg;
|
||||||
|
|
||||||
|
if (reply->result != NULL) {
|
||||||
|
@@ -140,7 +141,6 @@ void async_http_cb(struct http_m_reply *reply, void *param)
|
||||||
|
ah_error.len = strlen(ah_error.s);
|
||||||
|
} else {
|
||||||
|
/* success */
|
||||||
|
-
|
||||||
|
/* check for HTTP Via header
|
||||||
|
* - HTTP Via format is different that SIP Via
|
||||||
|
* - workaround: replace with Hia to be ignored by SIP parser
|
||||||
|
@@ -158,7 +158,28 @@ void async_http_cb(struct http_m_reply *reply, void *param)
|
||||||
|
if (parse_msg(reply->result->s, reply->result->len, ah_reply) != 0) {
|
||||||
|
LM_DBG("failed to parse the http_reply\n");
|
||||||
|
} else {
|
||||||
|
- LM_DBG("successfully parsed http reply %p\n", ah_reply);
|
||||||
|
+ if (ah_reply->first_line.u.reply.statuscode == 100) {
|
||||||
|
+ newbuf.s = get_body( ah_reply );
|
||||||
|
+ newbuf.len = reply->result->s + reply->result->len - newbuf.s;
|
||||||
|
+
|
||||||
|
+ if (!(newbuf.len < 0)) {
|
||||||
|
+ memset(ah_reply, 0, sizeof(struct sip_msg));
|
||||||
|
+ ah_reply->buf = newbuf.s;
|
||||||
|
+ ah_reply->len = newbuf.len;
|
||||||
|
+
|
||||||
|
+ if (parse_msg(ah_reply->buf, ah_reply->len, ah_reply) != 0) {
|
||||||
|
+ LM_DBG("failed to parse the http_reply\n");
|
||||||
|
+ } else {
|
||||||
|
+ LM_DBG("successfully parsed http reply %p\n", ah_reply);
|
||||||
|
+ }
|
||||||
|
+ } else {
|
||||||
|
+ /* this should not happen! */
|
||||||
|
+ LM_WARN("something got wrong parsing the 100 Continue: got %d len\n", newbuf.len);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ } else {
|
||||||
|
+ LM_DBG("successfully parsed http reply %p\n", ah_reply);
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
--
|
||||||
|
2.11.0
|
||||||
|
|
@ -0,0 +1,56 @@
|
|||||||
|
From b81a228b5a680dff1dff911f1020c8494fbee935 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Daniel-Constantin Mierla <miconda@gmail.com>
|
||||||
|
Date: Wed, 15 Feb 2017 12:48:59 +0100
|
||||||
|
Subject: [PATCH] core: free parsed Required header structure
|
||||||
|
|
||||||
|
(cherry picked from commit d31558b31fd607f842caa04d85ce8870f6fc1740)
|
||||||
|
(cherry picked from commit 8a02d964ffc6145b3ae2f349b8d25aff4dacde3a)
|
||||||
|
---
|
||||||
|
parser/hf.c | 2 +-
|
||||||
|
parser/parse_require.c | 4 ++--
|
||||||
|
2 files changed, 3 insertions(+), 3 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/parser/hf.c b/parser/hf.c
|
||||||
|
index 963dd1471..915a52d2c 100644
|
||||||
|
--- a/parser/hf.c
|
||||||
|
+++ b/parser/hf.c
|
||||||
|
@@ -150,6 +150,7 @@ void clean_hdr_field(struct hdr_field* const hf)
|
||||||
|
free_subscription_state((subscription_state_t**)h_parsed);
|
||||||
|
break;
|
||||||
|
|
||||||
|
+ case HDR_REQUIRE_T:
|
||||||
|
case HDR_SUPPORTED_T:
|
||||||
|
hdr_free_parsed(h_parsed);
|
||||||
|
break;
|
||||||
|
@@ -168,7 +169,6 @@ void clean_hdr_field(struct hdr_field* const hf)
|
||||||
|
case HDR_CONTENTTYPE_T:
|
||||||
|
case HDR_CONTENTLENGTH_T:
|
||||||
|
case HDR_RETRY_AFTER_T:
|
||||||
|
- case HDR_REQUIRE_T:
|
||||||
|
case HDR_PROXYREQUIRE_T:
|
||||||
|
case HDR_UNSUPPORTED_T:
|
||||||
|
case HDR_ACCEPTLANGUAGE_T:
|
||||||
|
diff --git a/parser/parse_require.c b/parser/parse_require.c
|
||||||
|
index a520318e1..e343e7f17 100644
|
||||||
|
--- a/parser/parse_require.c
|
||||||
|
+++ b/parser/parse_require.c
|
||||||
|
@@ -1,6 +1,6 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2006 Andreas Granig <agranig@linguin.org>
|
||||||
|
- *
|
||||||
|
+ *
|
||||||
|
* This file is part of Kamailio, a free SIP server.
|
||||||
|
*
|
||||||
|
* Kamailio is free software; you can redistribute it and/or modify
|
||||||
|
@@ -65,7 +65,7 @@ int parse_require( struct sip_msg *msg)
|
||||||
|
require |= rb->option_tags;
|
||||||
|
}
|
||||||
|
|
||||||
|
- ((struct option_tag_body*)msg->require->parsed)->option_tags_all =
|
||||||
|
+ ((struct option_tag_body*)msg->require->parsed)->option_tags_all =
|
||||||
|
require;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
--
|
||||||
|
2.11.0
|
||||||
|
|
@ -0,0 +1,26 @@
|
|||||||
|
From 4844facff6b6ae66d7d1d9abd3c45bd470d5dfdc Mon Sep 17 00:00:00 2001
|
||||||
|
From: Daniel-Constantin Mierla <miconda@gmail.com>
|
||||||
|
Date: Wed, 15 Feb 2017 12:53:59 +0100
|
||||||
|
Subject: [PATCH] sanity: reset proxy_require hdr parsed field after freeing
|
||||||
|
|
||||||
|
(cherry picked from commit 06e219158131c2397a96bf5d3373c96752d7fd20)
|
||||||
|
(cherry picked from commit 51949e50e0308c9ec41cd95bfe2be3d64e24802d)
|
||||||
|
---
|
||||||
|
modules/sanity/sanity.c | 1 +
|
||||||
|
1 file changed, 1 insertion(+)
|
||||||
|
|
||||||
|
diff --git a/modules/sanity/sanity.c b/modules/sanity/sanity.c
|
||||||
|
index 8140c07b2..581219001 100644
|
||||||
|
--- a/modules/sanity/sanity.c
|
||||||
|
+++ b/modules/sanity/sanity.c
|
||||||
|
@@ -724,6 +724,7 @@ int check_proxy_require(struct sip_msg* _msg) {
|
||||||
|
* freed when the message freed. Lets hope nobody needs to access
|
||||||
|
* this header again later on */
|
||||||
|
free_str_list(_msg->proxy_require->parsed);
|
||||||
|
+ _msg->proxy_require->parsed = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#ifdef EXTRA_DEBUG
|
||||||
|
--
|
||||||
|
2.11.0
|
||||||
|
|
@ -0,0 +1,59 @@
|
|||||||
|
From 36814fafb02980e6165351e7cbe1acac0d11248d Mon Sep 17 00:00:00 2001
|
||||||
|
From: Victor Seva <linuxmaniac@torreviejawireless.org>
|
||||||
|
Date: Thu, 16 Feb 2017 12:19:41 +0100
|
||||||
|
Subject: [PATCH] pua_reginfo: fix memory leak when usrloc is DB_ONLY
|
||||||
|
|
||||||
|
As release_urecord() clearly says:
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Release urecord previously obtained through get_urecord
|
||||||
|
* \warning Failing to calls this function after get_urecord will
|
||||||
|
* result in a memory leak when the DB_ONLY mode is used. When
|
||||||
|
* the records is later deleted, e.g. with delete_urecord, then
|
||||||
|
* its not necessary, as this function already releases the record.
|
||||||
|
* \param _r released record
|
||||||
|
*/
|
||||||
|
|
||||||
|
(cherry picked from commit 1b0e1c3cbdd162fcd438a7d9bb412ddce73bc214)
|
||||||
|
---
|
||||||
|
modules/pua_reginfo/notify.c | 2 +-
|
||||||
|
modules/pua_reginfo/usrloc_cb.c | 3 ++-
|
||||||
|
2 files changed, 3 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/modules/pua_reginfo/notify.c b/modules/pua_reginfo/notify.c
|
||||||
|
index 4bdd4caa8..51e27eb6e 100644
|
||||||
|
--- a/modules/pua_reginfo/notify.c
|
||||||
|
+++ b/modules/pua_reginfo/notify.c
|
||||||
|
@@ -458,7 +458,7 @@ next_contact:
|
||||||
|
}
|
||||||
|
}
|
||||||
|
next_registration:
|
||||||
|
- // if (ul_record) ul.release_urecord(ul_record);
|
||||||
|
+ if (ul_record) ul.release_urecord(ul_record);
|
||||||
|
/* Unlock the domain for this AOR: */
|
||||||
|
if (aor_key.len > 0)
|
||||||
|
ul.unlock_udomain(domain, &aor_key);
|
||||||
|
diff --git a/modules/pua_reginfo/usrloc_cb.c b/modules/pua_reginfo/usrloc_cb.c
|
||||||
|
index 7f84788ac..3e00a0eae 100644
|
||||||
|
--- a/modules/pua_reginfo/usrloc_cb.c
|
||||||
|
+++ b/modules/pua_reginfo/usrloc_cb.c
|
||||||
|
@@ -223,7 +223,7 @@ void reginfo_usrloc_cb(ucontact_t* c, int type, void* param) {
|
||||||
|
publ_info_t publ;
|
||||||
|
str content_type;
|
||||||
|
udomain_t * domain;
|
||||||
|
- urecord_t * record;
|
||||||
|
+ urecord_t * record = NULL;
|
||||||
|
int res;
|
||||||
|
str uri = {NULL, 0};
|
||||||
|
str user = {NULL, 0};
|
||||||
|
@@ -332,6 +332,7 @@ error:
|
||||||
|
if(body->s) xmlFree(body->s);
|
||||||
|
pkg_free(body);
|
||||||
|
}
|
||||||
|
+ if(record) ul.release_urecord(record);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
--
|
||||||
|
2.11.0
|
||||||
|
|
@ -0,0 +1,129 @@
|
|||||||
|
From 5b34d844c2cf6caba5888f26789c1472802fb0b8 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Victor Seva <linuxmaniac@torreviejawireless.org>
|
||||||
|
Date: Fri, 17 Feb 2017 13:25:31 +0100
|
||||||
|
Subject: [PATCH] usrloc: fix ucontact shared leak
|
||||||
|
|
||||||
|
keep a copy of urecord if mode is DB_ONLY as it is static
|
||||||
|
preventing leaking ucontact to shared memory
|
||||||
|
|
||||||
|
Fix #1000
|
||||||
|
See #997 for details
|
||||||
|
|
||||||
|
(cherry picked from commit 819f9eae0066a94081b0805dadf69bd57050e4f0)
|
||||||
|
---
|
||||||
|
modules/usrloc/ucontact.c | 13 +++++++++++--
|
||||||
|
modules/usrloc/urecord.c | 35 ++++++++++++++++++++++++++++-------
|
||||||
|
2 files changed, 39 insertions(+), 9 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/modules/usrloc/ucontact.c b/modules/usrloc/ucontact.c
|
||||||
|
index 68e03593f..ea0e8db1b 100644
|
||||||
|
--- a/modules/usrloc/ucontact.c
|
||||||
|
+++ b/modules/usrloc/ucontact.c
|
||||||
|
@@ -1672,6 +1672,7 @@ static inline int update_contact_db(ucontact_t* _c)
|
||||||
|
*/
|
||||||
|
int update_ucontact(struct urecord* _r, ucontact_t* _c, ucontact_info_t* _ci)
|
||||||
|
{
|
||||||
|
+ struct urecord _ur;
|
||||||
|
/* we have to update memory in any case, but database directly
|
||||||
|
* only in db_mode 1 */
|
||||||
|
if (mem_update_ucontact( _c, _ci) < 0) {
|
||||||
|
@@ -1680,6 +1681,8 @@ int update_ucontact(struct urecord* _r, ucontact_t* _c, ucontact_info_t* _ci)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (db_mode==DB_ONLY) {
|
||||||
|
+ /* urecord is static generate a copy for later */
|
||||||
|
+ if (_r) memcpy(&_ur, _r, sizeof(struct urecord));
|
||||||
|
if (update_contact_db(_c) < 0) return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -1690,8 +1693,14 @@ int update_ucontact(struct urecord* _r, ucontact_t* _c, ucontact_info_t* _ci)
|
||||||
|
run_ul_callbacks( UL_CONTACT_UPDATE, _c);
|
||||||
|
}
|
||||||
|
|
||||||
|
- if (_r && db_mode!=DB_ONLY)
|
||||||
|
- update_contact_pos( _r, _c);
|
||||||
|
+ if (_r) {
|
||||||
|
+ if (db_mode!=DB_ONLY) {
|
||||||
|
+ update_contact_pos( _r, _c);
|
||||||
|
+ } else {
|
||||||
|
+ /* urecord was static restore copy */
|
||||||
|
+ memcpy(_r, &_ur, sizeof(struct urecord));
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
|
||||||
|
st_update_ucontact(_c);
|
||||||
|
|
||||||
|
diff --git a/modules/usrloc/urecord.c b/modules/usrloc/urecord.c
|
||||||
|
index a6e7cec77..821821d02 100644
|
||||||
|
--- a/modules/usrloc/urecord.c
|
||||||
|
+++ b/modules/usrloc/urecord.c
|
||||||
|
@@ -568,12 +568,16 @@ void release_urecord(urecord_t* _r)
|
||||||
|
int insert_ucontact(urecord_t* _r, str* _contact, ucontact_info_t* _ci,
|
||||||
|
ucontact_t** _c)
|
||||||
|
{
|
||||||
|
+ struct urecord _ur;
|
||||||
|
if ( ((*_c)=mem_insert_ucontact(_r, _contact, _ci)) == 0) {
|
||||||
|
LM_ERR("failed to insert contact\n");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (db_mode==DB_ONLY) {
|
||||||
|
+ /* urecord is static generate a copy for later */
|
||||||
|
+ memcpy(&_ur, _r, sizeof(struct urecord));
|
||||||
|
+
|
||||||
|
if (db_insert_ucontact(*_c) < 0) {
|
||||||
|
LM_ERR("failed to insert in database\n");
|
||||||
|
return -1;
|
||||||
|
@@ -586,13 +590,19 @@ int insert_ucontact(urecord_t* _r, str* _contact, ucontact_info_t* _ci,
|
||||||
|
run_ul_callbacks( UL_CONTACT_INSERT, *_c);
|
||||||
|
}
|
||||||
|
|
||||||
|
- if (db_mode == WRITE_THROUGH) {
|
||||||
|
- if (db_insert_ucontact(*_c) < 0) {
|
||||||
|
- LM_ERR("failed to insert in database\n");
|
||||||
|
- return -1;
|
||||||
|
- } else {
|
||||||
|
- (*_c)->state = CS_SYNC;
|
||||||
|
- }
|
||||||
|
+ switch (db_mode) {
|
||||||
|
+ case WRITE_THROUGH:
|
||||||
|
+ if (db_insert_ucontact(*_c) < 0) {
|
||||||
|
+ LM_ERR("failed to insert in database\n");
|
||||||
|
+ return -1;
|
||||||
|
+ } else {
|
||||||
|
+ (*_c)->state = CS_SYNC;
|
||||||
|
+ }
|
||||||
|
+ break;
|
||||||
|
+ case DB_ONLY:
|
||||||
|
+ /* urecord was static restore copy */
|
||||||
|
+ memcpy(_r, &_ur, sizeof(struct urecord));
|
||||||
|
+ break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
@@ -608,11 +618,22 @@ int insert_ucontact(urecord_t* _r, str* _contact, ucontact_info_t* _ci,
|
||||||
|
int delete_ucontact(urecord_t* _r, struct ucontact* _c)
|
||||||
|
{
|
||||||
|
int ret = 0;
|
||||||
|
+ struct urecord _ur;
|
||||||
|
+
|
||||||
|
+ if (db_mode==DB_ONLY) {
|
||||||
|
+ /* urecord is static generate a copy for later */
|
||||||
|
+ memcpy(&_ur, _r, sizeof(struct urecord));
|
||||||
|
+ }
|
||||||
|
|
||||||
|
if (exists_ulcb_type(UL_CONTACT_DELETE)) {
|
||||||
|
run_ul_callbacks( UL_CONTACT_DELETE, _c);
|
||||||
|
}
|
||||||
|
|
||||||
|
+ if (db_mode==DB_ONLY) {
|
||||||
|
+ /* urecord was static restore copy */
|
||||||
|
+ memcpy(_r, &_ur, sizeof(struct urecord));
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
if (st_delete_ucontact(_c) > 0) {
|
||||||
|
if (db_mode == WRITE_THROUGH || db_mode==DB_ONLY) {
|
||||||
|
if (db_delete_ucontact(_c) < 0) {
|
||||||
|
--
|
||||||
|
2.11.0
|
||||||
|
|
@ -1,12 +1,16 @@
|
|||||||
From eb980e6bc633a91751ceb9f3187587e52e383535 Mon Sep 17 00:00:00 2001
|
From 4a41962b0389f37dbc4d905afd25e2cda5e7c39c Mon Sep 17 00:00:00 2001
|
||||||
From: Victor Seva <linuxmaniac@torreviejawireless.org>
|
From: Victor Seva <linuxmaniac@torreviejawireless.org>
|
||||||
Date: Tue, 31 Jan 2017 18:46:11 +0100
|
Date: Tue, 31 Jan 2017 19:23:53 +0100
|
||||||
Subject: [PATCH] presence: remove transaction creation from
|
Subject: [PATCH] presence: remove transaction creation from
|
||||||
publ_notify_notifier() and mark_presentity_for_delete()
|
publ_notify_notifier() and mark_presentity_for_delete()
|
||||||
|
|
||||||
* publ_notify_notifier() and mark_presentity_for_delete() are
|
* publ_notify_notifier() and mark_presentity_for_delete() are
|
||||||
called inside a already created transaction
|
called inside a already created transaction
|
||||||
* adding transaction handle for msg_presentity_clean()
|
* adding transaction handle for msg_presentity_clean()
|
||||||
|
|
||||||
|
fix #960
|
||||||
|
|
||||||
|
(cherry picked from commit 6d157a4af708108b90a338614869de0ceeb94b68)
|
||||||
---
|
---
|
||||||
modules/presence/notify.c | 24 ------------------------
|
modules/presence/notify.c | 24 ------------------------
|
||||||
modules/presence/presentity.c | 24 ------------------------
|
modules/presence/presentity.c | 24 ------------------------
|
Loading…
Reference in new issue