From ad1a97e483e3e71c165b2172d0fd45c92b7b09b0 Mon Sep 17 00:00:00 2001 From: Peter Lemenkov Date: May 02 2015 15:30:31 +0000 Subject: Ver. 1.10.4 Signed-off-by: Peter Lemenkov --- diff --git a/.gitignore b/.gitignore index 1c6e4df..37c2b41 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,4 @@ opensips-1.6.3-tls_src.tar.gz /opensips-1.10.0_src.tar.gz /opensips-1.10.1_src.tar.gz /opensips-1.10.3_src.tar.gz +/opensips-1.10.4_src.tar.gz diff --git a/opensips-0001-Consistently-use-rtpproxy-switches.patch b/opensips-0001-Consistently-use-rtpproxy-switches.patch index 18e6d66..ae8cb49 100644 --- a/opensips-0001-Consistently-use-rtpproxy-switches.patch +++ b/opensips-0001-Consistently-use-rtpproxy-switches.patch @@ -18,7 +18,7 @@ index 27b66b0..f671e49 100644 diff --git a/modules/rtpproxy/rtpproxy.c b/modules/rtpproxy/rtpproxy.c -index 7880513..bb3add5 100644 +index 691554d..39bcf6d 100644 --- a/modules/rtpproxy/rtpproxy.c +++ b/modules/rtpproxy/rtpproxy.c @@ -3153,8 +3153,6 @@ force_rtp_proxy_body(struct sip_msg* msg, struct force_rtpp_args *args) diff --git a/opensips-0010-parser-fix-memory-leak.patch b/opensips-0010-parser-fix-memory-leak.patch new file mode 100644 index 0000000..47defde --- /dev/null +++ b/opensips-0010-parser-fix-memory-leak.patch @@ -0,0 +1,18 @@ +From: Ovidiu Sas +Date: Mon, 30 Mar 2015 22:10:02 -0400 +Subject: [PATCH] parser: fix memory leak - add Supported header to the list + of headers that performs memory allocation + + +diff --git a/parser/hf.h b/parser/hf.h +index f2b9f14..c8b67d4 100644 +--- a/parser/hf.h ++++ b/parser/hf.h +@@ -204,6 +204,7 @@ static inline int hdr_allocs_parse(struct hdr_field* hdr) + case HDR_WWW_AUTHENTICATE_T: + case HDR_PROXY_AUTHENTICATE_T: + case HDR_ALLOW_T: ++ case HDR_SUPPORTED_T: + return 1; + default: + return 0; diff --git a/opensips-0011-Merge-pull-request-462-from-jarrodb-dlg_hash.patch b/opensips-0011-Merge-pull-request-462-from-jarrodb-dlg_hash.patch new file mode 100644 index 0000000..1cb278e --- /dev/null +++ b/opensips-0011-Merge-pull-request-462-from-jarrodb-dlg_hash.patch @@ -0,0 +1,21 @@ +From: =?UTF-8?q?R=C4=83zvan=20Crainea?= +Date: Tue, 14 Apr 2015 14:45:19 +0300 +Subject: [PATCH] Merge pull request #462 from jarrodb/dlg_hash + +Verify the dialog mi parameter is not null before passing to dlg_hash +(cherry picked from commit 432c9cc5dcbfadf69c1b9b1fee44a0fcad8cb8f6) + +diff --git a/modules/dialog/dlg_hash.c b/modules/dialog/dlg_hash.c +index 57e11d8..09a97d8 100644 +--- a/modules/dialog/dlg_hash.c ++++ b/modules/dialog/dlg_hash.c +@@ -1179,6 +1179,9 @@ static inline struct mi_root* process_mi_params(struct mi_root *cmd_tree, + + *idx = *cnt = 0; + ++ if (!p1->s) ++ return init_mi_tree( 400, "Invalid Call-ID specified", 25); ++ + h_entry = dlg_hash( p1/*callid*/ ); + + d_entry = &(d_table->entries[h_entry]); diff --git a/opensips-0012-sipmsgops-fix-buffer-management-issue.patch b/opensips-0012-sipmsgops-fix-buffer-management-issue.patch new file mode 100644 index 0000000..db09845 --- /dev/null +++ b/opensips-0012-sipmsgops-fix-buffer-management-issue.patch @@ -0,0 +1,246 @@ +From: Liviu Chircu +Date: Thu, 16 Apr 2015 15:03:48 +0300 +Subject: [PATCH] sipmsgops: fix buffer management issue + +is_present_hf() and remove_hf() would sometimes misbehave +when used with pseudo-variables (commit 6e88f653702). + +Reported by Eric Werkhoven + +Also fix a couple of noisy log messages. + +(cherry picked from commit 0d5edcda13189bb7c06b13b154110b90387a27a0) + +Conflicts: + modules/sipmsgops/sipmsgops.c + +diff --git a/modules/sipmsgops/sipmsgops.c b/modules/sipmsgops/sipmsgops.c +index 8ac5b00..5ca11e3 100644 +--- a/modules/sipmsgops/sipmsgops.c ++++ b/modules/sipmsgops/sipmsgops.c +@@ -386,19 +386,17 @@ static int filter_body_f(struct sip_msg* msg, char* _content_type, + return -1; + } + +-int parse_pvs_header(struct sip_msg *msg, gparam_p gp) ++int get_pvs_header_value(struct sip_msg *msg, gparam_p gp, pv_value_p ret) + { +- pv_value_t pval; + struct hdr_field hdr; + int hdr_len; +- +- if (pv_get_spec_value(msg, gp->v.pvs, &pval) != 0 || pval.flags & PV_VAL_NULL) +- { +- LM_ERR("no valid PV value found!\n"); ++ ++ if (fixup_get_svalue(msg, gp, &ret->rs) != 0) { ++ LM_ERR("failed to get the string value\n"); + return -1; + } + +- hdr_len = pval.rs.len + 1; ++ hdr_len = ret->rs.len + 1; + if (header_body.len < hdr_len) + { + header_body.s = pkg_realloc(header_body.s, hdr_len); +@@ -411,30 +409,22 @@ int parse_pvs_header(struct sip_msg *msg, gparam_p gp) + header_body.len = hdr_len; + } + +- memcpy(header_body.s, pval.rs.s, pval.rs.len); +- header_body.s[pval.rs.len] = ':'; ++ memcpy(header_body.s, ret->rs.s, ret->rs.len); ++ header_body.s[ret->rs.len] = ':'; + + LM_DBG("Parsing %.*s\n", hdr_len, header_body.s); +- if (parse_hname2(header_body.s, header_body.s + +- (hdr_len < 4 ? 4 : hdr_len), &hdr) == 0) ++ if (parse_hname2(header_body.s, header_body.s + hdr_len, &hdr) == 0) + { +- LM_ERR("error parsing header name\n"); +- pkg_free(gp); ++ LM_ERR("error parsing header name '%.*s'\n", ret->rs.len, ret->rs.s); + return E_UNSPEC; + } + +- if (hdr.type!=HDR_OTHER_T && hdr.type!=HDR_ERROR_T) ++ if (hdr.type != HDR_OTHER_T && hdr.type != HDR_ERROR_T) + { +- LM_INFO("using hdr type (%d) instead of <%.*s>\n", +- hdr.type, pval.rs.len, header_body.s); +- gp->v.ival = hdr.type; +- gp->type = GPARAM_TYPE_INT; +- } else { +- gp->type = GPARAM_TYPE_STR; +- gp->v.sval.s = header_body.s; +- gp->v.sval.len = pval.rs.len; +- +- LM_INFO("using hdr type name <%.*s>\n", gp->v.sval.len, gp->v.sval.s); ++ LM_DBG("using hdr type (%d) instead of <%.*s>\n", ++ hdr.type, ret->rs.len, ret->rs.s); ++ ret->flags = PV_VAL_INT; ++ ret->ri = hdr.type; + } + + return 0; +@@ -445,34 +435,37 @@ static int remove_hf_f(struct sip_msg* msg, char* str_hf, char* foo) + struct hdr_field *hf; + struct lump* l; + int cnt; +- gparam_p gp; ++ pv_value_t pval; + +- gp = (gparam_p)str_hf; + cnt=0; + +- if (gp->type == GPARAM_TYPE_PVS && +- parse_pvs_header(msg, gp) != 0) +- { +- LM_ERR("Parse pvs header failed!\n"); ++ pval.flags = PV_VAL_NONE; ++ ++ if (((gparam_p)str_hf)->type == GPARAM_TYPE_INT) { ++ pval.flags = PV_VAL_INT; ++ pval.ri = ((gparam_p)str_hf)->v.ival; ++ } else if (get_pvs_header_value(msg, (gparam_p)str_hf, &pval) != 0) { ++ LM_ERR("failed to get header value\n"); + return -1; + } + + /* we need to be sure we have seen all HFs */ + parse_headers(msg, HDR_EOH_F, 0); ++ + for (hf=msg->headers; hf; hf=hf->next) { + /* for well known header names str_hf->s will be set to NULL + during parsing of opensips.cfg and str_hf->len contains + the header type */ +- if(gp->type==GPARAM_TYPE_INT) ++ if (pval.flags & PV_VAL_INT) + { +- if (gp->v.ival!=hf->type) ++ if (pval.ri != hf->type) + continue; + } else { +- if (hf->type!=HDR_OTHER_T) ++ if (hf->type != HDR_OTHER_T) + continue; +- if (hf->name.len!=gp->v.sval.len) ++ if (hf->name.len != pval.rs.len) + continue; +- if (strncasecmp(hf->name.s, gp->v.sval.s, hf->name.len)!=0) ++ if (strncasecmp(hf->name.s, pval.rs.s, hf->name.len) != 0) + continue; + } + l=del_lump(msg, hf->name.s-msg->buf, hf->len, 0); +@@ -536,34 +529,35 @@ static int remove_hf_match_f(struct sip_msg* msg, char* pattern, char* regex_or_ + static int is_present_hf_f(struct sip_msg* msg, char* str_hf, char* foo) + { + struct hdr_field *hf; +- gparam_p gp; ++ pv_value_t pval; + +- gp = (gparam_p)str_hf; ++ pval.flags = PV_VAL_NONE; + +- if (gp->type == GPARAM_TYPE_PVS && +- parse_pvs_header(msg, gp) != 0) +- { +- LM_ERR("Parse pvs header failed!\n"); ++ if (((gparam_p)str_hf)->type == GPARAM_TYPE_INT) { ++ pval.flags = PV_VAL_INT; ++ pval.ri = ((gparam_p)str_hf)->v.ival; ++ } else if (get_pvs_header_value(msg, (gparam_p)str_hf, &pval) != 0) { ++ LM_ERR("failed to get header value\n"); + return -1; + } + + /* we need to be sure we have seen all HFs */ + parse_headers(msg, HDR_EOH_F, 0); +- for (hf=msg->headers; hf; hf=hf->next) { +- if(gp->type==GPARAM_TYPE_INT) +- { +- if (gp->v.ival!=hf->type) +- continue; +- } else { +- if (hf->type!=HDR_OTHER_T) +- continue; +- if (hf->name.len!=gp->v.sval.len) +- continue; +- if (strncasecmp(hf->name.s,gp->v.sval.s,hf->name.len)!=0) +- continue; +- } +- return 1; ++ ++ if (pval.flags & PV_VAL_INT) { ++ for (hf=msg->headers; hf; hf=hf->next) ++ if (pval.ri == hf->type) ++ return 1; ++ } else { ++ for (hf=msg->headers; hf; hf=hf->next) ++ if (hf->type == HDR_OTHER_T && ++ hf->name.len == pval.rs.len && ++ strncasecmp(hf->name.s, pval.rs.s, hf->name.len) == 0) ++ return 1; + } ++ ++ LM_DBG("header '%.*s' not found\n", pval.rs.len, pval.rs.s); ++ + return -1; + } + +@@ -785,7 +779,7 @@ static int is_method_f(struct sip_msg *msg, char *meth, char *str2 ) + */ + static int hname_fixup(void** param, int param_no) + { +- char c; ++ char *c; + struct hdr_field hdr; + gparam_p gp = NULL; + +@@ -799,32 +793,30 @@ static int hname_fixup(void** param, int param_no) + + if (gp->type == GPARAM_TYPE_STR) + { +- c = gp->v.sval.s[gp->v.sval.len]; +- gp->v.sval.s[gp->v.sval.len] = ':'; ++ c = pkg_malloc(gp->v.sval.len + 1); ++ if (!c) ++ return E_OUT_OF_MEM; ++ ++ memcpy(c, gp->v.sval.s, gp->v.sval.len); ++ c[gp->v.sval.len] = ':'; + gp->v.sval.len++; +- +- if (parse_hname2(gp->v.sval.s, gp->v.sval.s +- + ((gp->v.sval.len<4)?4:gp->v.sval.len), &hdr)==0) ++ ++ if (parse_hname2(c, c + gp->v.sval.len, &hdr) == 0) + { + LM_ERR("error parsing header name\n"); +- pkg_free(gp); + return E_UNSPEC; + } + + gp->v.sval.len--; +- gp->v.sval.s[gp->v.sval.len] = c; +- +- if (hdr.type!=HDR_OTHER_T && hdr.type!=HDR_ERROR_T) ++ pkg_free(c); ++ ++ if (hdr.type != HDR_OTHER_T && hdr.type != HDR_ERROR_T) + { +- LM_INFO("using hdr type (%d) instead of <%.*s>\n", ++ LM_DBG("using hdr type (%d) instead of <%.*s>\n", + hdr.type, gp->v.sval.len, gp->v.sval.s); +- pkg_free(gp->v.sval.s); +- gp->v.sval.s = NULL; +- gp->v.ival = hdr.type; ++ + gp->type = GPARAM_TYPE_INT; +- } else { +- gp->type = GPARAM_TYPE_STR; +- LM_INFO("using hdr type name <%.*s>\n", gp->v.sval.len, gp->v.sval.s); ++ gp->v.ival = hdr.type; + } + } + diff --git a/opensips-0013-Merge-pull-request-442-from-rgagnon24-redirect_fix.patch b/opensips-0013-Merge-pull-request-442-from-rgagnon24-redirect_fix.patch new file mode 100644 index 0000000..a52f448 --- /dev/null +++ b/opensips-0013-Merge-pull-request-442-from-rgagnon24-redirect_fix.patch @@ -0,0 +1,296 @@ +From: Bogdan Andrei IANCU +Date: Mon, 20 Apr 2015 11:06:35 +0300 +Subject: [PATCH] Merge pull request #442 from rgagnon24/redirect_fix + +Fix get_redirects(max, reason) +(cherry picked from commit ead10331a2f5b024f885f1f69e160c78c9d8eb7b) + +diff --git a/modules/uac_redirect/README b/modules/uac_redirect/README +index fc155b9..f0ae6f5 100644 +--- a/modules/uac_redirect/README ++++ b/modules/uac_redirect/README +@@ -2,10 +2,20 @@ UAC_REDIRECT Module + + Bogdan-Andrei Iancu + ++ ++ + Edited by + + Bogdan-Andrei Iancu + ++ ++ ++Edited by ++ ++Robert Gagnon ++ ++ Telepoint Global Hosting Services, LLC ++ + Copyright © 2005 Voice Sistem + Revision History + Revision $Revision: 8740 $ $Date$ +@@ -284,7 +294,11 @@ get_redirects("*"); + The function has same functionality as get_redirects(max) + function, but it will produce accounting records. + +- The accounting records will be mark by the reason phrase. ++ The accounting records will be mark by the reason phrase. This ++ phrase shall be in the same format as the reason parameter that ++ would be passed to the accounting function set by the ++ acc_function module parameter. See the ACC module documentation ++ for more information. + + If this function appears in the script, at startup, the module + will import the accounting function. Otherwise not. +@@ -293,7 +307,10 @@ get_redirects("*"); + + Example 1.9. get_redirects usage + ... +-get_redirects("4:1","Redirected"); ++get_redirects("4:1","300"); # Record 300, using the default reason stri ++ng for a 300 ++get_redirects("4:1","302 Redirected"); # Record as 302, with custom "Re ++directed" reason string + ... + + 1.6. Script Example +@@ -338,6 +355,6 @@ failure_route[1] { + } + + failure_route[2] { +- get_redirects("6:2","redirect"); ++ get_redirects("6:2", "300 redirect"); + t_relay(); + } +diff --git a/modules/uac_redirect/doc/uac_redirect.xml b/modules/uac_redirect/doc/uac_redirect.xml +index 8213fd0..7d7c553 100644 +--- a/modules/uac_redirect/doc/uac_redirect.xml ++++ b/modules/uac_redirect/doc/uac_redirect.xml +@@ -20,16 +20,17 @@ + + Bogdan-Andrei + Iancu +-
+- bogdan@opensips.org +-
++ bogdan@opensips.org +
+ + Bogdan-Andrei + Iancu +-
+- bogdan@opensips.org +-
++ bogdan@opensips.org ++
++ ++ Robert ++ Gagnon ++ Telepoint Global Hosting Services, LLC + + + +diff --git a/modules/uac_redirect/doc/uac_redirect_admin.xml b/modules/uac_redirect/doc/uac_redirect_admin.xml +index 111ba6d..d3591a0 100644 +--- a/modules/uac_redirect/doc/uac_redirect_admin.xml ++++ b/modules/uac_redirect/doc/uac_redirect_admin.xml +@@ -439,7 +439,10 @@ get_redirects("*"); +
+ + The accounting records will be mark by the +- reason phrase. ++ reason phrase. This phrase shall be in the same format ++ as the reason parameter that would be passed to the ++ accounting function set by the acc_function module parameter. ++ See the ACC module documentation for more information. + + + If this function appears in the script, at startup, the module +@@ -452,7 +455,8 @@ get_redirects("*"); + <function>get_redirects</function> usage + + ... +-get_redirects("4:1","Redirected"); ++get_redirects("4:1","300"); # Record 300, using the default reason string for a 300 ++get_redirects("4:1","302 Redirected"); # Record as 302, with custom "Redirected" reason string + ... + + +@@ -503,7 +507,7 @@ failure_route[1] { + } + + failure_route[2] { +- get_redirects("6:2","redirect"); ++ get_redirects("6:2", "300 redirect"); + t_relay(); + } + +diff --git a/modules/uac_redirect/rd_funcs.c b/modules/uac_redirect/rd_funcs.c +index 850a4be..32f1d5f 100644 +--- a/modules/uac_redirect/rd_funcs.c ++++ b/modules/uac_redirect/rd_funcs.c +@@ -41,11 +41,11 @@ + #define DEFAULT_Q_VALUE 10 + + static int shmcontact2dset(struct sip_msg *req, struct sip_msg *shrpl, +- long max, struct acc_param *reason); ++ long max, pv_elem_t *reason); + + + int get_redirect( struct sip_msg *msg , int maxt, int maxb, +- struct acc_param *reason) ++ pv_elem_t *reason) + { + struct cell *t; + int max; +@@ -159,7 +159,7 @@ static void sort_contacts(contact_t *ct_list, str *ct_array, + * n - ok and n contacts added + */ + static int shmcontact2dset(struct sip_msg *req, struct sip_msg *sh_rpl, +- long max, struct acc_param *reason) ++ long max, pv_elem_t *reason) + { + static struct sip_msg dup_rpl; + static str scontacts[MAX_CONTACTS_PER_REPLY]; +diff --git a/modules/uac_redirect/rd_funcs.h b/modules/uac_redirect/rd_funcs.h +index b87b7d5..79c27f7 100644 +--- a/modules/uac_redirect/rd_funcs.h ++++ b/modules/uac_redirect/rd_funcs.h +@@ -43,7 +43,7 @@ extern cmd_function rd_acc_fct; + extern char *acc_db_table; + + int get_redirect( struct sip_msg *msg , int maxt, int maxb, +- struct acc_param *reason); ++ pv_elem_t *reason); + + #endif + +diff --git a/modules/uac_redirect/redirect.c b/modules/uac_redirect/redirect.c +index a235c2b..560786a 100644 +--- a/modules/uac_redirect/redirect.c ++++ b/modules/uac_redirect/redirect.c +@@ -60,8 +60,8 @@ char *def_filter_s = 0; + static int redirect_init(void); + static int w_set_deny(struct sip_msg* msg, char *dir, char *foo); + static int w_set_accept(struct sip_msg* msg, char *dir, char *foo); +-static int w_get_redirect1(struct sip_msg* msg, char *dir, char *foo); +-static int w_get_redirect2(struct sip_msg* msg, char *dir, char *foo); ++static int w_get_redirect1(struct sip_msg* msg, char *max_c); ++static int w_get_redirect2(struct sip_msg* msg, char *max_c, pv_elem_t *reason); + static int regexp_compile(char *re_s, regex_t **re); + static int get_redirect_fixup(void** param, int param_no); + static int setf_fixup(void** param, int param_no); +@@ -137,62 +137,59 @@ int get_nr_max(char *s, unsigned char *max) + static int get_redirect_fixup(void** param, int param_no) + { + unsigned char maxb,maxt; +- struct acc_param *accp; ++ pv_elem_t *reason; + cmd_function fct; + char *p; +- char *s; ++ str s; + +- s = (char*)*param; +- if (param_no==1) { +- if ( (p=strchr(s,':'))!=0 ) { ++ s.s = (char*)*param; ++ if (param_no == 1) { ++ if ( (p = strchr(s.s, ':')) != 0 ) { + /* have max branch also */ + *p = 0; +- if (get_nr_max(p+1, &maxb)!=0) ++ if (get_nr_max(p + 1, &maxb) != 0) + return E_UNSPEC; + } else { + maxb = 0; /* infinit */ + } + + /* get max total */ +- if (get_nr_max(s, &maxt)!=0) ++ if (get_nr_max(s.s, &maxt) != 0) + return E_UNSPEC; + + pkg_free(*param); +- *param=(void*)(long)( (((unsigned short)maxt)<<8) | maxb); ++ *param = (void*)(long)( (((unsigned short)maxt) << 8) | maxb); + +- } else if (param_no==2) { ++ } else if (param_no == 2) { + /* acc function loaded? */ +- if (rd_acc_fct!=0) ++ if (rd_acc_fct != 0) + return 0; + /* must import the acc stuff */ +- if (acc_fct_s==0 || acc_fct_s[0]==0) { ++ if (acc_fct_s == 0 || acc_fct_s[0] == 0) { + LM_ERR("acc support enabled, but no acc function defined\n"); + return E_UNSPEC; + } + fct = find_export(acc_fct_s, 2, REQUEST_ROUTE); +- if ( fct==0 ) ++ if (fct == 0) + fct = find_export(acc_fct_s, 1, REQUEST_ROUTE); +- if ( fct==0 ) { ++ if (fct == 0) { + LM_ERR("cannot import %s function; is acc loaded and proper " + "compiled?\n", acc_fct_s); + return E_UNSPEC; + } + rd_acc_fct = fct; +- /* set the reason str */ +- accp = (struct acc_param*)pkg_malloc(sizeof(struct acc_param)); +- if (accp==0) { +- LM_ERR("no more pkg mem\n"); +- return E_UNSPEC; +- } +- memset( accp, 0, sizeof(struct acc_param)); +- if (s!=0 && *s!=0) { +- accp->reason.s = s; +- accp->reason.len = strlen(s); ++ /* Convert reason into pv_elem_t */ ++ if (s.s == 0 || s.s[0] == 0) { ++ s.s = "n/a"; ++ s.len = 3; + } else { +- accp->reason.s = "n/a"; +- accp->reason.len = 3; ++ s.len = strlen(s.s); ++ } ++ if (pv_parse_format(&s, &reason) < 0) { ++ LM_ERR("pv_parse_format failed\n"); ++ return E_OUT_OF_MEM; + } +- *param=(void*)accp; ++ *param = (void*)reason; + } + + return 0; +@@ -336,7 +333,7 @@ static int w_set_accept(struct sip_msg* msg, char *re, char *flags) + } + + +-static int w_get_redirect2(struct sip_msg* msg, char *max_c, char *reason) ++static int w_get_redirect2(struct sip_msg* msg, char *max_c, pv_elem_t *reason) + { + int n; + unsigned short max; +@@ -344,7 +341,7 @@ static int w_get_redirect2(struct sip_msg* msg, char *max_c, char *reason) + msg_tracer( msg, 0); + /* get the contacts */ + max = (unsigned short)(long)max_c; +- n = get_redirect(msg , (max>>8)&0xff, max&0xff, (struct acc_param*)reason); ++ n = get_redirect(msg , (max>>8)&0xff, max&0xff, reason); + reset_filters(); + /* reset the tracer */ + msg_tracer( msg, 1); +@@ -353,7 +350,7 @@ static int w_get_redirect2(struct sip_msg* msg, char *max_c, char *reason) + } + + +-static int w_get_redirect1(struct sip_msg* msg, char *max_c, char *foo) ++static int w_get_redirect1(struct sip_msg* msg, char *max_c) + { + return w_get_redirect2(msg, max_c, 0); + } diff --git a/opensips-0014-Merge-pull-request-431-from-dsandras-ds-fix-sst-avp.patch b/opensips-0014-Merge-pull-request-431-from-dsandras-ds-fix-sst-avp.patch new file mode 100644 index 0000000..96c09f7 --- /dev/null +++ b/opensips-0014-Merge-pull-request-431-from-dsandras-ds-fix-sst-avp.patch @@ -0,0 +1,19 @@ +From: Bogdan Andrei IANCU +Date: Mon, 20 Apr 2015 12:21:34 +0300 +Subject: [PATCH] Merge pull request #431 from dsandras/ds-fix-sst-avp + +dialog: Update dlg lifetime whe re-evaluating the AVP after the callback... +(cherry picked from commit 2cf99baad363c0c5ba3aa9966214a63fb5fb195a) + +diff --git a/modules/dialog/dlg_handlers.c b/modules/dialog/dlg_handlers.c +index f32eb0b..05637b8 100644 +--- a/modules/dialog/dlg_handlers.c ++++ b/modules/dialog/dlg_handlers.c +@@ -1262,6 +1262,7 @@ after_unlock5: + /* update timer during sequential request? */ + timeout = get_dlg_timeout_update(req); + if (timeout != 0) { ++ dlg->lifetime = timeout; + if (update_dlg_timer( &dlg->tl, dlg->lifetime )==-1) + LM_ERR("failed to update dialog lifetime\n"); + } diff --git a/opensips-0015-db_mysql-properly-set-TCP-related-timeouts.patch b/opensips-0015-db_mysql-properly-set-TCP-related-timeouts.patch new file mode 100644 index 0000000..40068c1 --- /dev/null +++ b/opensips-0015-db_mysql-properly-set-TCP-related-timeouts.patch @@ -0,0 +1,38 @@ +From: Liviu Chircu +Date: Mon, 20 Apr 2015 15:07:49 +0300 +Subject: [PATCH] db_mysql: properly set TCP-related timeouts + +According to official documentation, mysql_options() must be used _after_ +mysql_init() + +diff --git a/modules/db_mysql/my_con.c b/modules/db_mysql/my_con.c +index 4bd91a6..09fb00c 100644 +--- a/modules/db_mysql/my_con.c ++++ b/modules/db_mysql/my_con.c +@@ -39,6 +39,11 @@ int db_mysql_connect(struct my_con* ptr) + mysql_init(ptr->con); + ptr->init = 1; + ++ /* set connect, read and write timeout, the value counts three times */ ++ mysql_options(ptr->con, MYSQL_OPT_CONNECT_TIMEOUT, &db_mysql_timeout_interval); ++ mysql_options(ptr->con, MYSQL_OPT_READ_TIMEOUT, &db_mysql_timeout_interval); ++ mysql_options(ptr->con, MYSQL_OPT_WRITE_TIMEOUT, &db_mysql_timeout_interval); ++ + if (ptr->id->port) { + LM_DBG("opening connection: mysql://xxxx:xxxx@%s:%d/%s\n", + ZSW(ptr->id->host), ptr->id->port, ZSW(ptr->id->database)); +@@ -101,14 +106,6 @@ struct my_con* db_mysql_new_connection(const struct db_id* id) + goto err; + } + +- /* set connect, read and write timeout, the value counts three times */ +- mysql_options(ptr->con, MYSQL_OPT_CONNECT_TIMEOUT, +- (const char *)&db_mysql_timeout_interval); +- mysql_options(ptr->con, MYSQL_OPT_READ_TIMEOUT, +- (const char *)&db_mysql_timeout_interval); +- mysql_options(ptr->con, MYSQL_OPT_WRITE_TIMEOUT, +- (const char *)&db_mysql_timeout_interval); +- + ptr->id = (struct db_id*)id; + + if (db_mysql_connect(ptr)!=0) { diff --git a/opensips-0016-Populate-the-rcode-pval-in-rest-get-post-methods-bef.patch b/opensips-0016-Populate-the-rcode-pval-in-rest-get-post-methods-bef.patch new file mode 100644 index 0000000..fd75ba8 --- /dev/null +++ b/opensips-0016-Populate-the-rcode-pval-in-rest-get-post-methods-bef.patch @@ -0,0 +1,92 @@ +From: Jarrod Baumann +Date: Fri, 24 Apr 2015 19:10:46 +0300 +Subject: [PATCH] Populate the rcode pval in rest get/post methods before + returning error + +(cherry picked from commit fa37b3dd8df4a02d42503cf5ab8c8de8be528c33) + +diff --git a/modules/rest_client/rest_methods.c b/modules/rest_client/rest_methods.c +index 9ae53d5..24bc7bf 100644 +--- a/modules/rest_client/rest_methods.c ++++ b/modules/rest_client/rest_methods.c +@@ -75,6 +75,20 @@ int rest_get_method(struct sip_msg *msg, char *url, + curl_easy_setopt(handle, CURLOPT_WRITEHEADER, &st); + + rc = curl_easy_perform(handle); ++ ++ if (code_pv) { ++ curl_easy_getinfo(handle, CURLINFO_RESPONSE_CODE, &http_rc); ++ LM_DBG("Last response code: %ld\n", http_rc); ++ ++ pv_val.flags = PV_VAL_INT|PV_TYPE_INT; ++ pv_val.ri = (int)http_rc; ++ ++ if (pv_set_value(msg, code_pv, 0, &pv_val) != 0) { ++ LM_ERR("Set code pv value failed!\n"); ++ goto error; ++ } ++ } ++ + if (rc != CURLE_OK) { + LM_ERR("Error [%i] while performing curl operation\n", rc); + LM_ERR("[%s]\n", err_buff); +@@ -105,19 +119,6 @@ int rest_get_method(struct sip_msg *msg, char *url, + } + } + +- if (code_pv) { +- curl_easy_getinfo(handle, CURLINFO_RESPONSE_CODE, &http_rc); +- LM_DBG("Last response code: %ld\n", http_rc); +- +- pv_val.flags = PV_VAL_INT|PV_TYPE_INT; +- pv_val.ri = (int)http_rc; +- +- if (pv_set_value(msg, code_pv, 0, &pv_val) != 0) { +- LM_ERR("Set code pv value failed!\n"); +- goto error; +- } +- } +- + curl_easy_cleanup(handle); + return 1; + +@@ -179,6 +180,19 @@ int rest_post_method(struct sip_msg *msg, char *url, char *ctype, char *body, + curl_easy_setopt(handle, CURLOPT_WRITEHEADER, &st); + + rc = curl_easy_perform(handle); ++ if (code_pv) { ++ curl_easy_getinfo(handle, CURLINFO_RESPONSE_CODE, &http_rc); ++ LM_DBG("Last response code: %ld\n", http_rc); ++ ++ pv_val.flags = PV_VAL_INT|PV_TYPE_INT; ++ pv_val.ri = (int)http_rc; ++ ++ if (pv_set_value(msg, code_pv, 0, &pv_val) != 0) { ++ LM_ERR("Set code pv value failed!\n"); ++ goto error; ++ } ++ } ++ + curl_slist_free_all(list); + + if (rc != CURLE_OK) { +@@ -211,19 +225,6 @@ int rest_post_method(struct sip_msg *msg, char *url, char *ctype, char *body, + } + } + +- if (code_pv) { +- curl_easy_getinfo(handle, CURLINFO_RESPONSE_CODE, &http_rc); +- LM_DBG("Last response code: %ld\n", http_rc); +- +- pv_val.flags = PV_VAL_INT|PV_TYPE_INT; +- pv_val.ri = (int)http_rc; +- +- if (pv_set_value(msg, code_pv, 0, &pv_val) != 0) { +- LM_ERR("Set code pv value failed!\n"); +- goto error; +- } +- } +- + curl_easy_cleanup(handle); + return 1; + diff --git a/opensips-0017-Fix-inlining.patch b/opensips-0017-Fix-inlining.patch new file mode 100644 index 0000000..e270ded --- /dev/null +++ b/opensips-0017-Fix-inlining.patch @@ -0,0 +1,72 @@ +From: Peter Lemenkov +Date: Sat, 2 May 2015 17:02:41 +0300 +Subject: [PATCH] Fix inlining + +Signed-off-by: Peter Lemenkov + +diff --git a/daemonize.h b/daemonize.h +index c15ac48..dab13b0 100644 +--- a/daemonize.h ++++ b/daemonize.h +@@ -38,5 +38,5 @@ int send_status_code(char val); + void clean_write_pipeend(void); + int create_status_pipe(void); + int wait_for_all_children(void); +-inline void inc_init_timer(void); ++extern inline void inc_init_timer(void); + #endif +diff --git a/db/db_insertq.h b/db/db_insertq.h +index 2916e3d..a998cd7 100644 +--- a/db/db_insertq.h ++++ b/db/db_insertq.h +@@ -92,7 +92,7 @@ inline int ql_flush_rows(db_func_t *dbf,db_con_t *conn,query_list_t *entry); + lock_release((entry)->lock); \ + } while (0) + +-inline void cleanup_rows(db_val_t **rows); ++extern inline void cleanup_rows(db_val_t **rows); + void handle_ql_shutdown(void); + + #endif +diff --git a/mem/meminfo.h b/mem/meminfo.h +index 755b9fa..ef3b532 100644 +--- a/mem/meminfo.h ++++ b/mem/meminfo.h +@@ -45,7 +45,7 @@ struct mem_info{ + // threshold percentage checked + extern long event_pkg_threshold; + // events are used only if STATISTICS are used +-inline void pkg_threshold_check(void); ++extern inline void pkg_threshold_check(void); + #else + #define pkg_threshold_check() + #endif /* STATISTICS */ +diff --git a/resolve.h b/resolve.h +index f25595a..4f6987d 100644 +--- a/resolve.h ++++ b/resolve.h +@@ -342,9 +342,9 @@ int check_ip_address(struct ip_addr* ip, str *name, + struct hostent* sip_resolvehost(str* name, unsigned short* port, + unsigned short *proto, int is_sips, struct dns_node **dn); + +-inline struct hostent* resolvehost(char* name, int no_ip_test); ++extern inline struct hostent* resolvehost(char* name, int no_ip_test); + +-inline struct hostent* rev_resolvehost(struct ip_addr *ip); ++extern inline struct hostent* rev_resolvehost(struct ip_addr *ip); + + /*! \brief free the DNS resolver state machine */ + void free_dns_res( struct proxy_l *p ); +diff --git a/socket_info.h b/socket_info.h +index f3afbab..2aa0469 100644 +--- a/socket_info.h ++++ b/socket_info.h +@@ -55,7 +55,7 @@ extern struct socket_info* sctp_listen; + int add_listen_iface(char* name, unsigned short port, unsigned short proto, + char *adv_name, unsigned short adv_port, + unsigned short children, enum si_flags flags); +-inline struct socket_info * ++extern inline struct socket_info * + new_sock_info(char* name, unsigned short port, unsigned short proto, + char *adv_name, unsigned short adv_port, + unsigned short children, enum si_flags flags); diff --git a/opensips.spec b/opensips.spec index c252b8b..5878961 100644 --- a/opensips.spec +++ b/opensips.spec @@ -8,20 +8,12 @@ %global opensips_group root %endif -%global _with_snmpstats 1 -%if 0%{?el5} -# copied from lm_sensors exclusive arch -%ifnarch alpha %{ix86} x86_64 -%global _with_snmpstats 0 -%endif -%endif - -%global EXCLUDE_MODULES cachedb_cassandra cachedb_couchbase cachedb_mongodb %{?el5:cachedb_redis} %{!?_with_oracle:db_oracle} lua osp sngtc %{!?_with_snmpstats:snmpstats} +%global EXCLUDE_MODULES cachedb_cassandra cachedb_couchbase cachedb_mongodb %{!?_with_oracle:db_oracle} lua osp sngtc Summary: Open Source SIP Server Name: opensips -Version: 1.10.3 -Release: 2%{?dist} +Version: 1.10.4 +Release: 1%{?dist} License: GPLv2+ Group: System Environment/Daemons Source0: https://opensips.org/pub/%{name}/%{version}/src/%{name}-%{version}_src.tar.gz @@ -29,11 +21,20 @@ Patch1: opensips-0001-Consistently-use-rtpproxy-switches.patch Patch2: opensips-0002-Cleanup-Oracle-s-makefiles.patch Patch3: opensips-0003-Removed-all-async-Oracle-operations-they-didn-t-work.patch Patch4: opensips-0004-db_oracle-Fix-default-ret-result.patch +# FIXME remove this outdated patch in the next major version (1.11.x) Patch5: opensips-0005-Fix-for-old-Perl-in-RHEL5.patch Patch6: opensips-0006-Don-t-modify-interim-return-value.patch Patch7: opensips-0007-Return-actual-payload-ID-in-case-of-a-dynamic-payloa.patch Patch8: opensips-0008-Use-additional-auth-field-Sip-Source-IP-Address.patch Patch9: opensips-0009-Don-t-remove-pthread-library-explicitly-from-mi_xmlr.patch +Patch10: opensips-0010-parser-fix-memory-leak.patch +Patch11: opensips-0011-Merge-pull-request-462-from-jarrodb-dlg_hash.patch +Patch12: opensips-0012-sipmsgops-fix-buffer-management-issue.patch +Patch13: opensips-0013-Merge-pull-request-442-from-rgagnon24-redirect_fix.patch +Patch14: opensips-0014-Merge-pull-request-431-from-dsandras-ds-fix-sst-avp.patch +Patch15: opensips-0015-db_mysql-properly-set-TCP-related-timeouts.patch +Patch16: opensips-0016-Populate-the-rcode-pval-in-rest-get-post-methods-bef.patch +Patch17: opensips-0017-Fix-inlining.patch URL: https://opensips.org BuildRequires: expat-devel @@ -47,16 +48,14 @@ BuildRequires: mysql-devel BuildRequires: postgresql-devel # required by snmpstats module -%if 0%{?_with_snmpstats} BuildRequires: lm_sensors-devel -%endif BuildRequires: net-snmp-devel BuildRequires: unixODBC-devel BuildRequires: openssl-devel BuildRequires: expat-devel BuildRequires: xmlrpc-c-devel BuildRequires: libconfuse-devel -%if 0%{?el5}%{?el6} +%if 0%{?el6} BuildRequires: db4-devel %else BuildRequires: libdb-devel @@ -87,7 +86,6 @@ Requires(preun):chkconfig Requires(preun):initscripts %endif Obsoletes: %{name}-event_datagram -BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) %description OpenSIPS or Open SIP Server is a very fast and flexible SIP (RFC3261) @@ -307,7 +305,7 @@ Summary: Helps implement your own OpenSIPS extensions in Perl Group: System Environment/Daemons # require perl-devel for >F7 and perl for <=F6 BuildRequires: perl(ExtUtils::MakeMaker) -%if 0%{?el5}%{?el6} +%if 0%{?el6} BuildRequires: perl(ExtUtils::Embed) %else BuildRequires: perl(ExtUtils::Embed), perl-devel @@ -507,7 +505,6 @@ Requires: %{name}%{?_isa} = %{version}-%{release} %description python Helps implement your own OpenSIPS extensions in Python -%if %{undefined el5} %package redis Summary: Redis connector Group: System Environment/Daemons @@ -517,7 +514,6 @@ BuildRequires: hiredis-devel %description redis This module is an implementation of a cache system designed to work with a Redis server. -%endif %package regex Summary: RegExp via PCRE library @@ -577,7 +573,6 @@ like SMS confirmation--the gateway can confirm to the SIP user if his message really reached its destination as a SMS--or multi-part messages--if a SIP messages is too long it will be split and sent as multiple SMS. -%if 0%{?_with_snmpstats} %package snmpstats Summary: SNMP management interface for the OpenSIPS Group: System Environment/Daemons @@ -589,7 +584,6 @@ The %{name}-snmpstats package provides an SNMP management interface to OpenSIPS. Specifically, it provides general SNMP queryable scalar statistics, table representations of more complicated data such as user and contact information, and alarm monitoring capabilities. -%endif %package tlsops Summary: TLS-relating functions for the OpenSIPS @@ -667,13 +661,19 @@ clients. rm -f modules/db_oracle/asynch.* %patch3 -p1 %patch4 -p1 -%if 0%{?el5} -%patch5 -p1 -%endif +# Patch no.5 removed %patch6 -p1 -b .dont_modify %patch7 -p1 -b .return_actual_payload_id %patch8 -p1 -b .additional_auth_field_src_ip %patch9 -p1 -b .restore_pthread_linkage +%patch10 -p1 +%patch11 -p1 +%patch12 -p1 +%patch13 -p1 +%patch14 -p1 +%patch15 -p1 +%patch16 -p1 +%patch17 -p1 %build LOCALBASE=/usr NICER=0 CFLAGS="%{optflags}" LDFLAGS="%{?__global_ldflags}" %{?_with_oracle:ORAHOME="$ORACLE_HOME"} %{__make} all %{?_smp_mflags} TLS=1 \ @@ -683,7 +683,6 @@ LOCALBASE=/usr NICER=0 CFLAGS="%{optflags}" LDFLAGS="%{?__global_ldflags}" %{?_w modules-dir=%{_lib}/%{name}/modules %install -rm -rf %{buildroot} make install TLS=1 LIBDIR=%{_lib} \ exclude_modules="%EXCLUDE_MODULES" \ basedir=%{buildroot} prefix=%{_prefix} \ @@ -715,7 +714,7 @@ for i in docdir/*; do rm -f $i.old done -%if 0%{?el5}%{?el6} +%if 0%{?el6} install -p -D -m 755 packaging/fedora/opensips.init %{buildroot}%{_initrddir}/opensips %else # install systemd files @@ -731,9 +730,6 @@ echo -e "\nETCDIR=\"%{_sysconfdir}/opensips\"\n" \ #install sysconfig file install -D -p -m 644 packaging/fedora/%{name}.sysconfig %{buildroot}%{_sysconfdir}/sysconfig/%{name} -%clean -rm -rf %{buildroot} - %pre %if 0%{?el6}%{?el7}%{?fedora} @@ -744,14 +740,14 @@ useradd -r -g %{name} -d %{_localstatedir}/run/%{name} -s /sbin/nologin \ %endif %post -%if 0%{?el5}%{?el6} +%if 0%{?el6} /sbin/chkconfig --add %{name} %else %systemd_post %{name}.service %endif %preun -%if 0%{?el5}%{?el6} +%if 0%{?el6} if [ $1 = 0 ] ; then /sbin/service %{name} stop >/dev/null 2>&1 /sbin/chkconfig --del %{name} @@ -779,7 +775,7 @@ fi %dir %{_libdir}/opensips/opensipsctl/ %dir %{_libdir}/opensips/opensipsctl/dbtextdb/ -%if 0%{?el5}%{?el6} +%if 0%{?el6} %attr(755,root,root) %{_initrddir}/opensips %else %{_unitdir}/%{name}.service @@ -1183,11 +1179,9 @@ fi %files python %{_libdir}/opensips/modules/python.so -%if %{undefined el5} %files redis %{_libdir}/opensips/modules/cachedb_redis.so %doc docdir/README.cachedb_redis -%endif %files regex %{_libdir}/opensips/modules/regex.so @@ -1209,7 +1203,6 @@ fi %{_libdir}/opensips/modules/sms.so %doc docdir/README.sms -%if 0%{?_with_snmpstats} %files snmpstats %{_libdir}/opensips/modules/snmpstats.so %doc docdir/README.snmpstats @@ -1220,7 +1213,6 @@ fi %{_datadir}/snmp/mibs/OPENSER-SIP-COMMON-MIB %{_datadir}/snmp/mibs/OPENSER-SIP-SERVER-MIB %{_datadir}/snmp/mibs/OPENSER-TC -%endif %files tlsops %{_libdir}/opensips/modules/tlsops.so @@ -1251,6 +1243,10 @@ fi %doc docdir/README.xmpp %changelog +* Sat May 2 2015 Peter Lemenkov - 1.10.4-1 +- Ver. 1.10.4 +- Dropped EL5 compatibility + * Tue Apr 21 2015 Remi Collet - 1.10.3-2 - rebuild for new librabbitmq diff --git a/sources b/sources index 3eafafc..875577d 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -23218093c6cfb0e9f50e323a2e222c49 opensips-1.10.3_src.tar.gz +dcbee30a571a90e3c198488d4f33a566 opensips-1.10.4_src.tar.gz