mirror of https://github.com/sipwise/kamailio.git
Change-Id: Ied4acd062880b805a8aa314933236a82c814df06changes/30/14430/1
parent
c6b0722aa7
commit
8fb71b4b09
@ -1,25 +0,0 @@
|
||||
From c5d76e3282fa49e53ee1bc6e25c6a0315f0aadcb Mon Sep 17 00:00:00 2001
|
||||
From: lazedo <luis.azedo@factorlusitano.com>
|
||||
Date: Tue, 24 Jan 2017 01:11:35 +0000
|
||||
Subject: [PATCH] tm: apply new updates with Via with updated request
|
||||
|
||||
---
|
||||
modules/tm/uac.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/modules/tm/uac.c b/modules/tm/uac.c
|
||||
index 8c3a485a8..93ed0c912 100644
|
||||
--- a/modules/tm/uac.c
|
||||
+++ b/modules/tm/uac.c
|
||||
@@ -426,7 +426,7 @@ static inline int t_uac_prepare(uac_req_t *uac_r,
|
||||
|
||||
LM_DBG("apply new updates with Via to sip msg\n");
|
||||
buf1 = build_req_buf_from_sip_req(&lreq,
|
||||
- (unsigned int*)&buf_len1, &dst, BUILD_IN_SHM);
|
||||
+ (unsigned int*)&buf_len1, &request->dst, BUILD_IN_SHM);
|
||||
if (likely(buf1)){
|
||||
shm_free(buf);
|
||||
buf = buf1;
|
||||
--
|
||||
2.11.0
|
||||
|
||||
@ -1,29 +0,0 @@
|
||||
From d3814d47ec92091dbf524bdabaa3c1fc71ed2c80 Mon Sep 17 00:00:00 2001
|
||||
From: lazedo <luis.azedo@factorlusitano.com>
|
||||
Date: Tue, 24 Jan 2017 02:58:54 +0000
|
||||
Subject: [PATCH] presence: free pointer after usage
|
||||
|
||||
discovered when using tlsf memory manager.
|
||||
(cherry picked from commit dc518f6973f81b71264036b138dd6293eef58ed2)
|
||||
---
|
||||
modules/presence/notify.c | 3 +--
|
||||
1 file changed, 1 insertion(+), 2 deletions(-)
|
||||
|
||||
diff --git a/modules/presence/notify.c b/modules/presence/notify.c
|
||||
index 04ee88f12..9e5037517 100644
|
||||
--- a/modules/presence/notify.c
|
||||
+++ b/modules/presence/notify.c
|
||||
@@ -982,9 +982,8 @@ dlg_t* ps_build_dlg_t(subs_t* subs)
|
||||
pkg_free(tmp);
|
||||
goto error;
|
||||
}
|
||||
+ td->send_sock = grep_sock_info (&host, (unsigned short) port, (unsigned short) proto);
|
||||
pkg_free(tmp);
|
||||
- td->send_sock = grep_sock_info (
|
||||
- &host, (unsigned short) port, (unsigned short) proto);
|
||||
}
|
||||
|
||||
return td;
|
||||
--
|
||||
2.11.0
|
||||
|
||||
@ -1,27 +0,0 @@
|
||||
From bd8ca7573c3b840846f346a97de927fec2d04d6b Mon Sep 17 00:00:00 2001
|
||||
From: Daniel-Constantin Mierla <miconda@gmail.com>
|
||||
Date: Wed, 25 Jan 2017 14:45:51 +0100
|
||||
Subject: [PATCH] htable: use custom column name for order by in db load
|
||||
|
||||
- reported by Sebastian Damm, GH #948
|
||||
|
||||
(cherry picked from commit a9ffc2a1f7514a7bd4ff0e294e3bcb50d3a2bf07)
|
||||
---
|
||||
modules/htable/ht_db.c | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/modules/htable/ht_db.c b/modules/htable/ht_db.c
|
||||
index e1ab7daa7..d5a5a548f 100644
|
||||
--- a/modules/htable/ht_db.c
|
||||
+++ b/modules/htable/ht_db.c
|
||||
@@ -204,6 +204,7 @@ int ht_db_load_table(ht_t *ht, str *dbtable, int mode)
|
||||
return -1;
|
||||
}
|
||||
if(ht->ncols>0) {
|
||||
+ db_ord = &ht->scols[0];
|
||||
for(c=0; c<ht->ncols; c++) {
|
||||
db_cols[c] = &ht->scols[c];
|
||||
}
|
||||
--
|
||||
2.11.0
|
||||
|
||||
@ -1,31 +0,0 @@
|
||||
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
|
||||
|
||||
@ -1,37 +0,0 @@
|
||||
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
|
||||
|
||||
@ -1,46 +0,0 @@
|
||||
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
|
||||
|
||||
@ -1,72 +0,0 @@
|
||||
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
|
||||
|
||||
@ -1,140 +0,0 @@
|
||||
From a321025984d183f9c727fa4c9fcdc1e2e87010bf Mon Sep 17 00:00:00 2001
|
||||
From: Richard Fuchs <rfuchs@sipwise.com>
|
||||
Date: Fri, 3 Feb 2017 10:10:23 -0500
|
||||
Subject: [PATCH] rtpengine: fix segfault when enabling a proxy
|
||||
|
||||
---
|
||||
modules/rtpengine/rtpengine.c | 51 +++++++++++++++++--------------------------
|
||||
1 file changed, 20 insertions(+), 31 deletions(-)
|
||||
|
||||
diff --git a/modules/rtpengine/rtpengine.c b/modules/rtpengine/rtpengine.c
|
||||
index 6b460743e..01f1606bf 100644
|
||||
--- a/modules/rtpengine/rtpengine.c
|
||||
+++ b/modules/rtpengine/rtpengine.c
|
||||
@@ -194,7 +194,7 @@ static struct rtpp_node *select_rtpp_node_new(str, str, int, struct rtpp_node **
|
||||
static struct rtpp_node *select_rtpp_node_old(str, str, int, enum rtpe_operation);
|
||||
static struct rtpp_node *select_rtpp_node(str, str, int, struct rtpp_node **, int, enum rtpe_operation);
|
||||
static int is_queried_node(struct rtpp_node *, struct rtpp_node **, int);
|
||||
-static int build_rtpp_socks(unsigned int current_rtpp_no);
|
||||
+static int build_rtpp_socks();
|
||||
static char *send_rtpp_command(struct rtpp_node *, bencode_item_t *, int *);
|
||||
static int get_extra_id(struct sip_msg* msg, str *id_str);
|
||||
|
||||
@@ -1068,6 +1068,9 @@ static struct mi_root* mi_enable_rtp_proxy(struct mi_root *cmd_tree, void *param
|
||||
str rtpp_url;
|
||||
str snode, sattr, svalue;
|
||||
|
||||
+ if (build_rtpp_socks())
|
||||
+ return init_mi_tree(400, MI_DB_ERR, MI_DB_ERR_LEN);
|
||||
+
|
||||
found = MI_FOUND_NONE;
|
||||
found_rtpp_disabled = 0;
|
||||
found_rtpp = NULL;
|
||||
@@ -1412,6 +1415,9 @@ static struct mi_root* mi_ping_rtp_proxy(struct mi_root* cmd_tree, void* param)
|
||||
str rtpp_url;
|
||||
str snode, sattr, svalue;
|
||||
|
||||
+ if (build_rtpp_socks())
|
||||
+ return init_mi_tree(400, MI_DB_ERR, MI_DB_ERR_LEN);
|
||||
+
|
||||
found = 0;
|
||||
found_rtpp_disabled = 0;
|
||||
found_rtpp = NULL;
|
||||
@@ -1576,7 +1582,6 @@ static struct mi_root*
|
||||
mi_reload_rtp_proxy(struct mi_root* cmd_tree, void* param)
|
||||
{
|
||||
struct mi_root *root = NULL;
|
||||
- unsigned int current_rtpp_no;
|
||||
|
||||
if (rtpp_db_url.s == NULL) {
|
||||
// no database
|
||||
@@ -1594,13 +1599,7 @@ mi_reload_rtp_proxy(struct mi_root* cmd_tree, void* param)
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
- lock_get(rtpp_no_lock);
|
||||
- current_rtpp_no = *rtpp_no;
|
||||
- lock_release(rtpp_no_lock);
|
||||
-
|
||||
- if (rtpp_socks_size != current_rtpp_no) {
|
||||
- build_rtpp_socks(current_rtpp_no);
|
||||
- }
|
||||
+ build_rtpp_socks();
|
||||
|
||||
// success reloading from database
|
||||
root = init_mi_tree(200, MI_DB_OK, MI_DB_OK_LEN);
|
||||
@@ -1795,16 +1794,24 @@ mod_init(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
-static int build_rtpp_socks(unsigned int current_rtpp_no) {
|
||||
+static int build_rtpp_socks() {
|
||||
int n, i;
|
||||
char *cp;
|
||||
struct addrinfo hints, *res;
|
||||
struct rtpp_set *rtpp_list;
|
||||
struct rtpp_node *pnode;
|
||||
+ unsigned int current_rtpp_no;
|
||||
#ifdef IP_MTU_DISCOVER
|
||||
int ip_mtu_discover = IP_PMTUDISC_DONT;
|
||||
#endif
|
||||
|
||||
+ lock_get(rtpp_no_lock);
|
||||
+ current_rtpp_no = *rtpp_no;
|
||||
+ lock_release(rtpp_no_lock);
|
||||
+
|
||||
+ if (current_rtpp_no == rtpp_socks_size)
|
||||
+ return 0;
|
||||
+
|
||||
// close current sockets
|
||||
for (i = 0; i < rtpp_socks_size; i++) {
|
||||
if (rtpp_socks[i] >= 0) {
|
||||
@@ -1920,16 +1927,6 @@ child_init(int rank)
|
||||
|
||||
mypid = getpid();
|
||||
|
||||
- lock_get(rtpp_no_lock);
|
||||
- rtpp_socks_size = *rtpp_no;
|
||||
- lock_release(rtpp_no_lock);
|
||||
-
|
||||
- rtpp_socks = (int*)pkg_malloc(sizeof(int)*(rtpp_socks_size));
|
||||
- if (!rtpp_socks) {
|
||||
- return -1;
|
||||
- }
|
||||
- memset(rtpp_socks, -1, sizeof(int)*(rtpp_socks_size));
|
||||
-
|
||||
// vector of pointers to queried nodes
|
||||
queried_nodes_ptr = (struct rtpp_node**)pkg_malloc(queried_nodes_limit * sizeof(struct rtpp_node*));
|
||||
if (!queried_nodes_ptr) {
|
||||
@@ -1939,9 +1936,8 @@ child_init(int rank)
|
||||
memset(queried_nodes_ptr, 0, queried_nodes_limit * sizeof(struct rtpp_node*));
|
||||
|
||||
/* Iterate known RTP proxies - create sockets */
|
||||
- if (rtpp_socks_size) {
|
||||
- build_rtpp_socks(rtpp_socks_size);
|
||||
- }
|
||||
+ if (build_rtpp_socks())
|
||||
+ return -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -2844,15 +2840,8 @@ static struct rtpp_node *
|
||||
select_rtpp_node(str callid, str viabranch, int do_test, struct rtpp_node **queried_nodes_ptr, int queried_nodes, enum rtpe_operation op)
|
||||
{
|
||||
struct rtpp_node *node = NULL;
|
||||
- unsigned int current_rtpp_no;
|
||||
|
||||
- lock_get(rtpp_no_lock);
|
||||
- current_rtpp_no = *rtpp_no;
|
||||
- lock_release(rtpp_no_lock);
|
||||
-
|
||||
- if (rtpp_socks_size != current_rtpp_no) {
|
||||
- build_rtpp_socks(current_rtpp_no);
|
||||
- }
|
||||
+ build_rtpp_socks();
|
||||
|
||||
if (!active_rtpp_set) {
|
||||
default_rtpp_set = select_rtpp_set(setid_default);
|
||||
--
|
||||
2.11.0
|
||||
|
||||
@ -1,56 +0,0 @@
|
||||
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
|
||||
|
||||
@ -1,26 +0,0 @@
|
||||
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
|
||||
|
||||
@ -1,59 +0,0 @@
|
||||
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
|
||||
|
||||
@ -1,129 +0,0 @@
|
||||
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,172 +0,0 @@
|
||||
From 4a41962b0389f37dbc4d905afd25e2cda5e7c39c Mon Sep 17 00:00:00 2001
|
||||
From: Victor Seva <linuxmaniac@torreviejawireless.org>
|
||||
Date: Tue, 31 Jan 2017 19:23:53 +0100
|
||||
Subject: [PATCH] presence: remove transaction creation from
|
||||
publ_notify_notifier() and mark_presentity_for_delete()
|
||||
|
||||
* publ_notify_notifier() and mark_presentity_for_delete() are
|
||||
called inside a already created transaction
|
||||
* adding transaction handle for msg_presentity_clean()
|
||||
|
||||
fix #960
|
||||
|
||||
(cherry picked from commit 6d157a4af708108b90a338614869de0ceeb94b68)
|
||||
---
|
||||
modules/presence/notify.c | 24 ------------------------
|
||||
modules/presence/presentity.c | 24 ------------------------
|
||||
modules/presence/publish.c | 26 ++++++++++++++++++++++++++
|
||||
3 files changed, 26 insertions(+), 48 deletions(-)
|
||||
|
||||
diff --git a/modules/presence/notify.c b/modules/presence/notify.c
|
||||
index 9e5037517..354dc1dbb 100644
|
||||
--- a/modules/presence/notify.c
|
||||
+++ b/modules/presence/notify.c
|
||||
@@ -1348,15 +1348,6 @@ int publ_notify_notifier(str pres_uri, pres_ev_t *event)
|
||||
result_cols[r_to_tag_col=n_result_cols++] = &str_to_tag_col;
|
||||
result_cols[r_from_tag_col=n_result_cols++] = &str_from_tag_col;
|
||||
|
||||
- if (pa_dbf.start_transaction)
|
||||
- {
|
||||
- if (pa_dbf.start_transaction(pa_db, db_table_lock) < 0)
|
||||
- {
|
||||
- LM_ERR("in start_transaction\n");
|
||||
- goto error;
|
||||
- }
|
||||
- }
|
||||
-
|
||||
if(query_fn(pa_db, query_cols, 0, query_vals, result_cols,
|
||||
n_query_cols, n_result_cols, 0, &result )< 0)
|
||||
{
|
||||
@@ -1385,26 +1376,11 @@ int publ_notify_notifier(str pres_uri, pres_ev_t *event)
|
||||
set_updated(&subs);
|
||||
}
|
||||
|
||||
- if (pa_dbf.end_transaction)
|
||||
- {
|
||||
- if (pa_dbf.end_transaction(pa_db) < 0)
|
||||
- {
|
||||
- LM_ERR("in end_transaction\n");
|
||||
- goto error;
|
||||
- }
|
||||
- }
|
||||
-
|
||||
ret = RES_ROW_N(result);
|
||||
|
||||
error:
|
||||
if (result) pa_dbf.free_result(pa_db, result);
|
||||
|
||||
- if (pa_dbf.abort_transaction)
|
||||
- {
|
||||
- if (pa_dbf.abort_transaction(pa_db) < 0)
|
||||
- LM_ERR("in abort_transaction\n");
|
||||
- }
|
||||
-
|
||||
return ret;
|
||||
}
|
||||
|
||||
diff --git a/modules/presence/presentity.c b/modules/presence/presentity.c
|
||||
index 3f79cfa4e..b515149e3 100644
|
||||
--- a/modules/presence/presentity.c
|
||||
+++ b/modules/presence/presentity.c
|
||||
@@ -1564,15 +1564,6 @@ int mark_presentity_for_delete(presentity_t *pres)
|
||||
|
||||
result_cols[0] = &str_body_col;
|
||||
|
||||
- if (pa_dbf.start_transaction)
|
||||
- {
|
||||
- if (pa_dbf.start_transaction(pa_db, db_table_lock) < 0)
|
||||
- {
|
||||
- LM_ERR("in start_transaction\n");
|
||||
- goto error;
|
||||
- }
|
||||
- }
|
||||
-
|
||||
if (query_fn(pa_db, query_cols, 0, query_vals, result_cols,
|
||||
n_query_cols, 1, 0, &result) < 0)
|
||||
{
|
||||
@@ -1653,15 +1644,6 @@ int mark_presentity_for_delete(presentity_t *pres)
|
||||
goto error;
|
||||
}
|
||||
|
||||
- if (pa_dbf.end_transaction)
|
||||
- {
|
||||
- if (pa_dbf.end_transaction(pa_db) < 0)
|
||||
- {
|
||||
- LM_ERR("in end_transaction\n");
|
||||
- goto error;
|
||||
- }
|
||||
- }
|
||||
-
|
||||
if (pa_dbf.affected_rows)
|
||||
ret = pa_dbf.affected_rows(pa_db);
|
||||
else
|
||||
@@ -1673,12 +1655,6 @@ error:
|
||||
if (cur_body) pkg_free(cur_body);
|
||||
if (result) pa_dbf.free_result(pa_db, result);
|
||||
|
||||
- if (pa_dbf.abort_transaction)
|
||||
- {
|
||||
- if (pa_dbf.abort_transaction(pa_db) < 0)
|
||||
- LM_ERR("in abort_transaction\n");
|
||||
- }
|
||||
-
|
||||
return ret;
|
||||
}
|
||||
|
||||
diff --git a/modules/presence/publish.c b/modules/presence/publish.c
|
||||
index 73a64c6db..8249aa4b7 100644
|
||||
--- a/modules/presence/publish.c
|
||||
+++ b/modules/presence/publish.c
|
||||
@@ -156,9 +156,22 @@ void msg_presentity_clean(unsigned int ticks,void *param)
|
||||
|
||||
if (pres_notifier_processes > 0)
|
||||
{
|
||||
+ if (pa_dbf.start_transaction)
|
||||
+ {
|
||||
+ if (pa_dbf.start_transaction(pa_db, db_table_lock) < 0)
|
||||
+ {
|
||||
+ LM_ERR("in start_transaction\n");
|
||||
+ goto error;
|
||||
+ }
|
||||
+ }
|
||||
if ((num_watchers = publ_notify_notifier(uri, pres.event)) < 0)
|
||||
{
|
||||
LM_ERR("Updating watcher records\n");
|
||||
+ if (pa_dbf.abort_transaction)
|
||||
+ {
|
||||
+ if (pa_dbf.abort_transaction(pa_db) < 0)
|
||||
+ LM_ERR("in abort_transaction\n");
|
||||
+ }
|
||||
goto error;
|
||||
}
|
||||
|
||||
@@ -167,6 +180,11 @@ void msg_presentity_clean(unsigned int ticks,void *param)
|
||||
if (mark_presentity_for_delete(&pres) < 0)
|
||||
{
|
||||
LM_ERR("Marking presentity\n");
|
||||
+ if (pa_dbf.abort_transaction)
|
||||
+ {
|
||||
+ if (pa_dbf.abort_transaction(pa_db) < 0)
|
||||
+ LM_ERR("in abort_transaction\n");
|
||||
+ }
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
@@ -178,6 +196,14 @@ void msg_presentity_clean(unsigned int ticks,void *param)
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
+ if (pa_dbf.end_transaction)
|
||||
+ {
|
||||
+ if (pa_dbf.end_transaction(pa_db) < 0)
|
||||
+ {
|
||||
+ LM_ERR("in end_transaction\n");
|
||||
+ goto error;
|
||||
+ }
|
||||
+ }
|
||||
}
|
||||
else
|
||||
{
|
||||
--
|
||||
2.11.0
|
||||
|
||||
@ -1,57 +0,0 @@
|
||||
From 406c02f7b76ada56d6e1f73e763fecb05c1f51c5 Mon Sep 17 00:00:00 2001
|
||||
From: Daniel-Constantin Mierla <miconda@gmail.com>
|
||||
Date: Fri, 31 Mar 2017 12:56:52 +0200
|
||||
Subject: [PATCH] tls: do kerberos and zlib init checks only for libssl < 1.1.0
|
||||
|
||||
- using string matching inside libssl compile flags is no longer
|
||||
reliable
|
||||
- reported by GH #1050
|
||||
|
||||
(cherry picked from commit e59fa823b7b9513d3d1adb958d5e8ec055082d83)
|
||||
(cherry picked from commit b12ac4ea9efae41b83a2664ea4f25b1d59bc2032)
|
||||
---
|
||||
modules/tls/tls_init.c | 9 +++++++++
|
||||
1 file changed, 9 insertions(+)
|
||||
|
||||
diff --git a/modules/tls/tls_init.c b/modules/tls/tls_init.c
|
||||
index af2d4c54e..133bc7fc8 100644
|
||||
--- a/modules/tls/tls_init.c
|
||||
+++ b/modules/tls/tls_init.c
|
||||
@@ -563,11 +563,13 @@ int init_tls_h(void)
|
||||
{
|
||||
/*struct socket_info* si;*/
|
||||
long ssl_version;
|
||||
+#if OPENSSL_VERSION_NUMBER < 0x010100000L
|
||||
int lib_kerberos;
|
||||
int lib_zlib;
|
||||
int kerberos_support;
|
||||
int comp_support;
|
||||
const char* lib_cflags;
|
||||
+#endif
|
||||
int low_mem_threshold1;
|
||||
int low_mem_threshold2;
|
||||
str tls_grp;
|
||||
@@ -603,6 +605,10 @@ int init_tls_h(void)
|
||||
else
|
||||
return -1; /* safer to exit */
|
||||
}
|
||||
+
|
||||
+/* check kerberos support using compile flags only for version < 1.1.0 */
|
||||
+#if OPENSSL_VERSION_NUMBER < 0x010100000L
|
||||
+
|
||||
#ifdef TLS_KERBEROS_SUPPORT
|
||||
kerberos_support=1;
|
||||
#else
|
||||
@@ -672,6 +678,9 @@ int init_tls_h(void)
|
||||
" kerberos support will be disabled...\n");
|
||||
}
|
||||
#endif
|
||||
+
|
||||
+#endif /* libssl version < 1.1.0 (OPENSSL_VERSION_NUMBER < 0x010100000L) */
|
||||
+
|
||||
/* set free memory threshold for openssl bug #1491 workaround */
|
||||
low_mem_threshold1 = cfg_get(tls, tls_cfg, low_mem_threshold1);
|
||||
low_mem_threshold2 = cfg_get(tls, tls_cfg, low_mem_threshold2);
|
||||
--
|
||||
2.11.0
|
||||
|
||||
@ -1,129 +0,0 @@
|
||||
From b7bd4beabe76b01342afb4eb84ea4a4a68863efe Mon Sep 17 00:00:00 2001
|
||||
From: Victor Seva <linuxmaniac@torreviejawireless.org>
|
||||
Date: Sun, 4 Jun 2017 12:46:59 +0200
|
||||
Subject: [PATCH 54/55] pv: fix pv_var_to_xavp() and pv_xavp_to_var() functions
|
||||
|
||||
* xavp was not properly created at pv_var_to_xavp()
|
||||
* add proper xavp loop for pv_xavp_to_var()
|
||||
---
|
||||
modules/pv/pv_xavp.c | 54 ++++++++++++++++++++++++++++++++++------------------
|
||||
1 file changed, 35 insertions(+), 19 deletions(-)
|
||||
|
||||
diff --git a/modules/pv/pv_xavp.c b/modules/pv/pv_xavp.c
|
||||
index 28bb06ed2..d6fd83d95 100644
|
||||
--- a/modules/pv/pv_xavp.c
|
||||
+++ b/modules/pv/pv_xavp.c
|
||||
@@ -622,7 +622,7 @@ int xavp_params_explode(str *params, str *xname)
|
||||
int pv_var_to_xavp(str *varname, str *xname)
|
||||
{
|
||||
script_var_t *it;
|
||||
- sr_xavp_t *xavp = NULL;
|
||||
+ sr_xavp_t *avp = NULL;
|
||||
sr_xval_t xval;
|
||||
|
||||
LM_DBG("xname:%.*s varname:%.*s\n", xname->len, xname->s,
|
||||
@@ -638,18 +638,29 @@ int pv_var_to_xavp(str *varname, str *xname)
|
||||
{
|
||||
xval.type = SR_XTYPE_INT;
|
||||
xval.v.i = it->v.value.n;
|
||||
+ LM_DBG("[%.*s]: %d\n", it->name.len, it->name.s, xval.v.i);
|
||||
} else {
|
||||
if(it->v.value.s.len==0) continue;
|
||||
xval.type = SR_XTYPE_STR;
|
||||
xval.v.s.s = it->v.value.s.s;
|
||||
xval.v.s.len = it->v.value.s.len;
|
||||
+ LM_DBG("[%.*s]: '%.*s'\n", it->name.len, it->name.s,
|
||||
+ xval.v.s.len, xval.v.s.s);
|
||||
}
|
||||
- xavp = xavp_add_xavp_value(xname, &it->name, &xval, NULL);
|
||||
- if(xavp==NULL) {
|
||||
+ if(xavp_add_value(&it->name, &xval, &avp)==NULL) {
|
||||
LM_ERR("can't copy [%.*s]\n", it->name.len, it->name.s);
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
+ if(avp) {
|
||||
+ memset(&xval, 0, sizeof(sr_xval_t));
|
||||
+ xval.type = SR_XTYPE_XAVP;
|
||||
+ xval.v.xavp = avp;
|
||||
+ if(xavp_add_value(xname, &xval, NULL)==NULL) {
|
||||
+ LM_ERR("Can't create xavp[%.*s]\n", xname->len, xname->s);
|
||||
+ goto error;
|
||||
+ }
|
||||
+ }
|
||||
}
|
||||
else {
|
||||
it = get_var_by_name(varname);
|
||||
@@ -662,21 +673,23 @@ int pv_var_to_xavp(str *varname, str *xname)
|
||||
{
|
||||
xval.type = SR_XTYPE_INT;
|
||||
xval.v.i = it->v.value.n;
|
||||
+ LM_DBG("[%.*s]: %d\n", it->name.len, it->name.s, xval.v.i);
|
||||
} else {
|
||||
xval.type = SR_XTYPE_STR;
|
||||
xval.v.s.s = it->v.value.s.s;
|
||||
xval.v.s.len = it->v.value.s.len;
|
||||
+ LM_DBG("[%.*s]: '%.*s'\n", it->name.len, it->name.s,
|
||||
+ xval.v.s.len, xval.v.s.s);
|
||||
}
|
||||
- xavp = xavp_add_xavp_value(xname, &it->name, &xval, NULL);
|
||||
- if(xavp==NULL) {
|
||||
+ if(xavp_add_xavp_value(xname, &it->name, &xval, NULL)==NULL) {
|
||||
LM_ERR("can't copy [%.*s]\n", it->name.len, it->name.s);
|
||||
- goto error;
|
||||
+ return -1;
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
|
||||
error:
|
||||
- xavp_rm_by_name(xname, 1, NULL);
|
||||
+ if(avp) xavp_destroy_list(&avp);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -691,7 +704,7 @@ int pv_xavp_to_var_helper(sr_xavp_t *avp) {
|
||||
flags |= VAR_VAL_STR;
|
||||
value.s.len = avp->val.v.s.len;
|
||||
value.s.s = avp->val.v.s.s;
|
||||
- LM_DBG("var:[%.*s] STR:[%.*s]\n", avp->name.len, avp->name.s,
|
||||
+ LM_DBG("var:[%.*s] STR:[%.*s]\n", avp->name.len, avp->name.s,
|
||||
value.s.len, value.s.s);
|
||||
}
|
||||
else if(avp->val.type==SR_XTYPE_INT) {
|
||||
@@ -723,18 +736,21 @@ int pv_xavp_to_var(str *xname) {
|
||||
LM_ERR("%.*s not xavp type?\n", xname->len, xname->s);
|
||||
return -1;
|
||||
}
|
||||
- avp = xavp->val.v.xavp;
|
||||
- if (avp)
|
||||
- {
|
||||
- if(pv_xavp_to_var_helper(avp)<0) return -1;
|
||||
- avp = avp->next;
|
||||
- }
|
||||
+ do {
|
||||
+ avp = xavp->val.v.xavp;
|
||||
+ if (avp)
|
||||
+ {
|
||||
+ if(pv_xavp_to_var_helper(avp)<0) return -1;
|
||||
+ avp = avp->next;
|
||||
+ }
|
||||
|
||||
- while(avp)
|
||||
- {
|
||||
- if(pv_xavp_to_var_helper(avp)<0) return -1;
|
||||
- avp = avp->next;
|
||||
- }
|
||||
+ while(avp)
|
||||
+ {
|
||||
+ if(pv_xavp_to_var_helper(avp)<0) return -1;
|
||||
+ avp = avp->next;
|
||||
+ }
|
||||
+ xavp = xavp_get_next(xavp);
|
||||
+ } while(xavp);
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
--
|
||||
2.11.0
|
||||
|
||||
@ -1,58 +0,0 @@
|
||||
From: Victor Seva <linuxmaniac@torreviejawireless.org>
|
||||
Date: Tue, 23 May 2017 18:07:54 +0200
|
||||
Subject: core: fix mem_summary comparation when SIGUSR1 is received
|
||||
|
||||
>From http://www.kamailio.org/wiki/cookbooks/4.4.x/core#mem_summary
|
||||
1 - dump all the pkg used blocks (status)
|
||||
2 - dump all the shm used blocks (status)
|
||||
4 - summary of pkg used blocks
|
||||
8 - summary of shm used blocks
|
||||
---
|
||||
main.c | 10 +++++-----
|
||||
1 file changed, 5 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/main.c b/main.c
|
||||
index 8b2e8e8..b6f68df 100644
|
||||
--- a/main.c
|
||||
+++ b/main.c
|
||||
@@ -709,7 +709,7 @@ void handle_sigs(void)
|
||||
LOG(memlog, "Memory status (pkg):\n");
|
||||
pkg_status();
|
||||
}
|
||||
- if (cfg_get(core, core_cfg, mem_summary) & 2) {
|
||||
+ if (cfg_get(core, core_cfg, mem_summary) & 4) {
|
||||
LOG(memlog, "Memory still-in-use summary (pkg):\n");
|
||||
pkg_sums();
|
||||
}
|
||||
@@ -717,11 +717,11 @@ void handle_sigs(void)
|
||||
#endif
|
||||
#ifdef SHM_MEM
|
||||
if (memlog <= cfg_get(core, core_cfg, debug)){
|
||||
- if (cfg_get(core, core_cfg, mem_summary) & 1) {
|
||||
+ if (cfg_get(core, core_cfg, mem_summary) & 2) {
|
||||
LOG(memlog, "Memory status (shm):\n");
|
||||
shm_status();
|
||||
}
|
||||
- if (cfg_get(core, core_cfg, mem_summary) & 2) {
|
||||
+ if (cfg_get(core, core_cfg, mem_summary) & 8) {
|
||||
LOG(memlog, "Memory still-in-use summary (shm):\n");
|
||||
shm_sums();
|
||||
}
|
||||
@@ -821,7 +821,7 @@ void sig_usr(int signo)
|
||||
LOG(memlog, "Memory status (pkg):\n");
|
||||
pkg_status();
|
||||
}
|
||||
- if (cfg_get(core, core_cfg, mem_summary) & 2) {
|
||||
+ if (cfg_get(core, core_cfg, mem_summary) & 4) {
|
||||
LOG(memlog, "Memory still-in-use summary (pkg):"
|
||||
"\n");
|
||||
pkg_sums();
|
||||
@@ -840,7 +840,7 @@ void sig_usr(int signo)
|
||||
LOG(memlog, "Memory status (pkg):\n");
|
||||
pkg_status();
|
||||
}
|
||||
- if (cfg_get(core, core_cfg, mem_summary) & 2) {
|
||||
+ if (cfg_get(core, core_cfg, mem_summary) & 4) {
|
||||
LOG(memlog, "Memory still-in-use summary (pkg):\n");
|
||||
pkg_sums();
|
||||
}
|
||||
@ -1,188 +0,0 @@
|
||||
From 642f096ed2ba9ea5b53696197f863a7e586b88c6 Mon Sep 17 00:00:00 2001
|
||||
From: Daniel-Constantin Mierla <miconda@gmail.com>
|
||||
Date: Wed, 26 Apr 2017 15:23:24 +0200
|
||||
Subject: [PATCH] dialog: more safety checks to detect if dialog is gone after
|
||||
event route execution
|
||||
|
||||
- avoid execution of script callbacks for event route
|
||||
- related to GH #1059 and #1069
|
||||
- backport of a8b7f94a5c305e14313d5528792f9ca6518d5969
|
||||
|
||||
(cherry picked from commit d95f09670a0d3d0c997c7f1c94eb66bdd4c4da0f)
|
||||
---
|
||||
modules/dialog/dlg_handlers.c | 43 +++++++++++++++++++++++++++++++++++--------
|
||||
modules/dialog/dlg_hash.h | 2 +-
|
||||
modules/dialog/dlg_profile.c | 4 ++++
|
||||
modules/dialog/dlg_var.c | 12 ++++++++++++
|
||||
4 files changed, 52 insertions(+), 9 deletions(-)
|
||||
|
||||
--- a/modules/dialog/dlg_handlers.c
|
||||
+++ b/modules/dialog/dlg_handlers.c
|
||||
@@ -455,7 +455,11 @@ static void dlg_onreply(struct cell* t,
|
||||
event = DLG_EVENT_RPL3xx;
|
||||
|
||||
next_state_dlg( dlg, event, &old_state, &new_state, &unref);
|
||||
- dlg_run_event_route(dlg, (rpl==FAKED_REPLY)?NULL:rpl, old_state, new_state);
|
||||
+ if(dlg_run_event_route(dlg, (rpl==FAKED_REPLY)?NULL:rpl, old_state,
|
||||
+ new_state)<0) {
|
||||
+ /* dialog is gone */
|
||||
+ return;
|
||||
+ }
|
||||
|
||||
if (new_state==DLG_STATE_EARLY) {
|
||||
run_dlg_callbacks(DLGCB_EARLY, dlg, req, rpl, DLG_DIR_UPSTREAM, 0);
|
||||
@@ -1315,7 +1319,10 @@ void dlg_onroute(struct sip_msg* req, st
|
||||
CURR_DLG_LIFETIME = (unsigned int)(time(0))-dlg->start_ts;
|
||||
CURR_DLG_STATUS = new_state;
|
||||
|
||||
- dlg_run_event_route(dlg, req, old_state, new_state);
|
||||
+ if(dlg_run_event_route(dlg, req, old_state, new_state)<0) {
|
||||
+ /* dialog is gone */
|
||||
+ return;
|
||||
+ }
|
||||
|
||||
dlg0 = dlg_lookup(h_entry, h_id);
|
||||
if (dlg0==0) {
|
||||
@@ -1519,7 +1526,10 @@ void dlg_ontimeout(struct dlg_tl *tl)
|
||||
timeout_cb = (void *)CONFIRMED_DIALOG_STATE;
|
||||
}
|
||||
|
||||
- dlg_run_event_route(dlg, NULL, old_state, new_state);
|
||||
+ if(dlg_run_event_route(dlg, NULL, old_state, new_state)<0) {
|
||||
+ /* dialog is gone */
|
||||
+ return;
|
||||
+ }
|
||||
|
||||
if (new_state==DLG_STATE_DELETED && old_state!=DLG_STATE_DELETED) {
|
||||
LM_WARN("timeout for dlg with CallID '%.*s' and tags '%.*s' '%.*s'\n",
|
||||
@@ -1607,17 +1617,22 @@ int pv_get_dlg_status(struct sip_msg *ms
|
||||
/*!
|
||||
* \brief Execute event routes based on new state
|
||||
*
|
||||
+ * - returns: -1 if dialog doesn't exist after event route execution
|
||||
+ * 0 if all ok
|
||||
*/
|
||||
-void dlg_run_event_route(dlg_cell_t *dlg, sip_msg_t *msg, int ostate, int nstate)
|
||||
+int dlg_run_event_route(dlg_cell_t *dlg, sip_msg_t *msg, int ostate, int nstate)
|
||||
{
|
||||
sip_msg_t *fmsg;
|
||||
int rt;
|
||||
int bkroute;
|
||||
+ int h_entry=0;
|
||||
+ int h_id=0;
|
||||
+ dlg_cell_t *dlg0 = NULL;
|
||||
|
||||
if(dlg==NULL)
|
||||
- return;
|
||||
+ return -1;
|
||||
if(ostate==nstate)
|
||||
- return;
|
||||
+ return 0;
|
||||
|
||||
rt = -1;
|
||||
if(nstate==DLG_STATE_CONFIRMED_NA) {
|
||||
@@ -1630,7 +1645,7 @@ void dlg_run_event_route(dlg_cell_t *dlg
|
||||
}
|
||||
|
||||
if(rt==-1 || event_rt.rlist[rt]==NULL)
|
||||
- return;
|
||||
+ return 0;
|
||||
|
||||
if(msg==NULL)
|
||||
fmsg = faked_msg_next();
|
||||
@@ -1640,6 +1655,8 @@ void dlg_run_event_route(dlg_cell_t *dlg
|
||||
if (exec_pre_script_cb(fmsg, LOCAL_CB_TYPE)>0)
|
||||
{
|
||||
dlg_ref(dlg, 1);
|
||||
+ h_entry = dlg->h_entry;
|
||||
+ h_id = dlg->h_id;
|
||||
dlg_set_ctx_iuid(dlg);
|
||||
LM_DBG("executing event_route %d on state %d\n", rt, nstate);
|
||||
bkroute = get_route_type();
|
||||
@@ -1647,9 +1664,19 @@ void dlg_run_event_route(dlg_cell_t *dlg
|
||||
run_top_route(event_rt.rlist[rt], fmsg, 0);
|
||||
dlg_reset_ctx_iuid();
|
||||
exec_post_script_cb(fmsg, LOCAL_CB_TYPE);
|
||||
- dlg_unref(dlg, 1);
|
||||
set_route_type(bkroute);
|
||||
+ /* re-lookup the dialog, execution of the route could take long time */
|
||||
+ dlg0 = dlg_lookup(h_entry, h_id);
|
||||
+ if (dlg0==0) {
|
||||
+ LM_ALERT("after event route - dialog not found [%u:%u] (%d/%d) (%p)\n",
|
||||
+ h_entry, h_id, ostate, nstate, dlg);
|
||||
+ return -1;
|
||||
+ } else {
|
||||
+ dlg_release(dlg0);
|
||||
+ dlg_unref(dlg, 1);
|
||||
+ }
|
||||
}
|
||||
+ return 0;
|
||||
}
|
||||
|
||||
int dlg_manage(sip_msg_t *msg)
|
||||
--- a/modules/dialog/dlg_hash.h
|
||||
+++ b/modules/dialog/dlg_hash.h
|
||||
@@ -582,7 +582,7 @@ static inline int match_downstream_dialo
|
||||
/*!
|
||||
*
|
||||
*/
|
||||
-void dlg_run_event_route(dlg_cell_t *dlg, sip_msg_t *msg, int ostate, int nstate);
|
||||
+int dlg_run_event_route(dlg_cell_t *dlg, sip_msg_t *msg, int ostate, int nstate);
|
||||
|
||||
|
||||
int dlg_ka_add(dlg_cell_t *dlg);
|
||||
--- a/modules/dialog/dlg_profile.c
|
||||
+++ b/modules/dialog/dlg_profile.c
|
||||
@@ -437,6 +437,10 @@ int profile_cleanup( struct sip_msg *msg
|
||||
{
|
||||
dlg_cell_t *dlg;
|
||||
|
||||
+ if(get_route_type()==LOCAL_ROUTE) {
|
||||
+ return 1;
|
||||
+ }
|
||||
+
|
||||
current_dlg_msg_id = 0;
|
||||
current_dlg_msg_pid = 0;
|
||||
dlg = dlg_get_ctx_dialog();
|
||||
--- a/modules/dialog/dlg_var.c
|
||||
+++ b/modules/dialog/dlg_var.c
|
||||
@@ -47,6 +47,9 @@ int msg_id;
|
||||
int dlg_cfg_cb(sip_msg_t *msg, unsigned int flags, void *cbp)
|
||||
{
|
||||
dlg_cell_t *dlg;
|
||||
+ if(get_route_type()==LOCAL_ROUTE) {
|
||||
+ return 1;
|
||||
+ }
|
||||
if(flags&POST_SCRIPT_CB) {
|
||||
dlg = dlg_get_ctx_dialog();
|
||||
if(dlg!=NULL) {
|
||||
@@ -76,6 +79,9 @@ int dlg_cfg_cb(sip_msg_t *msg, unsigned
|
||||
|
||||
int cb_dlg_cfg_reset(sip_msg_t *msg, unsigned int flags, void *cbp)
|
||||
{
|
||||
+ if(get_route_type()==LOCAL_ROUTE) {
|
||||
+ return 1;
|
||||
+ }
|
||||
memset(&_dlg_ctx, 0, sizeof(dlg_ctx_t));
|
||||
|
||||
return 1;
|
||||
@@ -83,6 +89,9 @@ int cb_dlg_cfg_reset(sip_msg_t *msg, uns
|
||||
|
||||
int cb_dlg_locals_reset(sip_msg_t *msg, unsigned int flags, void *cbp)
|
||||
{
|
||||
+ if(get_route_type()==LOCAL_ROUTE) {
|
||||
+ return 1;
|
||||
+ }
|
||||
LM_DBG("resetting the local dialog shortcuts on script callback: %u\n", flags);
|
||||
cb_dlg_cfg_reset(msg, flags, cbp);
|
||||
cb_profile_reset(msg, flags, cbp);
|
||||
@@ -918,6 +927,9 @@ dlg_ctx_t* dlg_get_dlg_ctx(void)
|
||||
|
||||
int spiral_detect_reset(struct sip_msg *foo, unsigned int flags, void *bar)
|
||||
{
|
||||
+ if(get_route_type()==LOCAL_ROUTE) {
|
||||
+ return 1;
|
||||
+ }
|
||||
spiral_detected = -1;
|
||||
|
||||
return 0;
|
||||
Loading…
Reference in new issue