From 9fdfac77d99c5287cfcc19ef196f04de7f28cc8b Mon Sep 17 00:00:00 2001 From: Peter Lemenkov Date: Nov 21 2017 12:22:07 +0000 Subject: Fix building with MariaDB Signed-off-by: Peter Lemenkov --- diff --git a/opensips-0032-acc-fix-possbile-memory-leak-when-calling-do_account.patch b/opensips-0032-acc-fix-possbile-memory-leak-when-calling-do_account.patch new file mode 100644 index 0000000..fc3aaa6 --- /dev/null +++ b/opensips-0032-acc-fix-possbile-memory-leak-when-calling-do_account.patch @@ -0,0 +1,42 @@ +From: rvlad-patrascu +Date: Fri, 6 Oct 2017 19:47:12 +0300 +Subject: [PATCH] acc: fix possbile memory leak when calling do_accounting() on + CANCEL while "report_cancels" modparam not set + +(cherry picked from commit aa32bf1b6909c8471eea8c2170a3a2a3f94be1cf) + +Conflicts: + modules/acc/acc_logic.c + +diff --git a/modules/acc/acc_logic.c b/modules/acc/acc_logic.c +index 47daf4204..2072afb29 100644 +--- a/modules/acc/acc_logic.c ++++ b/modules/acc/acc_logic.c +@@ -1086,6 +1086,17 @@ int w_do_acc_3(struct sip_msg* msg, char* type_p, char* flags_p, char* table_p) + return -1; + } + ++ if (!msg) { ++ LM_ERR("no SIP message\n"); ++ return -1; ++ } ++ ++ if (skip_cancel(msg)) { ++ LM_WARN("do_accounting() called on CANCEL but 'report_cancels' modparam" ++ " not set - no accounting will be done for this transaction!\n"); ++ return 1; ++ } ++ + acc_param = (acc_type_param_t *)type_p; + if (acc_param->t == DO_ACC_PARAM_TYPE_VALUE) { + type = acc_param->u.ival; +@@ -1177,8 +1188,7 @@ int w_do_acc_3(struct sip_msg* msg, char* type_p, char* flags_p, char* table_p) + } + + +- if ( msg && !skip_cancel(msg) && +- (is_acc_on(*flag_mask_p) || is_mc_acc_on(*flag_mask_p)) ) { ++ if (is_acc_on(*flag_mask_p) || is_mc_acc_on(*flag_mask_p)) { + /* do some parsing in advance */ + if (acc_preparse_req(msg)<0) + return -1; diff --git a/opensips-0033-dialog-fix-a-runtime-bug-with-DLGCB_LOADED-callbacks.patch b/opensips-0033-dialog-fix-a-runtime-bug-with-DLGCB_LOADED-callbacks.patch new file mode 100644 index 0000000..0ee5852 --- /dev/null +++ b/opensips-0033-dialog-fix-a-runtime-bug-with-DLGCB_LOADED-callbacks.patch @@ -0,0 +1,69 @@ +From: rvlad-patrascu +Date: Fri, 13 Oct 2017 19:11:11 +0300 +Subject: [PATCH] dialog: fix a runtime bug with DLGCB_LOADED callbacks + +Relying on the fact that all modules that register dialog callbacks are initialised +after the dialog module (thanks to module dependencies), we can run all DLGCB_LOADED +callbacks at registration time and also keep them in a list for calling them later +(i.e reloading from database via MI cmd or receiving replicated dialog). + +This fixes a series of bugs where the DLGCB_LOADED callback is not run during, e.g. +"dlg_db_sync" MI command or received replicated dialogs which do not have their +callbacks installed or run. + +(cherry picked from commit 8c8f27f6091289061f6aaf0d3c85ccd27db80a0d) + +diff --git a/modules/dialog/dialog.c b/modules/dialog/dialog.c +index 64b210e4e..9e827343a 100644 +--- a/modules/dialog/dialog.c ++++ b/modules/dialog/dialog.c +@@ -961,10 +961,8 @@ static int mod_init(void) + LM_ERR("failed to initialize the DB support\n"); + return -1; + } +- run_load_callbacks(); + } + +- mark_dlg_loaded_callbacks_run(); + destroy_cachedb(0); + + return 0; +diff --git a/modules/dialog/dlg_cb.c b/modules/dialog/dlg_cb.c +index d1cca0264..d5437cf50 100644 +--- a/modules/dialog/dlg_cb.c ++++ b/modules/dialog/dlg_cb.c +@@ -36,7 +36,6 @@ + + static struct dlg_head_cbl* create_cbs = 0; + +-static int dlg_load_cbs_run = 0; + static struct dlg_head_cbl* load_cbs = 0; + + static struct dlg_cb_params params = {NULL, DLG_DIR_NONE, NULL, NULL}; +@@ -80,11 +79,6 @@ void destroy_dlg_callbacks_list(struct dlg_callback *cb) + } + } + +-void mark_dlg_loaded_callbacks_run(void) +-{ +- dlg_load_cbs_run = 1; +-} +- + + void destroy_dlg_callbacks(unsigned int types) + { +@@ -161,11 +155,9 @@ int register_dlgcb(struct dlg_cell *dlg, int types, dialog_cb f, + create_cbs->first = cb; + create_cbs->types |= types; + } else if (types==DLGCB_LOADED) { +- if (dlg_load_cbs_run) { +- /* run the callback on the spot */ +- run_load_callback(cb); +- return 0; +- } ++ /* run the callback on the spot */ ++ run_load_callback(cb); ++ /* also insert callback in list to be able to run it later */ + if (load_cbs==0) { + /* not initialized yet */ + if ( (load_cbs=init_dlg_callback())==NULL ) { diff --git a/opensips-0034-dialog-also-share-module-flags-when-replicating-dial.patch b/opensips-0034-dialog-also-share-module-flags-when-replicating-dial.patch new file mode 100644 index 0000000..dffbd39 --- /dev/null +++ b/opensips-0034-dialog-also-share-module-flags-when-replicating-dial.patch @@ -0,0 +1,45 @@ +From: rvlad-patrascu +Date: Mon, 16 Oct 2017 17:26:29 +0300 +Subject: [PATCH] dialog: also share module flags when replicating dialogs + +(cherry picked from commit ad35e7cedc44efd90c58f26a853585ece5883bac) + +Conflicts: + modules/dialog/dlg_replication.c + +diff --git a/modules/dialog/dlg_replication.c b/modules/dialog/dlg_replication.c +index 1eb94816c..c6c084eb2 100644 +--- a/modules/dialog/dlg_replication.c ++++ b/modules/dialog/dlg_replication.c +@@ -193,6 +193,7 @@ int dlg_replicated_create(struct dlg_cell *cell, str *ftag, str *ttag, int safe) + bin_pop_str(&vars); + bin_pop_str(&profiles); + bin_pop_int(&dlg->user_flags); ++ bin_pop_int(&dlg->mod_flags); + bin_pop_int(&dlg->flags); + bin_pop_int((void *) &dlg->tl.timeout); + bin_pop_int(&dlg->legs[DLG_CALLER_LEG].last_gen_cseq); +@@ -335,6 +336,7 @@ int dlg_replicated_update(void) + bin_pop_str(&vars); + bin_pop_str(&profiles); + bin_pop_int(&dlg->user_flags); ++ bin_pop_int(&dlg->mod_flags); + bin_pop_int(&dlg->flags); + + bin_pop_int(&timeout); +@@ -513,6 +515,7 @@ void replicate_dialog_created(struct dlg_cell *dlg) + bin_push_str(vars); + bin_push_str(profiles); + bin_push_int(dlg->user_flags); ++ bin_push_int(dlg->mod_flags); + bin_push_int(dlg->flags & + ~(DLG_FLAG_NEW|DLG_FLAG_CHANGED|DLG_FLAG_VP_CHANGED)); + bin_push_int((unsigned int)time(0) + dlg->tl.timeout - get_ticks()); +@@ -595,6 +598,7 @@ void replicate_dialog_updated(struct dlg_cell *dlg) + bin_push_str(vars); + bin_push_str(profiles); + bin_push_int(dlg->user_flags); ++ bin_push_int(dlg->mod_flags); + bin_push_int(dlg->flags & + ~(DLG_FLAG_NEW|DLG_FLAG_CHANGED|DLG_FLAG_VP_CHANGED)); + bin_push_int((unsigned int)time(0) + dlg->tl.timeout - get_ticks()); diff --git a/opensips-0035-Fix-escaping-URI-parameters-skip-alphanumerical-char.patch b/opensips-0035-Fix-escaping-URI-parameters-skip-alphanumerical-char.patch new file mode 100644 index 0000000..b249423 --- /dev/null +++ b/opensips-0035-Fix-escaping-URI-parameters-skip-alphanumerical-char.patch @@ -0,0 +1,105 @@ +From: Bogdan-Andrei Iancu +Date: Tue, 17 Oct 2017 11:40:47 +0300 +Subject: [PATCH] Fix escaping URI parameters - skip alphanumerical chars. + +Reported by Ben Newlin on "user" mailing list. + +(cherry picked from commit b5094f0dc6a4f52555f9cca1ea9df7c846749482) + +diff --git a/strcommon.c b/strcommon.c +index 23e3299fa..58009b93c 100644 +--- a/strcommon.c ++++ b/strcommon.c +@@ -274,8 +274,7 @@ int escape_user(str *sin, str *sout) + LM_ERR("invalid escaped character <%u>\n", (unsigned int)*p); + return -1; + } +- if (isdigit((int)*p) || ((*p >= 'A') && (*p <= 'Z')) || +- ((*p >= 'a') && (*p <= 'z'))) ++ if (isalnum((int)*p)) + { + *at = *p; + } else { +@@ -358,42 +357,46 @@ int escape_param(str *sin, str *sout) + LM_ERR("invalid escaped character <%u>\n", (unsigned int)*p); + return -1; + } +- switch (*p) { +- /* unreserved chars */ +- case '-': +- case '_': +- case '.': +- case '!': +- case '~': +- case '*': +- case '\'': +- case '(': +- case ')': +- /* param unreserved chars */ +- case '[': +- case ']': +- case '/': +- case ':': +- case '&': +- case '+': +- case '$': +- *at = *p; +- break; +- default: +- *at++ = '%'; +- x = (*p) >> 4; +- if (x < 10) +- { +- *at++ = x + '0'; +- } else { +- *at++ = x - 10 + 'a'; +- } +- x = (*p) & 0x0f; +- if (x < 10) { +- *at = x + '0'; +- } else { +- *at = x - 10 + 'a'; +- } ++ if (isalnum((int)*p)) { ++ *at = *p; ++ } else { ++ switch (*p) { ++ /* unreserved chars */ ++ case '-': ++ case '_': ++ case '.': ++ case '!': ++ case '~': ++ case '*': ++ case '\'': ++ case '(': ++ case ')': ++ /* param unreserved chars */ ++ case '[': ++ case ']': ++ case '/': ++ case ':': ++ case '&': ++ case '+': ++ case '$': ++ *at = *p; ++ break; ++ default: ++ *at++ = '%'; ++ x = (*p) >> 4; ++ if (x < 10) ++ { ++ *at++ = x + '0'; ++ } else { ++ *at++ = x - 10 + 'a'; ++ } ++ x = (*p) & 0x0f; ++ if (x < 10) { ++ *at = x + '0'; ++ } else { ++ *at = x - 10 + 'a'; ++ } ++ } + } + at++; + p++; diff --git a/opensips-0036-Fix-init-of-the-cachedb-related-module-params.patch b/opensips-0036-Fix-init-of-the-cachedb-related-module-params.patch new file mode 100644 index 0000000..091d05b --- /dev/null +++ b/opensips-0036-Fix-init-of-the-cachedb-related-module-params.patch @@ -0,0 +1,34 @@ +From: Bogdan-Andrei Iancu +Date: Thu, 19 Oct 2017 19:00:29 +0300 +Subject: [PATCH] Fix init of the cachedb related module params + +Init val_prefix, noval_prefix and size_prefix before general cachedb init. +Credits go to @Tinet-AaronAn +Closes #1203 + +(cherry picked from commit ec8d6a982a93d96fec8683426d2107bda67de66f) + +diff --git a/modules/dialog/dialog.c b/modules/dialog/dialog.c +index 9e827343a..9dd32e5be 100644 +--- a/modules/dialog/dialog.c ++++ b/modules/dialog/dialog.c +@@ -782,15 +782,15 @@ static int mod_init(void) + + /* we are only interested in these parameters if the cachedb url was defined */ + if (cdb_url.s) { ++ cdb_val_prefix.len = strlen(cdb_val_prefix.s); ++ cdb_noval_prefix.len = strlen(cdb_noval_prefix.s); ++ cdb_size_prefix.len = strlen(cdb_size_prefix.s); + cdb_url.len = strlen(cdb_url.s); ++ + if (init_cachedb_utils() <0) { + LM_ERR("cannot init cachedb utils\n"); + return -1; + } +- +- cdb_val_prefix.len = strlen(cdb_val_prefix.s); +- cdb_noval_prefix.len = strlen(cdb_noval_prefix.s); +- cdb_size_prefix.len = strlen(cdb_size_prefix.s); + } + + /* allocate a slot in the processing context */ diff --git a/opensips-0037-db-do-not-compute-capabilities.patch b/opensips-0037-db-do-not-compute-capabilities.patch new file mode 100644 index 0000000..e6f0727 --- /dev/null +++ b/opensips-0037-db-do-not-compute-capabilities.patch @@ -0,0 +1,29 @@ +From: Razvan Crainea +Date: Tue, 24 Oct 2017 11:30:20 +0300 +Subject: [PATCH] db: do not compute capabilities + +Do not compute capabilities for modules that pre-populate them. This +fixes an issue where the db engine was overwriting the db capabilities +of db_virtual. + +Thanks go to Jonathan Hulme for reporting and providing testing +environment + +(cherry picked from commit 0527560978028de80a51343714429e5a3d923919) + +diff --git a/db/db.c b/db/db.c +index f658a0b13..a05406761 100644 +--- a/db/db.c ++++ b/db/db.c +@@ -244,7 +244,10 @@ int db_bind_mod(const str* mod, db_func_t* mydbf) + dbf.insert_update = (db_insert_update_f)find_mod_export(tmp, + "db_insert_update", 2, 0); + } +- if(db_check_api(&dbf, tmp)!=0) ++ /* check if the module pre-populated the capabilities, or we need to ++ * compute them ourselves - we check for the INSERT capability, because ++ * it's the only one that should be exported by all modules */ ++ if(!DB_CAPABILITY(dbf, DB_CAP_INSERT) && db_check_api(&dbf, tmp)!=0) + goto error; + + *mydbf=dbf; /* copy */ diff --git a/opensips-0038-db_virtual-provide-DELETE-capabilities-for-ROUND-mod.patch b/opensips-0038-db_virtual-provide-DELETE-capabilities-for-ROUND-mod.patch new file mode 100644 index 0000000..23c6220 --- /dev/null +++ b/opensips-0038-db_virtual-provide-DELETE-capabilities-for-ROUND-mod.patch @@ -0,0 +1,19 @@ +From: Razvan Crainea +Date: Tue, 24 Oct 2017 11:33:17 +0300 +Subject: [PATCH] db_virtual: provide DELETE capabilities for ROUND mode + +(cherry picked from commit 4c7cbb7e06183b318393977f993b0ff31508cd4c) + +diff --git a/modules/db_virtual/db_virtual.h b/modules/db_virtual/db_virtual.h +index 92ec5d911..92ceca01b 100644 +--- a/modules/db_virtual/db_virtual.h ++++ b/modules/db_virtual/db_virtual.h +@@ -52,7 +52,7 @@ DB_CAP_DELETE | DB_CAP_UPDATE | DB_CAP_REPLACE | DB_CAP_FETCH | \ + DB_CAP_LAST_INSERTED_ID | DB_CAP_INSERT_UPDATE | DB_CAP_ASYNC_RAW_QUERY) + + #define DB_CAP_ROUND (0 | DB_CAP_QUERY | DB_CAP_RAW_QUERY | DB_CAP_INSERT | \ +-DB_CAP_FETCH | \ ++DB_CAP_FETCH | DB_CAP_DELETE \ + DB_CAP_LAST_INSERTED_ID | DB_CAP_INSERT_UPDATE | DB_CAP_ASYNC_RAW_QUERY) + + enum DB_MODE {FAILOVER=0, PARALLEL, ROUND}; diff --git a/opensips-0039-db_virtual-fix-previous-commit.patch b/opensips-0039-db_virtual-fix-previous-commit.patch new file mode 100644 index 0000000..7af2c84 --- /dev/null +++ b/opensips-0039-db_virtual-fix-previous-commit.patch @@ -0,0 +1,19 @@ +From: Razvan Crainea +Date: Tue, 24 Oct 2017 11:38:14 +0300 +Subject: [PATCH] db_virtual: fix previous commit + +(cherry picked from commit f53a74f5a6d572d69fa7439a3762ca6c3faba751) + +diff --git a/modules/db_virtual/db_virtual.h b/modules/db_virtual/db_virtual.h +index 92ceca01b..08b2e004c 100644 +--- a/modules/db_virtual/db_virtual.h ++++ b/modules/db_virtual/db_virtual.h +@@ -52,7 +52,7 @@ DB_CAP_DELETE | DB_CAP_UPDATE | DB_CAP_REPLACE | DB_CAP_FETCH | \ + DB_CAP_LAST_INSERTED_ID | DB_CAP_INSERT_UPDATE | DB_CAP_ASYNC_RAW_QUERY) + + #define DB_CAP_ROUND (0 | DB_CAP_QUERY | DB_CAP_RAW_QUERY | DB_CAP_INSERT | \ +-DB_CAP_FETCH | DB_CAP_DELETE \ ++DB_CAP_FETCH | DB_CAP_DELETE | \ + DB_CAP_LAST_INSERTED_ID | DB_CAP_INSERT_UPDATE | DB_CAP_ASYNC_RAW_QUERY) + + enum DB_MODE {FAILOVER=0, PARALLEL, ROUND}; diff --git a/opensips-0040-Fix-creating-the-profiles-list-in-the-dlg_list_ctx-M.patch b/opensips-0040-Fix-creating-the-profiles-list-in-the-dlg_list_ctx-M.patch new file mode 100644 index 0000000..a203ad3 --- /dev/null +++ b/opensips-0040-Fix-creating-the-profiles-list-in-the-dlg_list_ctx-M.patch @@ -0,0 +1,22 @@ +From: Bogdan-Andrei Iancu +Date: Fri, 27 Oct 2017 18:57:11 +0300 +Subject: [PATCH] Fix creating the profiles list in the dlg_list_ctx MI command + +The profiles are not array, but list as they have different names for the nodes.Reported by Vladimir Dubov (@vovad) +Closes #1166 + +(cherry picked from commit 60d161d447ccf082aa1be7fbb2261c5548dcd3bf) + +diff --git a/modules/dialog/dlg_hash.c b/modules/dialog/dlg_hash.c +index 7938d4a5c..86d9f6af3 100644 +--- a/modules/dialog/dlg_hash.c ++++ b/modules/dialog/dlg_hash.c +@@ -1286,7 +1286,7 @@ static inline int internal_mi_print_dlg(struct mi_node *rpl, + } + /* print dlg profiles */ + if (dlg->profile_links) { +- node3 = add_mi_node_child(node1, MI_IS_ARRAY, "profiles", 8, 0, 0); ++ node3 = add_mi_node_child(node1, 0, "profiles", 8, 0, 0); + if(node3 == 0) + goto error; + for( dl=dlg->profile_links ; dl ; dl=dl->next) { diff --git a/opensips-0041-db_sqlite-let-the-DB-interface-determine-the-capabil.patch b/opensips-0041-db_sqlite-let-the-DB-interface-determine-the-capabil.patch new file mode 100644 index 0000000..ed04990 --- /dev/null +++ b/opensips-0041-db_sqlite-let-the-DB-interface-determine-the-capabil.patch @@ -0,0 +1,24 @@ +From: Razvan Crainea +Date: Thu, 9 Nov 2017 10:15:56 +0200 +Subject: [PATCH] db_sqlite: let the DB interface determine the capabilities + +This prevens the module from advertising bogus capabilities - in this +case the sqlite module was saying that it has the ASYNC RAW queries +support, although it didn't. + +Reported by Wilhelm Lundgren on list + +(cherry picked from commit b9ca13a643e4c21aeba1fa9d88c57a054a290f64) + +diff --git a/modules/db_sqlite/db_sqlite.c b/modules/db_sqlite/db_sqlite.c +index 73098a02e..7feb8edd9 100644 +--- a/modules/db_sqlite/db_sqlite.c ++++ b/modules/db_sqlite/db_sqlite.c +@@ -120,7 +120,6 @@ int db_sqlite_bind_api(const str* mod, db_func_t *dbb) + dbb->last_inserted_id = db_last_inserted_id; + dbb->insert_update = db_insert_update; + +- dbb->cap = DB_CAP_ALL ^ DB_CAP_ASYNC_RAW_QUERY; + return 0; + } + diff --git a/opensips-0042-rtpengine-do-not-use-replace-bson-for-delete.patch b/opensips-0042-rtpengine-do-not-use-replace-bson-for-delete.patch new file mode 100644 index 0000000..e5ecdca --- /dev/null +++ b/opensips-0042-rtpengine-do-not-use-replace-bson-for-delete.patch @@ -0,0 +1,48 @@ +From: Razvan Crainea +Date: Thu, 9 Nov 2017 10:23:54 +0200 +Subject: [PATCH] rtpengine: do not use replace bson for delete + +Prevent the module for using replace-* attributes for any other +operation than offer or answer. This allows you to use the +rtpengine_manage() function easier. + +Reported by Edwin Hoff + +(cherry picked from commit d67fbb9809427cc4087563bbbebf556420f1f330) + +diff --git a/modules/rtpengine/rtpengine.c b/modules/rtpengine/rtpengine.c +index 4d2ea81f5..de881e29d 100644 +--- a/modules/rtpengine/rtpengine.c ++++ b/modules/rtpengine/rtpengine.c +@@ -1149,9 +1149,12 @@ static int parse_flags(struct ng_flags_parse *ng_flags, struct sip_msg *msg, enu + break; + + case 14: +- if (str_eq(&key, "replace-origin")) +- bencode_list_add_string(ng_flags->replace, "origin"); +- else if (str_eq(&key, "address-family")) { ++ if (str_eq(&key, "replace-origin")) { ++ if (!ng_flags->replace) ++ LM_DBG("%.*s not supported for %d op\n", key.len, key.s, *op); ++ else ++ bencode_list_add_string(ng_flags->replace, "origin"); ++ } else if (str_eq(&key, "address-family")) { + err = "missing value"; + if (!val.s) + goto error; +@@ -1193,9 +1196,12 @@ static int parse_flags(struct ng_flags_parse *ng_flags, struct sip_msg *msg, enu + break; + + case 26: +- if (str_eq(&key, "replace-session-connection")) +- bencode_list_add_string(ng_flags->replace, "session-connection"); +- else ++ if (str_eq(&key, "replace-session-connection")) { ++ if (!ng_flags->replace) ++ LM_DBG("%.*s not supported for %d op\n", key.len, key.s, *op); ++ else ++ bencode_list_add_string(ng_flags->replace, "session-connection"); ++ } else + goto error; + break; + diff --git a/opensips-0043-usrloc-Fix-locking-for-contact_id-based-deletion.patch b/opensips-0043-usrloc-Fix-locking-for-contact_id-based-deletion.patch new file mode 100644 index 0000000..52e3515 --- /dev/null +++ b/opensips-0043-usrloc-Fix-locking-for-contact_id-based-deletion.patch @@ -0,0 +1,58 @@ +From: Liviu Chircu +Date: Thu, 26 Oct 2017 12:16:33 +0300 +Subject: [PATCH] usrloc: Fix locking for contact_id-based deletion + +The delete_ucontact_from_id(), get_ucontact_from_id() pair of functions +were masking possible code execution paths which would lead to unsafe memory +access. This, in turn, would cause the ping_checker_timer() job of nathelper to +occasionally crash and burn. + +Reported by solo@astercc.org. + +(cherry picked from commit 18a93c89aa1c32498689a6f6dd09911272c18896) + +diff --git a/modules/usrloc/dlist.c b/modules/usrloc/dlist.c +index c46f05d9d..6e0bbf58c 100644 +--- a/modules/usrloc/dlist.c ++++ b/modules/usrloc/dlist.c +@@ -823,6 +823,10 @@ int find_domain(str* _d, udomain_t** _p) + + /* + * retrieve the ucontact from a domain using the contact id ++ * ++ * Returns: ++ * NULL, if contact not found ++ * contact, *with grabbed ulslot lock* + */ + ucontact_t* get_ucontact_from_id(udomain_t *d, uint64_t contact_id, urecord_t **_r) + { +@@ -865,7 +869,6 @@ ucontact_t* get_ucontact_from_id(udomain_t *d, uint64_t contact_id, urecord_t ** + for (c = r->contacts; c != NULL; c = c->next) + if ((unsigned short)c->label == clabel) { + *_r = r; +- unlock_ulslot(d, sl); + return c; + } + } +@@ -878,7 +881,8 @@ int delete_ucontact_from_id(udomain_t *d, uint64_t contact_id, char is_replicate + { + ucontact_t *c, virt_c; + urecord_t *r; +- ++ unsigned int sl, rlabel; ++ unsigned short aorhash, clabel; + + /* if contact only in database */ + if (db_mode == DB_ONLY) { +@@ -916,6 +920,11 @@ int delete_ucontact_from_id(udomain_t *d, uint64_t contact_id, char is_replicate + mem_delete_ucontact(r, c); + } + ++ unpack_indexes(contact_id, &aorhash, &rlabel, &clabel); ++ ++ sl = aorhash & (d->size - 1); ++ unlock_ulslot(d, sl); ++ + return 0; + } + diff --git a/opensips-0044-usrloc-Fix-bad-logical-condition.patch b/opensips-0044-usrloc-Fix-bad-logical-condition.patch new file mode 100644 index 0000000..be3d585 --- /dev/null +++ b/opensips-0044-usrloc-Fix-bad-logical-condition.patch @@ -0,0 +1,24 @@ +From: Liviu Chircu +Date: Thu, 16 Nov 2017 12:06:01 +0200 +Subject: [PATCH] usrloc: Fix bad logical condition +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Reported by Răzvan Crainea. + +(cherry picked from commit a644f1b370d61e60b2f4de20c9728564d8d8a06d) + +diff --git a/modules/usrloc/urecord.c b/modules/usrloc/urecord.c +index f14e43443..6e1b7ef26 100644 +--- a/modules/usrloc/urecord.c ++++ b/modules/usrloc/urecord.c +@@ -324,7 +324,7 @@ static inline int wb_timer(urecord_t* _r,query_list_t **ins_list) + ptr = ptr->next; + + /* Should we remove the contact from the database ? */ +- if (st_expired_ucontact(t) == 1 && (!(t->flags)&FL_MEM)) { ++ if (st_expired_ucontact(t) == 1 && !(t->flags & FL_MEM)) { + VAL_BIGINT(cid_vals+cid_len) = t->contact_id; + if ((++cid_len) == max_contact_delete) { + if (db_multiple_ucontact_delete(_r->domain, cid_keys, diff --git a/opensips-0045-Don-t-include-mysql-mysql_version.h-directly.patch b/opensips-0045-Don-t-include-mysql-mysql_version.h-directly.patch new file mode 100644 index 0000000..ea12fbc --- /dev/null +++ b/opensips-0045-Don-t-include-mysql-mysql_version.h-directly.patch @@ -0,0 +1,31 @@ +From: Peter Lemenkov +Date: Tue, 21 Nov 2017 14:53:03 +0300 +Subject: [PATCH] Don't include directly + +Signed-off-by: Peter Lemenkov + +diff --git a/modules/db_mysql/dbase.c b/modules/db_mysql/dbase.c +index 002f79405..722b00d3f 100644 +--- a/modules/db_mysql/dbase.c ++++ b/modules/db_mysql/dbase.c +@@ -35,7 +35,6 @@ + #include + #include + #include +-#include + #include "../../mem/mem.h" + #include "../../dprint.h" + #include "../../db/db_query.h" +diff --git a/modules/db_mysql/my_con.c b/modules/db_mysql/my_con.c +index cc7109be1..87fd0c53c 100644 +--- a/modules/db_mysql/my_con.c ++++ b/modules/db_mysql/my_con.c +@@ -22,7 +22,7 @@ + #include "my_con.h" + #include "db_mysql.h" + #include "dbase.h" +-#include ++#include + #include "../../mem/mem.h" + #include "../../dprint.h" + #include "../../ut.h" diff --git a/opensips.spec b/opensips.spec index 41aaf76..3f26829 100644 --- a/opensips.spec +++ b/opensips.spec @@ -5,7 +5,7 @@ Summary: Open Source SIP Server Name: opensips Version: 2.2.5 -Release: 1%{?dist} +Release: 2%{?dist} License: GPLv2+ Group: System Environment/Daemons Source0: https://github.com/%{name}/%{name}/archive/%{version}/%{name}-%{version}.tar.gz @@ -20,29 +20,43 @@ Patch7: opensips-0007-Don-t-remove-pthread-library-explicitly-from-mi_xmlr.pat Patch8: opensips-0008-Dont-try-modifying-CFLAGS.patch # Backported from master branch -Patch9: opensips-0009-Add-support-for-openssl-1.1.0.patch -Patch10: opensips-0010-identity-add-support-for-openssl-1.1.0.patch -Patch11: opensips-0011-identity-complete-port-to-openssl-1.1.0.patch -Patch12: opensips-0012-Finalize-OpenSSL-1.1.0-migration.patch -Patch13: opensips-0013-Fix-milliseconds-for-call-duration-consistency-acros.patch -Patch14: opensips-0014-acc-restore-new_uri-in-case-an-error-occurs-on-reply.patch -Patch15: opensips-0015-drouting-fix-parameters-specifications-for-gw-detect.patch -Patch16: opensips-0016-Fix-incorrect-bug-log.patch -Patch17: opensips-0017-Fix-replicating-NULL-socket-in-contact.patch -Patch18: opensips-0018-b2b_entities-fix-b2b-key-memory-leak.patch -Patch19: opensips-0019-Fixed-wrong-TLS-parameters.patch -Patch20: opensips-0020-db_mysql-fix-build-against-MariaDB-10.2.patch -Patch21: opensips-0021-event_xmlrpc-rebuild-buffer-for-each-event.patch -Patch22: opensips-0022-dialog-do-not-allow-callbacks-in-state-DELETED.patch -Patch23: opensips-0023-ratelimit-fix-buffer-overflow-when-using-SBT-algorit.patch -Patch24: opensips-0024-siptrace-fix-type-for-message-DB-column-value-str-in.patch -Patch25: opensips-0025-parse_fline-fix-implicit-cast-sign.patch -Patch26: opensips-0026-proto_wss-write-all-TLS-chunks-under-a-single-lock.patch -Patch27: opensips-0027-proto_wss-release-lock-even-if-write-fails.patch -Patch28: opensips-0028-Fix-bogus-error-message-probabaly-copy-paste-error.patch -Patch29: opensips-0029-siptrace-allow-capturing-on-any-port.patch -Patch30: opensips-0030-Merge-pull-request-1191-from-etamme-master.patch -Patch31: opensips-0031-Merge-pull-request-1195-from-etamme-master.patch +Patch9: opensips-0009-Add-support-for-openssl-1.1.0.patch +Patch10: opensips-0010-identity-add-support-for-openssl-1.1.0.patch +Patch11: opensips-0011-identity-complete-port-to-openssl-1.1.0.patch +Patch12: opensips-0012-Finalize-OpenSSL-1.1.0-migration.patch +Patch13: opensips-0013-Fix-milliseconds-for-call-duration-consistency-acros.patch +Patch14: opensips-0014-acc-restore-new_uri-in-case-an-error-occurs-on-reply.patch +Patch15: opensips-0015-drouting-fix-parameters-specifications-for-gw-detect.patch +Patch16: opensips-0016-Fix-incorrect-bug-log.patch +Patch17: opensips-0017-Fix-replicating-NULL-socket-in-contact.patch +Patch18: opensips-0018-b2b_entities-fix-b2b-key-memory-leak.patch +Patch19: opensips-0019-Fixed-wrong-TLS-parameters.patch +Patch20: opensips-0020-db_mysql-fix-build-against-MariaDB-10.2.patch +Patch21: opensips-0021-event_xmlrpc-rebuild-buffer-for-each-event.patch +Patch22: opensips-0022-dialog-do-not-allow-callbacks-in-state-DELETED.patch +Patch23: opensips-0023-ratelimit-fix-buffer-overflow-when-using-SBT-algorit.patch +Patch24: opensips-0024-siptrace-fix-type-for-message-DB-column-value-str-in.patch +Patch25: opensips-0025-parse_fline-fix-implicit-cast-sign.patch +Patch26: opensips-0026-proto_wss-write-all-TLS-chunks-under-a-single-lock.patch +Patch27: opensips-0027-proto_wss-release-lock-even-if-write-fails.patch +Patch28: opensips-0028-Fix-bogus-error-message-probabaly-copy-paste-error.patch +Patch29: opensips-0029-siptrace-allow-capturing-on-any-port.patch +Patch30: opensips-0030-Merge-pull-request-1191-from-etamme-master.patch +Patch31: opensips-0031-Merge-pull-request-1195-from-etamme-master.patch +Patch32: opensips-0032-acc-fix-possbile-memory-leak-when-calling-do_account.patch +Patch33: opensips-0033-dialog-fix-a-runtime-bug-with-DLGCB_LOADED-callbacks.patch +Patch34: opensips-0034-dialog-also-share-module-flags-when-replicating-dial.patch +Patch35: opensips-0035-Fix-escaping-URI-parameters-skip-alphanumerical-char.patch +Patch36: opensips-0036-Fix-init-of-the-cachedb-related-module-params.patch +Patch37: opensips-0037-db-do-not-compute-capabilities.patch +Patch38: opensips-0038-db_virtual-provide-DELETE-capabilities-for-ROUND-mod.patch +Patch39: opensips-0039-db_virtual-fix-previous-commit.patch +Patch40: opensips-0040-Fix-creating-the-profiles-list-in-the-dlg_list_ctx-M.patch +Patch41: opensips-0041-db_sqlite-let-the-DB-interface-determine-the-capabil.patch +Patch42: opensips-0042-rtpengine-do-not-use-replace-bson-for-delete.patch +Patch43: opensips-0043-usrloc-Fix-locking-for-contact_id-based-deletion.patch +Patch44: opensips-0044-usrloc-Fix-bad-logical-condition.patch +Patch45: opensips-0045-Don-t-include-mysql-mysql_version.h-directly.patch URL: https://opensips.org @@ -1355,6 +1369,10 @@ useradd -r -g %{name} -d %{_localstatedir}/run/%{name} -s /sbin/nologin \ %doc docdir/README.xmpp %changelog +* Tue Nov 21 2017 Peter Lemenkov - 2.2.5-2 +- Backport few more patches +- Fix building with MariaDB in F-27 + * Wed Oct 04 2017 Peter Lemenkov - 2.2.5-1 - Ver. 2.2.5