mirror of https://github.com/sipwise/kamailio.git
* set proper version in debian/changelog Change-Id: I7fa2148980f3f280fc1d6828cac7cddde77bb2d5changes/43/39943/1
parent
d0ddd5dcca
commit
9fea7d6bf1
@ -1,27 +0,0 @@
|
||||
From: Daniel-Constantin Mierla <miconda@gmail.com>
|
||||
Date: Mon, 30 Mar 2020 10:10:33 +0200
|
||||
Subject: [PATCH] core: do not set msg tcp connection id in the dst info
|
||||
|
||||
(cherry picked from commit f9eaa1298f7263be53b709ab7b68336d09e9de0b)
|
||||
---
|
||||
src/core/action.c | 2 --
|
||||
1 file changed, 2 deletions(-)
|
||||
|
||||
diff --git a/src/core/action.c b/src/core/action.c
|
||||
index 8211cf0..1520f87 100644
|
||||
--- a/src/core/action.c
|
||||
+++ b/src/core/action.c
|
||||
@@ -385,13 +385,11 @@ int do_action(struct run_act_ctx* h, struct action* a, struct sip_msg* msg)
|
||||
#ifdef USE_TCP
|
||||
else if (a->type==FORWARD_TCP_T) {
|
||||
dst.proto= PROTO_TCP;
|
||||
- dst.id = msg->otcpid;
|
||||
}
|
||||
#endif
|
||||
#ifdef USE_TLS
|
||||
else if (a->type==FORWARD_TLS_T) {
|
||||
dst.proto= PROTO_TLS;
|
||||
- dst.id = msg->otcpid;
|
||||
}
|
||||
#endif
|
||||
#ifdef USE_SCTP
|
||||
@ -1,21 +0,0 @@
|
||||
From: Nathan Bruning <nathan@iperity.com>
|
||||
Date: Tue, 24 Mar 2020 11:24:28 +0100
|
||||
Subject: [PATCH] core: fix returning multiple IPs for a cached DNS entry
|
||||
|
||||
(cherry picked from commit 29a35ec3cec8b9c3ee4b45c8d84308701bda097c)
|
||||
---
|
||||
src/core/dns_cache.c | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/src/core/dns_cache.c b/src/core/dns_cache.c
|
||||
index 8f3f4ae..81fc6a9 100644
|
||||
--- a/src/core/dns_cache.c
|
||||
+++ b/src/core/dns_cache.c
|
||||
@@ -2304,6 +2304,7 @@ inline static struct hostent* dns_entry2he(struct dns_hash_entry* e)
|
||||
return 0;
|
||||
}
|
||||
memcpy(p_addr[i], ip, len);
|
||||
+ rr_no++;
|
||||
}
|
||||
if (i==0){
|
||||
LM_DBG("no good records found (%d) for %.*s (%d)\n",
|
||||
@ -1,39 +0,0 @@
|
||||
From: Daniel-Constantin Mierla <miconda@gmail.com>
|
||||
Date: Thu, 19 Mar 2020 10:59:43 +0100
|
||||
Subject: [PATCH] pv: do not set ending '\0' for port value in
|
||||
pv_set_ruri_port()
|
||||
|
||||
- it can be a reference to a static string, ending up in a crash
|
||||
- GH #2258
|
||||
|
||||
(cherry picked from commit 1f76bca74839f35d11f42edf758eb046cedb752c)
|
||||
---
|
||||
src/modules/pv/pv_core.c | 8 ++++++--
|
||||
1 file changed, 6 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/modules/pv/pv_core.c b/src/modules/pv/pv_core.c
|
||||
index 18db915..9087fe0 100644
|
||||
--- a/src/modules/pv/pv_core.c
|
||||
+++ b/src/modules/pv/pv_core.c
|
||||
@@ -2558,7 +2558,9 @@ int pv_set_ruri_port(struct sip_msg* msg, pv_param_t *param,
|
||||
act.val[0].type = STRING_ST;
|
||||
act.val[0].u.string = val->rs.s;
|
||||
backup = val->rs.s[val->rs.len];
|
||||
- val->rs.s[val->rs.len] = '\0';
|
||||
+ if(backup != '\0') {
|
||||
+ val->rs.s[val->rs.len] = '\0';
|
||||
+ }
|
||||
act.type = SET_PORT_T;
|
||||
init_run_actions_ctx(&h);
|
||||
if (do_action(&h, &act, msg)<0)
|
||||
@@ -2567,7 +2569,9 @@ int pv_set_ruri_port(struct sip_msg* msg, pv_param_t *param,
|
||||
val->rs.s[val->rs.len] = backup;
|
||||
goto error;
|
||||
}
|
||||
- val->rs.s[val->rs.len] = backup;
|
||||
+ if(backup != '\0') {
|
||||
+ val->rs.s[val->rs.len] = backup;
|
||||
+ }
|
||||
|
||||
return 0;
|
||||
error:
|
||||
@ -1,22 +0,0 @@
|
||||
From: Zero King <l2dy@icloud.com>
|
||||
Date: Tue, 24 Mar 2020 11:12:39 +0100
|
||||
Subject: [PATCH] rtpengine: fix zero-length log placeholder
|
||||
|
||||
(cherry picked from commit 740afac15b3d8d618b5101a761a37f5808d4b4f0)
|
||||
---
|
||||
src/modules/rtpengine/rtpengine_funcs.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/modules/rtpengine/rtpengine_funcs.c b/src/modules/rtpengine/rtpengine_funcs.c
|
||||
index b99153a..598af63 100644
|
||||
--- a/src/modules/rtpengine/rtpengine_funcs.c
|
||||
+++ b/src/modules/rtpengine/rtpengine_funcs.c
|
||||
@@ -231,7 +231,7 @@ int extract_body(struct sip_msg *msg, str *body )
|
||||
/* p2 is text limit for application parsing */
|
||||
rest = eat_line(p1 + mpdel.len + 2, p2 - p1 - mpdel.len - 2);
|
||||
if ( rest > p2 ) {
|
||||
- LM_ERR("Unparsable <%.*s>\n", (int)(p1-p1), p1);
|
||||
+ LM_ERR("Unparsable <%.*s>\n", (int)(p2-p1), p1);
|
||||
return -1;
|
||||
}
|
||||
while( rest<p2 ) {
|
||||
@ -1,282 +0,0 @@
|
||||
From: Daniel-Constantin Mierla <miconda@gmail.com>
|
||||
Date: Mon, 23 Mar 2020 18:42:23 +0100
|
||||
Subject: [PATCH] rtpengine: replaced rtpproxy with rtpengine
|
||||
|
||||
- avoid confusion in printed log messges
|
||||
|
||||
(cherry picked from commit dda07c69420e1a38948dae4b71f8005b2375253b)
|
||||
---
|
||||
src/modules/rtpengine/config.c | 11 ++++++---
|
||||
src/modules/rtpengine/rtpengine.c | 48 ++++++++++++++++++------------------
|
||||
src/modules/rtpengine/rtpengine.h | 5 ++--
|
||||
src/modules/rtpengine/rtpengine_db.c | 4 +--
|
||||
4 files changed, 36 insertions(+), 32 deletions(-)
|
||||
|
||||
diff --git a/src/modules/rtpengine/config.c b/src/modules/rtpengine/config.c
|
||||
index 946df8a..82cbffa 100644
|
||||
--- a/src/modules/rtpengine/config.c
|
||||
+++ b/src/modules/rtpengine/config.c
|
||||
@@ -42,13 +42,16 @@ void *rtpengine_cfg = &default_rtpengine_cfg;
|
||||
|
||||
cfg_def_t rtpengine_cfg_def[] = {
|
||||
{"rtpengine_disable_tout", CFG_VAR_INT | CFG_ATOMIC, 0, 0, 0, 0,
|
||||
- "The time after which rtpengine will try to communicate to an RTP proxy after it has been marked disabled automatically. "},
|
||||
+ "The time after which rtpengine module will try to communicate"
|
||||
+ " with an RTPEngine instance after it has been marked disabled automatically. "},
|
||||
{"aggressive_redetection", CFG_VAR_INT | CFG_ATOMIC, 0, 1, 0, 0,
|
||||
- "Determines if the sip proxy should force a query of all nodes when all RTP proxies seem unavailable."},
|
||||
+ "Determines if the sip proxy should force a query of all nodes"
|
||||
+ " when all RTPEngine instances seem unavailable."},
|
||||
{"rtpengine_tout_ms", CFG_VAR_INT | CFG_ATOMIC, 0, 0, 0, 0,
|
||||
- "The total number of nodes inside a set to be queried before giving up establishing a session"},
|
||||
+ "The total number of nodes inside a set to be queried before giving up"
|
||||
+ " establishing a session"},
|
||||
{"queried_nodes_limit", CFG_VAR_INT | CFG_ATOMIC, 0, MAX_RTPP_TRIED_NODES, 0, 0,
|
||||
- "Timeout value expressed in milliseconds in waiting for reply from RTP proxy"},
|
||||
+ "Timeout value expressed in milliseconds to wait for reply from RTPEngine"},
|
||||
{"rtpengine_retr", CFG_VAR_INT | CFG_ATOMIC, 0, 0, 0, 0,
|
||||
"How many times the module should retry to send and receive after timeout was generated"},
|
||||
{0, 0, 0, 0, 0, 0}
|
||||
diff --git a/src/modules/rtpengine/rtpengine.c b/src/modules/rtpengine/rtpengine.c
|
||||
index 135e34b..7be7968 100644
|
||||
--- a/src/modules/rtpengine/rtpengine.c
|
||||
+++ b/src/modules/rtpengine/rtpengine.c
|
||||
@@ -257,7 +257,7 @@ static char ** rtpp_strings=0;
|
||||
static int rtpp_sets=0; /*used in rtpengine_set_store()*/
|
||||
static int rtpp_set_count = 0;
|
||||
static unsigned int current_msg_id = (unsigned int)-1;
|
||||
-/* RTP proxy balancing list */
|
||||
+/* RTPEngine balancing list */
|
||||
static struct rtpp_set_head * rtpp_set_list =0;
|
||||
static struct rtpp_set * active_rtpp_set =0;
|
||||
static struct rtpp_set * selected_rtpp_set_1 =0;
|
||||
@@ -862,7 +862,7 @@ struct rtpp_set *get_rtpp_set(unsigned int set_id)
|
||||
if(!rtpp_list)
|
||||
{
|
||||
lock_release(rtpp_set_list->rset_head_lock);
|
||||
- LM_ERR("no shm memory left to create new rtpproxy set %u\n", my_current_id);
|
||||
+ LM_ERR("no shm memory left to create new rtpengine set %u\n", my_current_id);
|
||||
return NULL;
|
||||
}
|
||||
memset(rtpp_list, 0, sizeof(struct rtpp_set));
|
||||
@@ -870,14 +870,14 @@ struct rtpp_set *get_rtpp_set(unsigned int set_id)
|
||||
rtpp_list->rset_lock = lock_alloc();
|
||||
if (!rtpp_list->rset_lock) {
|
||||
lock_release(rtpp_set_list->rset_head_lock);
|
||||
- LM_ERR("no shm memory left to create rtpproxy set lock\n");
|
||||
+ LM_ERR("no shm memory left to create rtpengine set lock\n");
|
||||
shm_free(rtpp_list);
|
||||
rtpp_list = NULL;
|
||||
return NULL;
|
||||
}
|
||||
if (lock_init(rtpp_list->rset_lock) == 0) {
|
||||
lock_release(rtpp_set_list->rset_head_lock);
|
||||
- LM_ERR("could not init rtpproxy set lock\n");
|
||||
+ LM_ERR("could not init rtpengine set lock\n");
|
||||
lock_dealloc((void*)rtpp_list->rset_lock);
|
||||
rtpp_list->rset_lock = NULL;
|
||||
shm_free(rtpp_list);
|
||||
@@ -915,17 +915,17 @@ struct rtpp_set *get_rtpp_set(unsigned int set_id)
|
||||
}
|
||||
|
||||
|
||||
-int add_rtpengine_socks(struct rtpp_set * rtpp_list, char * rtpproxy,
|
||||
+int add_rtpengine_socks(struct rtpp_set *rtpp_list, char *rtpengine,
|
||||
unsigned int weight, int disabled, unsigned int ticks, int isDB)
|
||||
{
|
||||
- /* Make rtp proxies list. */
|
||||
+ /* Make rtpengine instances list. */
|
||||
char *p, *p1, *p2, *plim;
|
||||
struct rtpp_node *pnode;
|
||||
struct rtpp_node *rtpp_node;
|
||||
unsigned int local_weight, port;
|
||||
str s1;
|
||||
|
||||
- p = rtpproxy;
|
||||
+ p = rtpengine;
|
||||
plim = p + strlen(p);
|
||||
|
||||
for(;;) {
|
||||
@@ -1100,7 +1100,7 @@ static int rtpengine_add_rtpengine_set(char * rtp_proxies, unsigned int weight,
|
||||
rtp_proxies = strstr(p, "==");
|
||||
if(rtp_proxies){
|
||||
if(*(rtp_proxies +2)=='\0'){
|
||||
- LM_ERR("script error -invalid rtp proxy list!\n");
|
||||
+ LM_ERR("script error -invalid rtpengine list!\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -1252,7 +1252,7 @@ static void rtpengine_rpc_reload(rpc_t* rpc, void* ctx)
|
||||
}
|
||||
_rtpe_list_version->vertime = tnow;
|
||||
|
||||
- if (init_rtpproxy_db() < 0) {
|
||||
+ if (init_rtpengine_db() < 0) {
|
||||
// fail reloading from database
|
||||
rpc->fault(ctx, 500, "Failed reloading db");
|
||||
return;
|
||||
@@ -1600,14 +1600,14 @@ mod_init(void)
|
||||
}
|
||||
|
||||
if (lock_init(rtpp_set_list->rset_head_lock) == 0) {
|
||||
- LM_ERR("could not init rtpproxy list of proxysets lock\n");
|
||||
+ LM_ERR("could not init lock sets for rtpengine list\n");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
if (rtpp_db_url.s == NULL)
|
||||
{
|
||||
- /* storing the list of rtp proxy sets in shared memory*/
|
||||
+ /* storing the list of rtpengine sets in shared memory*/
|
||||
for(i=0;i<rtpp_sets;i++){
|
||||
if(rtpengine_add_rtpengine_set(rtpp_strings[i], 1, 0, 0) !=0){
|
||||
for(;i<rtpp_sets;i++)
|
||||
@@ -1622,10 +1622,10 @@ mod_init(void)
|
||||
}
|
||||
else
|
||||
{
|
||||
- LM_INFO("Loading rtp proxy definitions from DB\n");
|
||||
- if ( init_rtpproxy_db() < 0)
|
||||
+ LM_INFO("Loading rtpengine definitions from DB\n");
|
||||
+ if ( init_rtpengine_db() < 0)
|
||||
{
|
||||
- LM_ERR("error while loading rtp proxies from database\n");
|
||||
+ LM_ERR("error while loading rtpengine instances from database\n");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@@ -1880,7 +1880,7 @@ static int build_rtpp_socks(int lmode, int rtest) {
|
||||
}
|
||||
|
||||
if (connect(rtpp_socks[pnode->idx], res->ai_addr, res->ai_addrlen) == -1) {
|
||||
- LM_ERR("can't connect to a RTP proxy\n");
|
||||
+ LM_ERR("can't connect to a RTPEngine instance\n");
|
||||
close(rtpp_socks[pnode->idx]);
|
||||
rtpp_socks[pnode->idx] = -1;
|
||||
freeaddrinfo(res);
|
||||
@@ -1968,7 +1968,7 @@ child_init(int rank)
|
||||
}
|
||||
memset(queried_nodes_ptr, 0, MAX_RTPP_TRIED_NODES * sizeof(struct rtpp_node*));
|
||||
|
||||
- /* Iterate known RTP proxies - create sockets */
|
||||
+ /* Iterate known RTPEngine instances - create sockets */
|
||||
if(rank==PROC_SIPINIT) {
|
||||
/* probe rtpengines only in first worker */
|
||||
if (build_rtpp_socks(0, 1))
|
||||
@@ -2782,7 +2782,7 @@ rtpp_test(struct rtpp_node *node, int isdisabled, int force)
|
||||
goto error;
|
||||
}
|
||||
|
||||
- LM_INFO("rtp proxy <%s> found, support for it %senabled\n",
|
||||
+ LM_INFO("rtpengine instance <%s> found, support for it %senabled\n",
|
||||
node->rn_url.s, force == 0 ? "re-" : "");
|
||||
|
||||
bencode_buffer_free(&bencbuf);
|
||||
@@ -2831,7 +2831,7 @@ send_rtpp_command(struct rtpp_node *node, bencode_item_t *dict, int *outlen)
|
||||
}
|
||||
if (connect(fd, (struct sockaddr *) &addr, sizeof(addr)) < 0) {
|
||||
close(fd);
|
||||
- LM_ERR("can't connect to RTP proxy <%s>\n", node->rn_url.s);
|
||||
+ LM_ERR("can't connect to RTPEngine <%s>\n", node->rn_url.s);
|
||||
goto badproxy;
|
||||
}
|
||||
|
||||
@@ -2840,7 +2840,7 @@ send_rtpp_command(struct rtpp_node *node, bencode_item_t *dict, int *outlen)
|
||||
} while (len == -1 && errno == EINTR);
|
||||
if (len <= 0) {
|
||||
close(fd);
|
||||
- LM_ERR("can't send command to RTP proxy <%s>\n", node->rn_url.s);
|
||||
+ LM_ERR("can't send command to RTPEngine <%s>\n", node->rn_url.s);
|
||||
goto badproxy;
|
||||
}
|
||||
do {
|
||||
@@ -2848,7 +2848,7 @@ send_rtpp_command(struct rtpp_node *node, bencode_item_t *dict, int *outlen)
|
||||
} while (len == -1 && errno == EINTR);
|
||||
close(fd);
|
||||
if (len <= 0) {
|
||||
- LM_ERR("can't read reply from RTP proxy <%s>\n", node->rn_url.s);
|
||||
+ LM_ERR("can't read reply from RTPEngine <%s>\n", node->rn_url.s);
|
||||
goto badproxy;
|
||||
}
|
||||
} else {
|
||||
@@ -2871,7 +2871,7 @@ send_rtpp_command(struct rtpp_node *node, bencode_item_t *dict, int *outlen)
|
||||
} while (len == -1 && (errno == EINTR || errno == ENOBUFS));
|
||||
if (len <= 0) {
|
||||
bencode_get_str(bencode_dictionary_get(dict, "command"), &cmd);
|
||||
- LM_ERR("can't send command \"%.*s\" to RTP proxy <%s>\n",
|
||||
+ LM_ERR("can't send command \"%.*s\" to RTPEngine <%s>\n",
|
||||
cmd.len, cmd.s, node->rn_url.s);
|
||||
goto badproxy;
|
||||
}
|
||||
@@ -2883,7 +2883,7 @@ send_rtpp_command(struct rtpp_node *node, bencode_item_t *dict, int *outlen)
|
||||
} while (len == -1 && errno == EINTR);
|
||||
if (len <= 0) {
|
||||
bencode_get_str(bencode_dictionary_get(dict, "command"), &cmd);
|
||||
- LM_ERR("can't read reply for command \"%.*s\" from RTP proxy <%s>\n",
|
||||
+ LM_ERR("can't read reply for command \"%.*s\" from RTPEngine <%s>\n",
|
||||
cmd.len, cmd.s, node->rn_url.s);
|
||||
goto badproxy;
|
||||
}
|
||||
@@ -2902,7 +2902,7 @@ send_rtpp_command(struct rtpp_node *node, bencode_item_t *dict, int *outlen)
|
||||
}
|
||||
if (i == rtpengine_retr) {
|
||||
bencode_get_str(bencode_dictionary_get(dict, "command"), &cmd);
|
||||
- LM_ERR("timeout waiting reply for command \"%.*s\" from RTP proxy <%s>\n",
|
||||
+ LM_ERR("timeout waiting reply for command \"%.*s\" from RTPEngine <%s>\n",
|
||||
cmd.len, cmd.s, node->rn_url.s);
|
||||
goto badproxy;
|
||||
}
|
||||
@@ -3220,7 +3220,7 @@ set_rtpengine_set_from_avp(struct sip_msg *msg, int direction)
|
||||
|
||||
active_rtpp_set = select_rtpp_set(setid_val.n);
|
||||
if(active_rtpp_set == NULL) {
|
||||
- LM_ERR("could not locate rtpproxy set %u\n", setid_val.n);
|
||||
+ LM_ERR("could not locate engine set %u\n", setid_val.n);
|
||||
return -1;
|
||||
}
|
||||
|
||||
diff --git a/src/modules/rtpengine/rtpengine.h b/src/modules/rtpengine/rtpengine.h
|
||||
index 354eceb..03999bf 100644
|
||||
--- a/src/modules/rtpengine/rtpengine.h
|
||||
+++ b/src/modules/rtpengine/rtpengine.h
|
||||
@@ -86,14 +86,15 @@ struct rtpp_set_head {
|
||||
|
||||
struct rtpp_node *get_rtpp_node(struct rtpp_set *rtpp_list, str *url);
|
||||
struct rtpp_set *get_rtpp_set(unsigned int set_id);
|
||||
-int add_rtpengine_socks(struct rtpp_set * rtpp_list, char * rtpproxy, unsigned int weight, int disabled, unsigned int ticks, int isDB);
|
||||
+int add_rtpengine_socks(struct rtpp_set *rtpp_list, char *rtpengine,
|
||||
+ unsigned int weight, int disabled, unsigned int ticks, int isDB);
|
||||
|
||||
int rtpengine_delete_node(struct rtpp_node *rtpp_node);
|
||||
int rtpengine_delete_node_set(struct rtpp_set *rtpp_list);
|
||||
int rtpengine_delete_node_all();
|
||||
|
||||
|
||||
-int init_rtpproxy_db(void);
|
||||
+int init_rtpengine_db(void);
|
||||
|
||||
extern str rtpp_db_url;
|
||||
extern str rtpp_table_name;
|
||||
diff --git a/src/modules/rtpengine/rtpengine_db.c b/src/modules/rtpengine/rtpengine_db.c
|
||||
index 8532fd2..f83be25 100644
|
||||
--- a/src/modules/rtpengine/rtpengine_db.c
|
||||
+++ b/src/modules/rtpengine/rtpengine_db.c
|
||||
@@ -97,7 +97,7 @@ static int rtpp_load_db(void)
|
||||
rows = RES_ROWS(res);
|
||||
if (n_rows == 0)
|
||||
{
|
||||
- LM_WARN("No rtpproxy instances in database\n");
|
||||
+ LM_WARN("No rtpengine instances in database\n");
|
||||
rtpp_dbf.free_result(rtpp_db_handle, res);
|
||||
return 0;
|
||||
}
|
||||
@@ -137,7 +137,7 @@ static int rtpp_load_db(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
-int init_rtpproxy_db(void)
|
||||
+int init_rtpengine_db(void)
|
||||
{
|
||||
int ret;
|
||||
if (rtpp_db_url.s == NULL)
|
||||
@ -1,42 +0,0 @@
|
||||
From: Daniel-Constantin Mierla <miconda@gmail.com>
|
||||
Date: Mon, 30 Mar 2020 10:11:54 +0200
|
||||
Subject: [PATCH] tm: do not set msg tcp connection id in the dst info
|
||||
|
||||
(cherry picked from commit 974c50aea6b581b5f8545f3d710e98b53d44bd67)
|
||||
---
|
||||
src/modules/tm/t_funcs.c | 1 -
|
||||
src/modules/tm/t_fwd.c | 2 --
|
||||
2 files changed, 3 deletions(-)
|
||||
|
||||
diff --git a/src/modules/tm/t_funcs.c b/src/modules/tm/t_funcs.c
|
||||
index 0e484d9..ee06bed 100644
|
||||
--- a/src/modules/tm/t_funcs.c
|
||||
+++ b/src/modules/tm/t_funcs.c
|
||||
@@ -285,7 +285,6 @@ int t_relay_to( struct sip_msg *p_msg , struct proxy_l *proxy, int proto,
|
||||
if ( p_msg->REQ_METHOD==METHOD_ACK) {
|
||||
LM_DBG("forwarding ACK statelessly\n");
|
||||
init_dest_info(&dst);
|
||||
- dst.id = p_msg->otcpid;
|
||||
if (proxy==0) {
|
||||
dst.proto=proto;
|
||||
if (get_uri_send_info(GET_NEXT_HOP(p_msg), &host, &port,
|
||||
diff --git a/src/modules/tm/t_fwd.c b/src/modules/tm/t_fwd.c
|
||||
index 81a0f20..83f22eb 100644
|
||||
--- a/src/modules/tm/t_fwd.c
|
||||
+++ b/src/modules/tm/t_fwd.c
|
||||
@@ -1673,7 +1673,6 @@ int t_forward_nonack( struct cell *t, struct sip_msg* p_msg,
|
||||
if (t->flags & T_CANCELED) goto canceled;
|
||||
if (branch_ret>=0) {
|
||||
added_branches |= 1<<branch_ret;
|
||||
- t->uac[branch_ret].request.dst.id = p_msg->otcpid;
|
||||
} else {
|
||||
lowest_ret=MIN_int(lowest_ret, branch_ret);
|
||||
}
|
||||
@@ -1700,7 +1699,6 @@ int t_forward_nonack( struct cell *t, struct sip_msg* p_msg,
|
||||
* branch result */
|
||||
if (branch_ret>=0) {
|
||||
added_branches |= 1<<branch_ret;
|
||||
- t->uac[branch_ret].request.dst.id = obranch.otcpid;
|
||||
} else {
|
||||
lowest_ret=MIN_int(lowest_ret, branch_ret);
|
||||
}
|
||||
@ -1,53 +0,0 @@
|
||||
From: Henning Westerholt <hw@skalatan.de>
|
||||
Date: Tue, 24 Mar 2020 22:42:59 +0100
|
||||
Subject: [PATCH] uac: also set socket for in dialog REGISTER (GH #2262)
|
||||
|
||||
(cherry picked from commit a752411df65b93f82aaad43a767cff102f5a6100)
|
||||
---
|
||||
src/modules/uac/uac_reg.c | 26 +++++++++++++-------------
|
||||
1 file changed, 13 insertions(+), 13 deletions(-)
|
||||
|
||||
diff --git a/src/modules/uac/uac_reg.c b/src/modules/uac/uac_reg.c
|
||||
index fb45a4f..2ce3725 100644
|
||||
--- a/src/modules/uac/uac_reg.c
|
||||
+++ b/src/modules/uac/uac_reg.c
|
||||
@@ -1131,6 +1131,19 @@ int uac_reg_update(reg_uac_t *reg, time_t tn)
|
||||
/* Callback parameter */
|
||||
uac_r.cbp = (void*)uuid;
|
||||
|
||||
+ if(reg->socket.s != NULL && reg->socket.len > 0) {
|
||||
+ /* custom socket */
|
||||
+ LM_DBG("using custom socket %.*s to send request\n",
|
||||
+ reg->socket.len, reg->socket.s);
|
||||
+ uac_r.ssock = ®->socket;
|
||||
+ } else {
|
||||
+ /* default socket */
|
||||
+ if(uac_default_socket.s != NULL && uac_default_socket.len > 0) {
|
||||
+ LM_DBG("using configured default_socket to send request\n");
|
||||
+ uac_r.ssock = &uac_default_socket;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
if (reg_keep_callid && reg->flags & UAC_REG_ONLINE
|
||||
&& reg->cseq > 0 && reg->cseq < 2147483638
|
||||
&& reg->callid.len > 0)
|
||||
@@ -1150,19 +1163,6 @@ int uac_reg_update(reg_uac_t *reg, time_t tn)
|
||||
|
||||
ret = uac_tmb.t_request_within(&uac_r);
|
||||
} else {
|
||||
- /* custom socket */
|
||||
- if(reg->socket.s != NULL && reg->socket.len > 0) {
|
||||
- LM_DBG("using custom socket %.*s to send request\n",
|
||||
- reg->socket.len, reg->socket.s);
|
||||
- uac_r.ssock = ®->socket;
|
||||
- }
|
||||
- /* default socket */
|
||||
- else {
|
||||
- if(uac_default_socket.s != NULL && uac_default_socket.len > 0) {
|
||||
- LM_DBG("using configured default_socket to send request\n");
|
||||
- uac_r.ssock = &uac_default_socket;
|
||||
- }
|
||||
- }
|
||||
ret = uac_tmb.t_request(&uac_r, /* UAC Req */
|
||||
&s_ruri, /* Request-URI */
|
||||
&s_turi, /* To */
|
||||
@ -1,241 +0,0 @@
|
||||
From 5a90c8bc600fe9a93a5ce4f828ce50f3bf532b99 Mon Sep 17 00:00:00 2001
|
||||
From: Victor Seva <linuxmaniac@torreviejawireless.org>
|
||||
Date: Mon, 4 May 2020 15:05:23 +0200
|
||||
Subject: [PATCH] utils/kamctl: dbtextdb remove DeprecationWarning on test
|
||||
|
||||
related #1747
|
||||
|
||||
(cherry picked from commit 765efa80c7d27e9447bc1ad8a354ee24723580ef)
|
||||
---
|
||||
utils/kamctl/dbtextdb/dbtextdb_test.py | 120 ++++++++++++-------------
|
||||
1 file changed, 60 insertions(+), 60 deletions(-)
|
||||
|
||||
diff --git a/utils/kamctl/dbtextdb/dbtextdb_test.py b/utils/kamctl/dbtextdb/dbtextdb_test.py
|
||||
index ecbab06742..54ce274c72 100644
|
||||
--- a/utils/kamctl/dbtextdb/dbtextdb_test.py
|
||||
+++ b/utils/kamctl/dbtextdb/dbtextdb_test.py
|
||||
@@ -8,8 +8,8 @@ __author__ = 'herman@google.com (Herman Sheremetyev)'
|
||||
|
||||
import time
|
||||
import unittest
|
||||
-from dbtextdb import *
|
||||
-
|
||||
+from dbtextdb import DBText
|
||||
+from dbtextdb import ParseError, ExecuteError
|
||||
|
||||
class DBTextTest(unittest.TestCase):
|
||||
|
||||
@@ -25,28 +25,28 @@ class DBTextTest(unittest.TestCase):
|
||||
# normal query
|
||||
query_normal = 'select * from subscriber;'
|
||||
db_conn.ParseQuery(query_normal)
|
||||
- self.assert_(db_conn.command == 'SELECT')
|
||||
- self.assert_(db_conn.table == 'subscriber')
|
||||
- self.assert_(db_conn.columns == ['*'])
|
||||
+ self.assertEqual(db_conn.command, 'SELECT')
|
||||
+ self.assertEqual(db_conn.table, 'subscriber')
|
||||
+ self.assertEqual(db_conn.columns, ['*'])
|
||||
db_conn.CleanUp()
|
||||
# normal query with condition
|
||||
query_normal_cond = 'select * from subscriber where column="value";'
|
||||
db_conn.ParseQuery(query_normal_cond)
|
||||
- self.assert_(db_conn.command == 'SELECT')
|
||||
- self.assert_(db_conn.table == 'subscriber')
|
||||
- self.assert_(db_conn.columns == ['*'])
|
||||
- self.assert_(db_conn.strings == ['value'])
|
||||
- self.assert_(not db_conn.count)
|
||||
- self.assert_(db_conn.conditions == {'column': 'value'})
|
||||
+ self.assertEqual(db_conn.command, 'SELECT')
|
||||
+ self.assertEqual(db_conn.table, 'subscriber')
|
||||
+ self.assertEqual(db_conn.columns, ['*'])
|
||||
+ self.assertEqual(db_conn.strings, ['value'])
|
||||
+ self.assertTrue(not db_conn.count)
|
||||
+ self.assertEqual(db_conn.conditions, {'column': 'value'})
|
||||
db_conn.CleanUp()
|
||||
# normal query with multiple conditions
|
||||
query_normal_cond = ('select * from subscriber where column="value1" and '
|
||||
'col2=" another value " and col3= foo and a="";')
|
||||
db_conn.ParseQuery(query_normal_cond)
|
||||
- self.assert_(db_conn.command == 'SELECT')
|
||||
- self.assert_(db_conn.table == 'subscriber')
|
||||
- self.assert_(db_conn.columns == ['*'])
|
||||
- self.assert_(db_conn.strings == ['value1', ' another value ', ''])
|
||||
+ self.assertEqual(db_conn.command, 'SELECT')
|
||||
+ self.assertEqual(db_conn.table, 'subscriber')
|
||||
+ self.assertEqual(db_conn.columns, ['*'])
|
||||
+ self.assertEqual(db_conn.strings, ['value1', ' another value ', ''])
|
||||
self.assertEqual(db_conn.conditions, {'column': 'value1',
|
||||
'col2': ' another value ',
|
||||
'col3': 'foo', 'a': ''})
|
||||
@@ -54,49 +54,49 @@ class DBTextTest(unittest.TestCase):
|
||||
# normal query with count
|
||||
query_normal_count = 'select count(*) from subscriber;'
|
||||
db_conn.ParseQuery(query_normal_count)
|
||||
- self.assert_(db_conn.command == 'SELECT')
|
||||
- self.assert_(db_conn.table == 'subscriber')
|
||||
- self.assert_(db_conn.columns == ['*'])
|
||||
- self.assert_(db_conn.count == True)
|
||||
+ self.assertEqual(db_conn.command, 'SELECT')
|
||||
+ self.assertEqual(db_conn.table, 'subscriber')
|
||||
+ self.assertEqual(db_conn.columns, ['*'])
|
||||
+ self.assertEqual(db_conn.count, True)
|
||||
db_conn.CleanUp()
|
||||
# normal query with now()
|
||||
query_normal_count = 'select count(*) from subscriber where time=now();'
|
||||
db_conn.ParseQuery(query_normal_count)
|
||||
- self.assert_(db_conn.command == 'SELECT')
|
||||
- self.assert_(db_conn.table == 'subscriber')
|
||||
- self.assert_(db_conn.columns == ['*'])
|
||||
- self.assert_(db_conn.count == True)
|
||||
+ self.assertEqual(db_conn.command, 'SELECT')
|
||||
+ self.assertEqual(db_conn.table, 'subscriber')
|
||||
+ self.assertEqual(db_conn.columns, ['*'])
|
||||
+ self.assertEqual(db_conn.count, True)
|
||||
self.assertEqual(db_conn.conditions, {'time': self.time_now})
|
||||
db_conn.CleanUp()
|
||||
# normal delete query
|
||||
query_normal_delete = 'delete from subscriber where foo = 2;'
|
||||
db_conn.ParseQuery(query_normal_delete)
|
||||
- self.assert_(db_conn.command == 'DELETE')
|
||||
- self.assert_(db_conn.table == 'subscriber')
|
||||
+ self.assertEqual(db_conn.command, 'DELETE')
|
||||
+ self.assertEqual(db_conn.table, 'subscriber')
|
||||
self.assertEqual(db_conn.conditions, {'foo': '2'})
|
||||
db_conn.CleanUp()
|
||||
# normal insert values query with no into
|
||||
query_normal_insert_values = ('insert subscriber (col1, col2, col3) '
|
||||
'values (1, "foo", "");')
|
||||
db_conn.ParseQuery(query_normal_insert_values)
|
||||
- self.assert_(db_conn.command == 'INSERT')
|
||||
- self.assert_(db_conn.table == 'subscriber')
|
||||
+ self.assertEqual(db_conn.command, 'INSERT')
|
||||
+ self.assertEqual(db_conn.table, 'subscriber')
|
||||
self.assertEqual(db_conn.targets, {'col1': '1', 'col2': 'foo', 'col3': ''})
|
||||
db_conn.CleanUp()
|
||||
# normal insert values query with into
|
||||
query_normal_insert_into_values = ('insert into subscriber (col1, col2) '
|
||||
'values (1, "foo");')
|
||||
db_conn.ParseQuery(query_normal_insert_into_values)
|
||||
- self.assert_(db_conn.command == 'INSERT')
|
||||
- self.assert_(db_conn.table == 'subscriber')
|
||||
+ self.assertEqual(db_conn.command, 'INSERT')
|
||||
+ self.assertEqual(db_conn.table, 'subscriber')
|
||||
self.assertEqual(db_conn.targets, {'col1': '1', 'col2': 'foo'})
|
||||
db_conn.CleanUp()
|
||||
# normal insert values query with now()
|
||||
query_normal_insert_into_values = ('insert into subscriber (a, b, c) '
|
||||
'values (NOW(), "foo", now());')
|
||||
db_conn.ParseQuery(query_normal_insert_into_values)
|
||||
- self.assert_(db_conn.command == 'INSERT')
|
||||
- self.assert_(db_conn.table == 'subscriber')
|
||||
+ self.assertEqual(db_conn.command, 'INSERT')
|
||||
+ self.assertEqual(db_conn.table, 'subscriber')
|
||||
self.assertEqual(db_conn.targets, {'a': self.time_now, 'b': 'foo',
|
||||
'c': self.time_now})
|
||||
db_conn.CleanUp()
|
||||
@@ -157,23 +157,23 @@ class DBTextTest(unittest.TestCase):
|
||||
# normal insert set query with no into
|
||||
query_normal_insert_set = ('insert subscriber set col= 1, col2 ="\'f\'b";')
|
||||
db_conn.ParseQuery(query_normal_insert_set)
|
||||
- self.assert_(db_conn.command == 'INSERT')
|
||||
- self.assert_(db_conn.table == 'subscriber')
|
||||
+ self.assertEqual(db_conn.command, 'INSERT')
|
||||
+ self.assertEqual(db_conn.table, 'subscriber')
|
||||
self.assertEqual(db_conn.targets, {'col': '1', 'col2': '\'f\'b'})
|
||||
db_conn.CleanUp()
|
||||
# normal update
|
||||
query_normal_update = ('update subscriber set col1= 1, col2 ="foo";')
|
||||
db_conn.ParseQuery(query_normal_update)
|
||||
- self.assert_(db_conn.command == 'UPDATE')
|
||||
- self.assert_(db_conn.table == 'subscriber')
|
||||
+ self.assertEqual(db_conn.command, 'UPDATE')
|
||||
+ self.assertEqual(db_conn.table, 'subscriber')
|
||||
self.assertEqual(db_conn.targets, {'col1': '1', 'col2': 'foo'})
|
||||
db_conn.CleanUp()
|
||||
# normal update with condition
|
||||
query_normal_update_cond = ('update subscriber set col1= 1, col2 ="foo" '
|
||||
'where foo = "bar" and id=1 and a="";')
|
||||
db_conn.ParseQuery(query_normal_update_cond)
|
||||
- self.assert_(db_conn.command == 'UPDATE')
|
||||
- self.assert_(db_conn.table == 'subscriber')
|
||||
+ self.assertEqual(db_conn.command, 'UPDATE')
|
||||
+ self.assertEqual(db_conn.table, 'subscriber')
|
||||
self.assertEqual(db_conn.targets, {'col1': '1', 'col2': 'foo'})
|
||||
self.assertEqual(db_conn.conditions, {'foo': 'bar', 'id': '1', 'a': ''})
|
||||
db_conn.CleanUp()
|
||||
@@ -220,49 +220,49 @@ class DBTextTest(unittest.TestCase):
|
||||
# normal query with multiple columns
|
||||
query_normal_count = 'select col1, "col 2",col3 , "col4" from subscriber;'
|
||||
db_conn.ParseQuery(query_normal_count)
|
||||
- self.assert_(db_conn.command == 'SELECT')
|
||||
- self.assert_(db_conn.table == 'subscriber')
|
||||
- self.assert_(db_conn.strings == ['col 2', 'col4'])
|
||||
- self.assert_(db_conn.columns == ['col1', "'col 2'", 'col3', "'col4'"])
|
||||
+ self.assertEqual(db_conn.command, 'SELECT')
|
||||
+ self.assertEqual(db_conn.table, 'subscriber')
|
||||
+ self.assertEqual(db_conn.strings, ['col 2', 'col4'])
|
||||
+ self.assertEqual(db_conn.columns, ['col1', "'col 2'", 'col3', "'col4'"])
|
||||
db_conn.CleanUp()
|
||||
# normal query with ORDER BY
|
||||
query_normal_order_by = ('select col1, col2 from test'
|
||||
' ORDER by col1;')
|
||||
db_conn.ParseQuery(query_normal_order_by)
|
||||
- self.assert_(db_conn.command == 'SELECT')
|
||||
- self.assert_(db_conn.table == 'test')
|
||||
- self.assert_(db_conn.columns == ['col1', 'col2'])
|
||||
- self.assert_(db_conn.order_by == 'col1')
|
||||
+ self.assertEqual(db_conn.command, 'SELECT')
|
||||
+ self.assertEqual(db_conn.table, 'test')
|
||||
+ self.assertEqual(db_conn.columns, ['col1', 'col2'])
|
||||
+ self.assertEqual(db_conn.order_by, 'col1')
|
||||
db_conn.CleanUp()
|
||||
# normal query with ORDER BY with conditions
|
||||
query_normal_order_by_cond = ('select col1, col2 from test where col="asdf"'
|
||||
' and col2 = "foo" ORDER by col;')
|
||||
db_conn.ParseQuery(query_normal_order_by_cond)
|
||||
- self.assert_(db_conn.command == 'SELECT')
|
||||
- self.assert_(db_conn.table == 'test')
|
||||
- self.assert_(db_conn.columns == ['col1', 'col2'])
|
||||
- self.assert_(db_conn.conditions == {'col': 'asdf', 'col2': 'foo'})
|
||||
- self.assert_(db_conn.order_by == 'col')
|
||||
+ self.assertEqual(db_conn.command, 'SELECT')
|
||||
+ self.assertEqual(db_conn.table, 'test')
|
||||
+ self.assertEqual(db_conn.columns, ['col1', 'col2'])
|
||||
+ self.assertEqual(db_conn.conditions, {'col': 'asdf', 'col2': 'foo'})
|
||||
+ self.assertEqual(db_conn.order_by, 'col')
|
||||
db_conn.CleanUp()
|
||||
# normal query with CONCAT
|
||||
query_normal_concat = ('select concat(uname,"@", domain) as email_addr '
|
||||
'from subscriber where id=3;')
|
||||
db_conn.ParseQuery(query_normal_concat)
|
||||
- self.assert_(db_conn.command == 'SELECT')
|
||||
- self.assert_(db_conn.table == 'subscriber')
|
||||
- self.assert_(db_conn.columns == ['email_addr'])
|
||||
- self.assert_(db_conn.conditions == {'id': '3'})
|
||||
- self.assert_(db_conn.aliases == {'email_addr': ['uname', "'@'", 'domain']})
|
||||
+ self.assertEqual(db_conn.command, 'SELECT')
|
||||
+ self.assertEqual(db_conn.table, 'subscriber')
|
||||
+ self.assertEqual(db_conn.columns, ['email_addr'])
|
||||
+ self.assertEqual(db_conn.conditions, {'id': '3'})
|
||||
+ self.assertEqual(db_conn.aliases, {'email_addr': ['uname', "'@'", 'domain']})
|
||||
db_conn.CleanUp()
|
||||
# normal query with multiple CONCAT
|
||||
query_normal_mult_concat = ('select concat(uname,"@", domain) as email,'
|
||||
' foo as "bar" from table where id=3;')
|
||||
db_conn.ParseQuery(query_normal_mult_concat)
|
||||
- self.assert_(db_conn.command == 'SELECT')
|
||||
- self.assert_(db_conn.table == 'table')
|
||||
- self.assert_(db_conn.columns == ['email', "'bar'"])
|
||||
- self.assert_(db_conn.conditions == {'id': '3'})
|
||||
- self.assert_(db_conn.aliases == {"'bar'": ['foo'],
|
||||
+ self.assertEqual(db_conn.command, 'SELECT')
|
||||
+ self.assertEqual(db_conn.table, 'table')
|
||||
+ self.assertEqual(db_conn.columns, ['email', "'bar'"])
|
||||
+ self.assertEqual(db_conn.conditions, {'id': '3'})
|
||||
+ self.assertTrue(db_conn.aliases == {"'bar'": ['foo'],
|
||||
'email': ['uname', "'@'", 'domain']})
|
||||
db_conn.CleanUp()
|
||||
# bad query with CONCAT missing AS
|
||||
--
|
||||
2.26.2
|
||||
|
||||
@ -1,39 +0,0 @@
|
||||
From e26e587f31eb23c431a2cfb149ec7a86b4f648bc Mon Sep 17 00:00:00 2001
|
||||
From: Victor Seva <linuxmaniac@torreviejawireless.org>
|
||||
Date: Mon, 4 May 2020 15:22:36 +0200
|
||||
Subject: [PATCH] utils/kamctl: dbtextdb.py close previous opened file properly
|
||||
|
||||
related #1747
|
||||
|
||||
(cherry picked from commit 5f52f9905bbdf63d636080f7d0340af4f71ed12a)
|
||||
---
|
||||
utils/kamctl/dbtextdb/dbtextdb.py | 6 ++++++
|
||||
1 file changed, 6 insertions(+)
|
||||
|
||||
diff --git a/utils/kamctl/dbtextdb/dbtextdb.py b/utils/kamctl/dbtextdb/dbtextdb.py
|
||||
index 7e1de04687..581496c309 100755
|
||||
--- a/utils/kamctl/dbtextdb/dbtextdb.py
|
||||
+++ b/utils/kamctl/dbtextdb/dbtextdb.py
|
||||
@@ -60,6 +60,10 @@ class DBText(object):
|
||||
if not os.path.isdir(location):
|
||||
raise ParseError(location + ' is not a directory')
|
||||
|
||||
+ def __del__(self):
|
||||
+ if getattr(self, 'fd', False):
|
||||
+ self.fd.close()
|
||||
+
|
||||
def _ParseOrderBy(self):
|
||||
"""Parse out the column name to be used for ordering the dataset.
|
||||
|
||||
@@ -438,6 +442,8 @@ class DBText(object):
|
||||
self.command = '' # which command are we executing
|
||||
self.strings = [] # list of string literals parsed from the query
|
||||
self.parens = [] # list of parentheses parsed from the query
|
||||
+ if getattr(self, 'fd', False):
|
||||
+ self.fd.close()
|
||||
|
||||
def ParseQuery(self, query):
|
||||
"""External wrapper for the query parsing routines.
|
||||
--
|
||||
2.26.2
|
||||
|
||||
@ -1,89 +0,0 @@
|
||||
From c4dd3218e6b723c688762a5c4253fa70f3f588bc Mon Sep 17 00:00:00 2001
|
||||
From: Victor Seva <linuxmaniac@torreviejawireless.org>
|
||||
Date: Mon, 4 May 2020 14:01:33 +0200
|
||||
Subject: [PATCH] utils/kamctl: fix dbtestdb
|
||||
|
||||
some indentantion errors introduced at https://github.com/kamailio/kamailio/commit/bc8bdcaa726f375f6deea8228a1ab0cf97c67035
|
||||
|
||||
related #1747
|
||||
|
||||
(cherry picked from commit b722a48144ac9e029bdbc2968dedbe56966a3f7c)
|
||||
---
|
||||
utils/kamctl/dbtextdb/dbtextdb.py | 38 +++++++++++++++----------------
|
||||
1 file changed, 19 insertions(+), 19 deletions(-)
|
||||
|
||||
diff --git a/utils/kamctl/dbtextdb/dbtextdb.py b/utils/kamctl/dbtextdb/dbtextdb.py
|
||||
index 3d5ee7ecc5..7e1de04687 100755
|
||||
--- a/utils/kamctl/dbtextdb/dbtextdb.py
|
||||
+++ b/utils/kamctl/dbtextdb/dbtextdb.py
|
||||
@@ -146,11 +146,11 @@ class DBText(object):
|
||||
# check if there is a function modifier on the columns
|
||||
if self.tokens[0] == 'COUNT':
|
||||
self.count = True
|
||||
- if col_end == 1:
|
||||
- raise ParseError('COUNT must be followed by column name[s]')
|
||||
- if not self.tokens[1].startswith(self._paren_placeholder):
|
||||
- raise ParseError('COUNT must be followed by ()')
|
||||
- cols_str = self._ReplaceParens(self.tokens[1])
|
||||
+ if col_end == 1:
|
||||
+ raise ParseError('COUNT must be followed by column name[s]')
|
||||
+ if not self.tokens[1].startswith(self._paren_placeholder):
|
||||
+ raise ParseError('COUNT must be followed by ()')
|
||||
+ cols_str = self._ReplaceParens(self.tokens[1])
|
||||
|
||||
cols = cols_str.split(',')
|
||||
for col in cols:
|
||||
@@ -300,7 +300,7 @@ class DBText(object):
|
||||
if self.tokens.pop(0) != 'SET':
|
||||
raise ParseError('UPDATE command must be followed by SET')
|
||||
|
||||
- self.targets = self._ParsePairs(' '.join(self.tokens), ',')
|
||||
+ self.targets = self._ParsePairs(' '.join(self.tokens), ',')
|
||||
|
||||
# INSERT
|
||||
if self.command == 'INSERT':
|
||||
@@ -570,19 +570,19 @@ class DBText(object):
|
||||
string = '%s%s' % (string, c)
|
||||
continue # wait for matching delim
|
||||
|
||||
- started -= 1
|
||||
- if not started:
|
||||
- values.append(string)
|
||||
- new_args = '%s %s' % (new_args, '%s%d' % (placeholder,
|
||||
- my_id))
|
||||
- my_id += 1
|
||||
- string = ''
|
||||
+ started -= 1
|
||||
+ if not started:
|
||||
+ values.append(string)
|
||||
+ new_args = '%s %s' % (new_args, '%s%d' % (placeholder,
|
||||
+ my_id))
|
||||
+ my_id += 1
|
||||
+ string = ''
|
||||
|
||||
- else:
|
||||
- if not started:
|
||||
- new_args = '%s%s' % (new_args, c)
|
||||
else:
|
||||
- string = '%s%s' % (string, c)
|
||||
+ if not started:
|
||||
+ new_args = '%s%s' % (new_args, c)
|
||||
+ else:
|
||||
+ string = '%s%s' % (string, c)
|
||||
|
||||
if started:
|
||||
if mode == 'parens':
|
||||
@@ -714,8 +714,8 @@ class DBText(object):
|
||||
elif self.header[col]['auto']:
|
||||
new_row[col] = self._GetNextAuto(col)
|
||||
|
||||
- else:
|
||||
- raise ExecuteError(col + ' cannot be empty or null')
|
||||
+ else:
|
||||
+ raise ExecuteError(col + ' cannot be empty or null')
|
||||
|
||||
self.data.append(new_row)
|
||||
return [1]
|
||||
--
|
||||
2.26.2
|
||||
|
||||
@ -1,88 +0,0 @@
|
||||
From 5f6f4331811e654e75b49263f8fb823bea9874a3 Mon Sep 17 00:00:00 2001
|
||||
From: Victor Seva <linuxmaniac@torreviejawireless.org>
|
||||
Date: Mon, 4 May 2020 11:33:12 +0200
|
||||
Subject: [PATCH] utils/kamctl: fix handling of Exceptions
|
||||
|
||||
> Traceback (most recent call last):
|
||||
> File "/usr/lib/x86_64-linux-gnu/kamailio/kamctl/dbtextdb/dbtextdb.py", line 1239, in <module>
|
||||
> main(sys.argv)
|
||||
> File "/usr/lib/x86_64-linux-gnu/kamailio/kamctl/dbtextdb/dbtextdb.py", line 1233, in main
|
||||
> except (Error, e):
|
||||
> NameError: name 'e' is not defined
|
||||
|
||||
(cherry picked from commit 1aca79c43cb8dbd920c1eb81c0c30cf89f0985b9)
|
||||
---
|
||||
utils/kamctl/dbtextdb/dbtextdb.py | 22 ++++++++++------------
|
||||
1 file changed, 10 insertions(+), 12 deletions(-)
|
||||
|
||||
diff --git a/utils/kamctl/dbtextdb/dbtextdb.py b/utils/kamctl/dbtextdb/dbtextdb.py
|
||||
index 3a35554013..3d5ee7ecc5 100755
|
||||
--- a/utils/kamctl/dbtextdb/dbtextdb.py
|
||||
+++ b/utils/kamctl/dbtextdb/dbtextdb.py
|
||||
@@ -356,7 +356,7 @@ class DBText(object):
|
||||
# test that the value is string, if not return it as is
|
||||
try:
|
||||
value.find('a')
|
||||
- except:
|
||||
+ except Exception:
|
||||
return value
|
||||
|
||||
escaped = value
|
||||
@@ -377,7 +377,7 @@ class DBText(object):
|
||||
# test that the value is string, if not return it as is
|
||||
try:
|
||||
value.find('a')
|
||||
- except:
|
||||
+ except Exception:
|
||||
return value
|
||||
|
||||
escaped = value
|
||||
@@ -988,21 +988,19 @@ class DBText(object):
|
||||
if not val and not self.header[col]['null']:
|
||||
raise ExecuteError(col + ' cannot be empty or null')
|
||||
|
||||
- if (self.header[col]['type'].lower() == 'int' or
|
||||
- self.header[col]['type'].lower() == 'double'):
|
||||
+ hdr_t = self.header[col]['type'].lower()
|
||||
+ if hdr_t == 'int' or hdr_t == 'double':
|
||||
try:
|
||||
if val:
|
||||
val = eval(val)
|
||||
- except (NameError, e):
|
||||
+ except NameError as e:
|
||||
raise ExecuteError('Failed to parse %s in %s '
|
||||
'(unable to convert to type %s): %s' %
|
||||
- (col, self.table, self.header[col]['type'],
|
||||
- e))
|
||||
- except (SyntaxError, e):
|
||||
+ (col, self.table, hdr_t, e))
|
||||
+ except SyntaxError as e:
|
||||
raise ExecuteError('Failed to parse %s in %s '
|
||||
'(unable to convert to type %s): %s' %
|
||||
- (col, self.table, self.header[col]['type'],
|
||||
- e))
|
||||
+ (col, self.table, hdr_t, e))
|
||||
|
||||
return val
|
||||
|
||||
@@ -1083,7 +1081,7 @@ class DBText(object):
|
||||
# save a copy of the data before modifying
|
||||
self.orig_data = self.data[:]
|
||||
|
||||
- except (IOError, e):
|
||||
+ except IOError as e:
|
||||
raise ExecuteError('Unable to open table %s: %s' % (self.table, e))
|
||||
|
||||
Debug('Header is: %s' % self.header)
|
||||
@@ -1230,7 +1228,7 @@ def main(argv):
|
||||
print('Updated %s, rows affected: %d' % (conn.table, row))
|
||||
else:
|
||||
print(row)
|
||||
- except (Error, e):
|
||||
+ except Error as e:
|
||||
print(e)
|
||||
sys.exit(1)
|
||||
|
||||
--
|
||||
2.26.2
|
||||
|
||||
Loading…
Reference in new issue