diff --git a/ChangeLog b/ChangeLog index 558c76e91..3f96073b2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,340 @@ +===================== 2013-08-15 Version 4.0.3 Released ===================== + +===================== Changes Since Version 4.0.2 =========================== + +commit a75a8a140e53ef8cee58d670b3954e7ac4cdb1b8 +Author: Daniel-Constantin Mierla +Date: Thu Aug 15 15:33:55 2013 +0200 + + Makefile.defs: version set to 4.0.3 + +commit c67ac0b5ef5183947acf02d496eb5899dad0ba9b +Author: Daniel-Constantin Mierla +Date: Sun Jun 16 17:17:36 2013 +0200 + + topoh: safety check for To header + + - protection for the case when sanity module checks are not enabled + - reported in FS#303 by Michel de Weerd + + (cherry picked from commit 4f3d04d547c66a1b59398cf80e93974175141514) + +commit 2ffedf0e6bd3d9231988fbb70153bd6d72ae63ab +Author: Daniel-Constantin Mierla +Date: Thu Jul 4 11:48:26 2013 +0200 + + tm: avoid double execution of response-in callbacks + + - double execution of response-in callbacks could happen when using tm + pvs inside core reply route, being done in transaction matching + function, which is executed again by tm reply received function + + (cherry picked from commit d4cef7f5e49105c65df9651a1ad086b035f8ffdb) + +commit 9e231ae7f6a80abf686448e1593195b9012c2e8c +Author: Daniel-Constantin Mierla +Date: Thu Jul 4 11:47:18 2013 +0200 + + core: new internam sip msg flag FL_TM_RPL_MATCHED + + - mark sip reply when matched first time by tm + - used to avoid double execution of response-in callbacks + + (cherry picked from commit 230a138991b25f7f9b07b4f9cbeffbdd6acef2e8) + +commit 58322807c275ce07be6a339dd5db2416f1905470 +Author: Daniel-Constantin Mierla +Date: Sat Jul 20 10:01:25 2013 +0200 + + Makefile: sercmd renamed to kamcmd in uninstall option + + (cherry picked from commit ab601ea9a1b2561c2eaa860583cdeed478b9ea8d) + +commit 17f2611e668af139399c21677d3503c0c5a6a860 +Author: Daniel-Constantin Mierla +Date: Sun Aug 4 14:22:41 2013 +0200 + + imc: wrap bit shift defines in parenthesis + + - avoid priority conflicts when using the defines + - reported by Shankar + + (cherry picked from commit e6e0419a46c3e5127d07c95390931d10b2a01c3b) + +commit 75e20d79763094fccaacddf127699ce9f22e973a +Author: Daniel-Constantin Mierla +Date: Thu Aug 15 10:38:26 2013 +0200 + + pkg/rpm: version set to 4.0.3 in spec files + +commit 701b5faef517a65208907e771d2c3b7b015afb19 +Author: Daniel-Constantin Mierla +Date: Thu Aug 15 10:37:15 2013 +0200 + + pkg/deb: version set to 4.0.3 in spec files + +commit 3898507f56eefe5c9d8e72b37280e0d133f6e357 +Author: Daniel-Constantin Mierla +Date: Tue Aug 13 09:37:21 2013 +0200 + + usrloc: safety checks to catch empty ruid + + (cherry picked from commit b0e9132ccd1e8385b8b4faf72db806320d48e2f5) + +commit e59bb3303252c0b47f6027ae2b99a11096521154 +Author: Daniel-Constantin Mierla +Date: Tue Aug 13 09:19:02 2013 +0200 + + usrloc: more verbose log messages in case of failure to update db records + + (cherry picked from commit 66c8e730d59f9816f09573f5300e4463e5997876) + +commit d3be7fa1c47d12a1eb6e725729c6a0a2e481bc63 +Author: Hugh Waite +Date: Mon Aug 12 11:05:55 2013 +0100 + + rls: Fix memory leak in rls notify.c + + - xml is leaked in an error case + +commit a72a01a1cac4bd17e0aa91912ab158e73908d561 +Author: Hugh Waite +Date: Mon Aug 12 11:15:55 2013 +0100 + + presence: Iterate correctly around presence updates + + - timer_send_notify should increment the subset by one on each loop + +commit 6abd4b4d1eeea2c57a8bcfb071fadaca21efc20f +Author: Hugh Waite +Date: Tue Jul 16 10:51:29 2013 +0100 + + outbound: Fix freeing null pointer in destroy function + + - Only appears in error cases, e.g. syntax check + (cherry picked from commit e88af0a02de79fac583c126f08d762f7ef3f1b01) + +commit d2f62dd1855faef35bea8eff932d250557868ae5 +Author: Daniel-Constantin Mierla +Date: Thu Aug 1 15:58:59 2013 +0200 + + db_flatstore: free id pointer if no more space for table name + + - related to previus commit on this module + - keep table name null terminated + + (cherry picked from commit 6a981d3d922c914054d4c8dc7e672bb6a4ddb5f5) + +commit c50d559b4da94238a430c059dd02d74e63dd96fe +Author: Federico Cabiddu +Date: Mon Jul 29 07:59:34 2013 +0200 + + db_flatstore: fixup for new_flat_id function + + - locally copy table's name + + (cherry picked from commit 8fb0f711aaa611eac8b2776c7e5ae3c5e19243ac) + +commit 76b82480f74006d830afc9c9ae81ada25dbc7730 +Author: Daniel-Constantin Mierla +Date: Fri Jul 26 14:52:21 2013 +0200 + + uac_redirect: fixup for using acc table parameter + + - set reason parameter for acc function + - based on a patch by Federico Cabiddu, FS#327 + + (cherry picked from commit 3d33733f299dda595704108aef73a2912dc3069f) + +commit ece14d42fda4baefc4f0e8465faad17b678a6a4b +Author: Federico Cabiddu +Date: Mon Jul 29 07:59:13 2013 +0200 + + acc: acc_db_set_table_name fixup + + - add termination char to db_table_name_buf + + (cherry picked from commit 7ba6cbfcaf70cb546ea3a9f148a0f0b0bc38c16d) + +commit ea266beb3d678b36efeb82feeba6087df90d9f19 +Author: Daniel-Constantin Mierla +Date: Fri Jul 26 14:55:38 2013 +0200 + + acc: safety check for accounted values not to be NULL + + - based on a patch by Federico Cabiddu, FS#327 + + (cherry picked from commit fb3a5f7022ebd20fc516b5b8303a0274bda18258) + +commit 9f0a42dd31d765541c02d2b818dd52643589f59d +Author: Daniel-Constantin Mierla +Date: Tue Jul 2 23:32:37 2013 +0200 + + dialog: detect if no trasaction is created after config execution for new dialogs + + - release the dialog to avoid endless storage in state 1 + + (cherry picked from commit fa0339b1906690f009786fc9ed92c73a8c9e6520) + +commit 369164c689950595b7e35c36a810ecd41aaa7a0a +Author: Daniel-Constantin Mierla +Date: Mon Jul 1 15:22:33 2013 +0200 + + dialog: increment cseq in early stage for PRACK and UPDATE + + - rework from a patch by Halina Nowak + + (cherry picked from commit 6cf3ab0ca6f38d1d2e60dbc644bb4d2fb563919a) + +commit 91f64af86eebde4a179a4d9cb6837994a587a967 +Author: Daniel-Constantin Mierla +Date: Mon Jul 1 14:51:03 2013 +0200 + + dialog: avoid realloc of memory for cseq when setting leg info + + - free already allocated structs when needed + - has part of a patch by Halina Nowak + + (cherry picked from commit 71d7dc6bc750406d510e0571e05da3966911cfea) + +commit 573096ad14c34364dad160bffd7e7ed5d007f5f6 +Author: Daniel-Constantin Mierla +Date: Mon Jul 1 14:44:45 2013 +0200 + + dialog: fixed callee cseq reference + + - part of patch by Halina Nowak + + (cherry picked from commit ed6dbb0ca11206049bee9ab515ce071eb70e7b63) + +commit 3935fedf23f3bf2b6675182193cef6af3bbd903a +Author: Daniel-Constantin Mierla +Date: Wed Jul 31 12:22:12 2013 +0200 + + app_perl: push the sip msg structure to perl after initializing it + + - reported by David Cunningham + + (cherry picked from commit 341f810dca0cc0596e22f2ac1bca86de0b8d142d) + +commit 3438215263f20f63f0e69121113999f952334886 +Author: Camille Oudot +Date: Tue Jul 23 11:11:01 2013 +0200 + + modules/ims_registrar_scscf: safety check in async_cdp_callback + + (cherry-picked from commit 1aea13af9b3eea3788e90411bd94cb9e0b0c4ea3) + +commit 4471593e5f6e292d205bd84fb5912088bde32870 +Author: Daniel-Constantin Mierla +Date: Thu Jul 25 10:14:55 2013 +0200 + + app_perl: move initialization of SIP message var after initialization of temporary environment + + - upon a report by David Cunningham of a leak in operating system + memory + + (cherry picked from commit 6ff74701652a11497bd82ee3ba2ac7547d1ce666) + +commit 86864275e240be94d901fe21dde2472701e1669e +Author: Daniel-Constantin Mierla +Date: Wed Jul 17 20:19:28 2013 +0200 + + uac: restrict check of multiple from/to header changes to request route blocks + + - it can occur many times in due to branch route usage + - reported by Andrew Pogrebennyk, FS#323 + + (cherry picked from commit d3a0a8b15af59846fdaee5d9ceae61484f1d7301) + +commit b7e890b309331a13eb92c5080d276036be5833ae +Author: Daniel-Constantin Mierla +Date: Wed Jul 17 00:04:06 2013 +0200 + + presence_dialoginfo: add schema to entity + + - patch by Pawel Sternal, FS#324 + + (cherry picked from commit 716ffd2787a68734a21a1374c3dc6dd4783844bd) + +commit b87040d6839985ceb107e4a097df71afd8c69fa5 +Author: Daniel-Constantin Mierla +Date: Tue Jul 16 21:43:42 2013 +0200 + + usrloc: fixed type for db_ops_parameter + + - reported by Alex Hermann + +commit fb9a6ff96355093baa59c4f0c5c8505cb7d29311 +Author: Juha Heinanen +Date: Sat Apr 27 18:07:21 2013 +0300 + + modules/usrloc: fixed typo in db_ops_ruid param name + + (cherry picked from commit edebc03f65445f968accb58b5a761817aaee55e8) + +commit f8826df994a6baac9cfee219abafa3e1b82ee4f8 +Author: Daniel-Constantin Mierla +Date: Fri Jul 12 00:44:51 2013 +0200 + + core: avoid doing dns srv again after naptr function that includes srv lookup + + (cherry picked from commit 80935f9e8bbe20e5c320828183999b5d395ec34c) + +commit d821224ff33e7f7c43c6598482ab0870f728e763 +Author: Victor Seva +Date: Sat Jul 6 20:22:41 2013 +0200 + + modules/nathelper: remove natping_proceses limit + (cherry picked from commit edb00b0566595b509a7cdf9a1c7455ce6ee6c4c8) + +commit 3612981970e8002b3ab7f7d0324354e282205e2b +Author: Daniel-Constantin Mierla +Date: Thu Jul 11 14:36:02 2013 +0200 + + pipelimit: avoid double locking when changing pipe via rpc + + (cherry picked from commit 0c6fef5fdc2a586ebfa607d3b5344266c08ca996) + +commit 5e11ebf34bd525f02c7ff08b9520382c3aaf00f2 +Author: Daniel-Constantin Mierla +Date: Thu Jul 11 14:32:48 2013 +0200 + + pipelimit: avoid double locking when changing pipe via mi + + - reported by Krischan Udelhoven, FS#315 + + (cherry picked from commit 04fd56dc1b84b70a04438ccbf719eb85177524ad) + +commit d8c3a23ad2a5c925b16d75f33fcb865f09d7f308 +Author: Daniel-Constantin Mierla +Date: Wed Jul 3 23:29:29 2013 +0200 + + uac_redirect: adapted previous backport to append_branch() prototype for v4.0 + +commit 0227f5b61e1ea03e92a7fec9b177f602481fac84 +Author: Daniel-Constantin Mierla +Date: Wed Jul 3 23:23:40 2013 +0200 + + uac_redirect: fetch all contact headers in redirect replies + + - only first header was considered for redirect handling + - based on a report by Geoffrey Mina + - generate fake ruid (used as instance and user-agent) to satisfy the + requirements of t_load_contacts()/t_next_contacts() + + (cherry picked from commit c5081ad634742d88e56e4fcc097b756098119e4e) + +commit c4b51e9f51b4b2c4e908b4c4dc33b824021f1ca1 +Author: Daniel-Constantin Mierla +Date: Mon Jun 17 11:00:29 2013 +0200 + + pipelimit: fixed typo in module parameter name + + - patch by Krischan Udelhoven + + (cherry picked from commit c5573dddc4c11898fb68365e9a311aff0f1690c8) + ===================== 2013-06-12 Version 4.0.2 Released ===================== ===================== Changes Since Version 4.0.1 =========================== diff --git a/Makefile b/Makefile index cbe47001b..5351a3846 100644 --- a/Makefile +++ b/Makefile @@ -1058,7 +1058,7 @@ uninstall: echo "rm ${bin_prefix}/${bin_dir}kamctl" ; \ echo "rm ${bin_prefix}/${bin_dir}kamdbctl" ; \ fi ; \ - echo "rm ${bin_prefix}/${bin_dir}sercmd" ; \ + echo "rm ${bin_prefix}/${bin_dir}kamcmd" ; \ echo "rm ${man_prefix}/${man_dir}man5/$(MAIN_NAME).cfg.5" ; \ echo "rm ${man_prefix}/${man_dir}man8/$(MAIN_NAME).8" ; \ if [ "${FLAVOUR}" = "kamailio" ] ; then \ diff --git a/Makefile.defs b/Makefile.defs index fd28c1500..15f42ae67 100644 --- a/Makefile.defs +++ b/Makefile.defs @@ -162,7 +162,7 @@ INSTALL_FLAVOUR=$(FLAVOUR) #version number VERSION = 4 PATCHLEVEL = 0 -SUBLEVEL = 2 +SUBLEVEL = 3 EXTRAVERSION = # memory manager switcher diff --git a/autover.h b/autover.h index e038a19a1..33e7813a3 100644 --- a/autover.h +++ b/autover.h @@ -2,6 +2,6 @@ * DO NOT EDIT IT */ -#define REPO_VER "fc967b" -#define REPO_HASH "fc967b" +#define REPO_VER "090035" +#define REPO_HASH "090035" #define REPO_STATE "" diff --git a/modules/acc/acc.c b/modules/acc/acc.c index d4fd89c27..0a563d6e9 100644 --- a/modules/acc/acc.c +++ b/modules/acc/acc.c @@ -241,13 +241,15 @@ int acc_log_request( struct sip_msg *rq) memcpy(p, log_attrs[i].s, log_attrs[i].len); p += log_attrs[i].len; *(p++) = A_EQ_CHR; - memcpy(p, val_arr[i].s, val_arr[i].len); - p += val_arr[i].len; + if (val_arr[i].s != NULL) { + memcpy(p, val_arr[i].s, val_arr[i].len); + p += val_arr[i].len; + } } /* get per leg attributes */ if ( leg_info ) { - n = legs2strar(leg_info,rq,val_arr+m,int_arr+m,type_arr+m, 1); + n = legs2strar(leg_info,rq,val_arr+m,int_arr+m,type_arr+m, 1); do { for (i=m; i= log_msg_end) { @@ -259,10 +261,12 @@ int acc_log_request( struct sip_msg *rq) memcpy(p, log_attrs[i].s, log_attrs[i].len); p += log_attrs[i].len; *(p++) = A_EQ_CHR; - memcpy(p, val_arr[i].s, val_arr[i].len); - p += val_arr[i].len; + if (val_arr[i].s != NULL) { + memcpy(p, val_arr[i].s, val_arr[i].len); + p += val_arr[i].len; + } } - }while (p!=log_msg_end && (n=legs2strar(leg_info,rq,val_arr+m, + } while (p!=log_msg_end && (n=legs2strar(leg_info,rq,val_arr+m, int_arr+m,type_arr+m, 0))!=0); } diff --git a/modules/acc/acc_logic.c b/modules/acc/acc_logic.c index f2efaa75f..c9bdd20cc 100644 --- a/modules/acc/acc_logic.c +++ b/modules/acc/acc_logic.c @@ -197,6 +197,8 @@ int acc_db_set_table_name(struct sip_msg *msg, void *param, str *table) return -1; } strncpy(db_table_name_buf, dbtable.s, dbtable.len); + /* FS#327: since the buffer is static terminate the table name */ + db_table_name_buf[dbtable.len] = '\0'; env_set_text(db_table_name_buf, dbtable.len); } else { if(table==NULL) { @@ -220,7 +222,7 @@ int w_acc_db_request(struct sip_msg *rq, char *comment, char *table) if(acc_db_set_table_name(rq, (void*)table, NULL)<0) { LM_ERR("cannot set table name\n"); return -1; - } + } env_set_to( rq->to ); env_set_comment((struct acc_param*)comment); return acc_db_request(rq); diff --git a/modules/app_perl/perlfunc.c b/modules/app_perl/perlfunc.c index 96f7596db..06d331498 100644 --- a/modules/app_perl/perlfunc.c +++ b/modules/app_perl/perlfunc.c @@ -127,14 +127,14 @@ int perl_exec2(struct sip_msg* _msg, char* fnc, char* mystr) { return -1; } + ENTER; /* everything created after here */ + SAVETMPS; /* ...is a temporary variable. */ + PUSHMARK(SP); /* remember the stack pointer */ + m = sv_newmortal(); sv_setref_pv(m, "Kamailio::Message", (void *)_msg); SvREADONLY_on(SvRV(m)); - - ENTER; /* everything created after here */ - SAVETMPS; /* ...is a temporary variable. */ - PUSHMARK(SP); /* remember the stack pointer */ XPUSHs(m); /* Our reference to the stack... */ if (mystr) diff --git a/modules/db_flatstore/km_flat_id.c b/modules/db_flatstore/km_flat_id.c index 329452834..99f5a8b52 100644 --- a/modules/db_flatstore/km_flat_id.c +++ b/modules/db_flatstore/km_flat_id.c @@ -35,6 +35,8 @@ struct flat_id* new_flat_id(char* dir, char* table) { struct flat_id* ptr; + char* t; + int t_len; if (!dir || !table) { LM_ERR("invalid parameter(s)\n"); @@ -48,10 +50,22 @@ struct flat_id* new_flat_id(char* dir, char* table) } memset(ptr, 0, sizeof(struct flat_id)); + /* alloc memory for the table name */ + t_len = strlen(table); + t = (char*)pkg_malloc(t_len+1); + if (!t) { + LM_ERR("no pkg memory left\n"); + pkg_free(ptr); + return 0; + } + memset(t, 0, t_len); + ptr->dir.s = dir; ptr->dir.len = strlen(dir); - ptr->table.s = table; - ptr->table.len = strlen(table); + memcpy(t, table, t_len); + t[t_len] = '\0'; + ptr->table.s = t; + ptr->table.len = t_len; return ptr; } @@ -78,5 +92,7 @@ unsigned char cmp_flat_id(struct flat_id* id1, struct flat_id* id2) void free_flat_id(struct flat_id* id) { if (!id) return; + if (id->table.s) + pkg_free(id->table.s); pkg_free(id); } diff --git a/modules/dialog/dlg_handlers.c b/modules/dialog/dlg_handlers.c index f98f36bd3..9393d7f13 100644 --- a/modules/dialog/dlg_handlers.c +++ b/modules/dialog/dlg_handlers.c @@ -220,7 +220,7 @@ int populate_leg_info( struct dlg_cell *dlg, struct sip_msg *msg, cseq = (get_cseq(msg))->number; } else { /* use the same as in request */ - cseq = dlg->cseq[DLG_CALLER_LEG]; + cseq = dlg->cseq[DLG_CALLEE_LEG]; } /* extract the contact address */ @@ -721,11 +721,14 @@ void dlg_onreq(struct cell* t, int type, struct tmcb_params *param) if (dlg==NULL) { if((req->flags&dlg_flag)!=dlg_flag) return; + LM_DBG("dialog creation on config flag\n"); dlg_new_dialog(req, t, 1); dlg = dlg_get_ctx_dialog(); } if (dlg!=NULL) { + LM_DBG("dialog added to tm callbacks\n"); dlg_set_tm_callbacks(t, req, dlg, spiral_detected); + _dlg_ctx.t = 1; dlg_release(dlg); } } @@ -1249,21 +1252,28 @@ void dlg_onroute(struct sip_msg* req, str *route_params, void *param) } if ( (event==DLG_EVENT_REQ || event==DLG_EVENT_REQACK) - && new_state==DLG_STATE_CONFIRMED) { + && (new_state==DLG_STATE_CONFIRMED || new_state==DLG_STATE_EARLY)) { timeout = get_dlg_timeout(req); if (timeout!=default_timeout) { dlg->lifetime = timeout; } - if (update_dlg_timer( &dlg->tl, dlg->lifetime )==-1) { - LM_ERR("failed to update dialog lifetime\n"); + if (new_state!=DLG_STATE_EARLY) { + if (update_dlg_timer( &dlg->tl, dlg->lifetime )==-1) { + LM_ERR("failed to update dialog lifetime\n"); + } else { + dlg->dflags |= DLG_FLAG_CHANGED; + } } - if (update_cseqs(dlg, req, dir)!=0) { - LM_ERR("cseqs update failed\n"); - } else { - dlg->dflags |= DLG_FLAG_CHANGED; - if ( dlg_db_mode==DB_MODE_REALTIME ) - update_dialog_dbinfo(dlg); + if(event != DLG_EVENT_REQACK) { + if(update_cseqs(dlg, req, dir)!=0) { + LM_ERR("cseqs update failed\n"); + } else { + dlg->dflags |= DLG_FLAG_CHANGED; + } + } + if(dlg_db_mode==DB_MODE_REALTIME && (dlg->dflags&DLG_FLAG_CHANGED)) { + update_dialog_dbinfo(dlg); } if (old_state==DLG_STATE_CONFIRMED_NA) { @@ -1508,8 +1518,13 @@ int dlg_manage(sip_msg_t *msg) dlg = dlg_get_ctx_dialog(); if(dlg==NULL) return -1; - if(t!=NULL) + if(t!=NULL) { dlg_set_tm_callbacks(t, msg, dlg, spiral_detected); + _dlg_ctx.t = 1; + LM_DBG("dialog created on existing transaction\n"); + } else { + LM_DBG("dialog created before transaction\n"); + } dlg_release(dlg); } return 1; diff --git a/modules/dialog/dlg_hash.c b/modules/dialog/dlg_hash.c index c6692906f..bba619af1 100644 --- a/modules/dialog/dlg_hash.c +++ b/modules/dialog/dlg_hash.c @@ -485,8 +485,19 @@ int dlg_set_leg_info(struct dlg_cell *dlg, str* tag, str *rr, str *contact, { char *p; + if(dlg->tag[leg].s) + shm_free(dlg->tag[leg].s); dlg->tag[leg].s = (char*)shm_malloc( tag->len + rr->len + contact->len ); - dlg->cseq[leg].s = (char*)shm_malloc( cseq->len ); + + if(dlg->cseq[leg].s) { + if (dlg->cseq[leg].len < cseq->len) { + shm_free(dlg->cseq[leg].s); + dlg->cseq[leg].s = (char*)shm_malloc(cseq->len); + } + } else { + dlg->cseq[leg].s = (char*)shm_malloc( cseq->len ); + } + if ( dlg->tag[leg].s==NULL || dlg->cseq[leg].s==NULL) { LM_ERR("no more shm mem\n"); if (dlg->tag[leg].s) diff --git a/modules/dialog/dlg_var.c b/modules/dialog/dlg_var.c index 108af0fd1..0d8a1c7a4 100644 --- a/modules/dialog/dlg_var.c +++ b/modules/dialog/dlg_var.c @@ -22,6 +22,7 @@ */ #include "../../route.h" +#include "../../script_cb.h" #include "../../pvapi.h" #include "dlg_var.h" @@ -38,8 +39,19 @@ struct dlg_var * var_table = 0; /*! ID of the current message */ int msg_id; -int dlg_cfg_cb(struct sip_msg *foo, unsigned int flags, void *bar) +int dlg_cfg_cb(sip_msg_t *msg, unsigned int flags, void *cbp) { + dlg_cell_t *dlg; + if(flags&POST_SCRIPT_CB) { + dlg = dlg_get_ctx_dialog(); + if(dlg!=NULL) { + if(_dlg_ctx.t==0 && dlg->state==DLG_STATE_UNCONFIRMED) { + LM_DBG("new dialog with no trasaction after config execution\n"); + dlg_release(dlg); + } + dlg_release(dlg); + } + } memset(&_dlg_ctx, 0, sizeof(dlg_ctx_t)); return 1; diff --git a/modules/dialog/dlg_var.h b/modules/dialog/dlg_var.h index 9648ab263..ec2c9c7d8 100644 --- a/modules/dialog/dlg_var.h +++ b/modules/dialog/dlg_var.h @@ -41,6 +41,7 @@ typedef struct _dlg_ctx { dlg_iuid_t iuid; int set; unsigned int dir; + int t; } dlg_ctx_t; /* A dialog-variable */ diff --git a/modules/imc/imc_mng.h b/modules/imc/imc_mng.h index ead106fb6..f707343cd 100644 --- a/modules/imc/imc_mng.h +++ b/modules/imc/imc_mng.h @@ -37,11 +37,11 @@ #include "../../str.h" #include "../../parser/parse_from.h" -#define IMC_MEMBER_OWNER 1<<0 -#define IMC_MEMBER_ADMIN 1<<1 -#define IMC_MEMBER_INVITED 1<<2 -#define IMC_MEMBER_DELETED 1<<3 -#define IMC_MEMBER_SKIP 1<<4 +#define IMC_MEMBER_OWNER (1<<0) +#define IMC_MEMBER_ADMIN (1<<1) +#define IMC_MEMBER_INVITED (1<<2) +#define IMC_MEMBER_DELETED (1<<3) +#define IMC_MEMBER_SKIP (1<<4) typedef struct _imc_member { @@ -54,8 +54,8 @@ typedef struct _imc_member struct _imc_member * prev; } imc_member_t, *imc_member_p; -#define IMC_ROOM_PRIV 1<<0 -#define IMC_ROOM_DELETED 1<<1 +#define IMC_ROOM_PRIV (1<<0) +#define IMC_ROOM_DELETED (1<<1) typedef struct del_member { str room_name; diff --git a/modules/ims_auth/cxdx_mar.c b/modules/ims_auth/cxdx_mar.c index 2ec113b7e..7fea3830d 100644 --- a/modules/ims_auth/cxdx_mar.c +++ b/modules/ims_auth/cxdx_mar.c @@ -425,13 +425,14 @@ done: shm_free(avlist); avlist = 0; } - struct auth_data_item *tmp1 = adi_list->first; - while (tmp1) { - struct auth_data_item *tmp2 = tmp1->next; - shm_free(tmp1); - tmp1 = tmp2; - } + if (adi_list) { + struct auth_data_item *tmp1 = adi_list->first; + while (tmp1) { + struct auth_data_item *tmp2 = tmp1->next; + shm_free(tmp1); + tmp1 = tmp2; + } shm_free(adi_list); adi_list = 0; } diff --git a/modules/nathelper/nathelper.c b/modules/nathelper/nathelper.c index 48f8dfdcf..262b75821 100644 --- a/modules/nathelper/nathelper.c +++ b/modules/nathelper/nathelper.c @@ -669,9 +669,8 @@ mod_init(void) " set in usrloc module\n"); return -1; } - if (natping_processes>=8) { - LM_ERR("too many natping processes (%d) max=8\n", - natping_processes); + if (natping_processes<0) { + LM_ERR("bad config - natping_processes must be > 0\n"); return -1; } diff --git a/modules/outbound/ob_mod.c b/modules/outbound/ob_mod.c index 3d4d967ef..6318b16fb 100644 --- a/modules/outbound/ob_mod.c +++ b/modules/outbound/ob_mod.c @@ -112,7 +112,8 @@ static int mod_init(void) static void destroy(void) { - shm_free(ob_key.s); + if (ob_key.s) + shm_free(ob_key.s); } /* Structure of flow-token diff --git a/modules/pipelimit/pipelimit.c b/modules/pipelimit/pipelimit.c index b183e33b4..77d27969b 100644 --- a/modules/pipelimit/pipelimit.c +++ b/modules/pipelimit/pipelimit.c @@ -133,7 +133,7 @@ static param_export_t params[]={ {"reply_reason", STR_PARAM, &pl_drop_reason.s}, {"db_url", STR_PARAM, &pl_db_url}, {"plp_table_name", STR_PARAM, &rlp_table_name}, - {"plp_pipeid_colunm", STR_PARAM, &rlp_pipeid_col}, + {"plp_pipeid_column", STR_PARAM, &rlp_pipeid_col}, {"plp_limit_column", STR_PARAM, &rlp_limit_col}, {"plp_algorithm_column", STR_PARAM, &rlp_algorithm_col}, diff --git a/modules/pipelimit/pl_ht.c b/modules/pipelimit/pl_ht.c index 114646808..f044203e6 100644 --- a/modules/pipelimit/pl_ht.c +++ b/modules/pipelimit/pl_ht.c @@ -566,16 +566,15 @@ struct mi_root* mi_set_pipe(struct mi_root* cmd_tree, void* param) it->algo = algo_id; it->limit = limit; + pl_pipe_release(&pipeid); + if (check_feedback_setpoints(0)) { - pl_pipe_release(&pipeid); LM_ERR("feedback limits don't match\n"); goto error; } else { *_pl_pid_setpoint = 0.01 * (double)_pl_cfg_setpoint; } - pl_pipe_release(&pipeid); - return init_mi_tree( 200, MI_OK_S, MI_OK_LEN); error: return init_mi_tree( 400, MI_BAD_PARM_S, MI_BAD_PARM_LEN); @@ -676,16 +675,14 @@ void rpc_pl_set_pipe(rpc_t *rpc, void *c) it->algo = algo_id; it->limit = limit; + pl_pipe_release(&pipeid); if (check_feedback_setpoints(0)) { - pl_pipe_release(&pipeid); LM_ERR("feedback limits don't match\n"); rpc->fault(c, 400, "Feedback limits don't match"); return; } else { *_pl_pid_setpoint = 0.01 * (double)_pl_cfg_setpoint; } - - pl_pipe_release(&pipeid); } diff --git a/modules/presence/notify.c b/modules/presence/notify.c index d06fa6c82..0a7ffb26a 100644 --- a/modules/presence/notify.c +++ b/modules/presence/notify.c @@ -2667,9 +2667,6 @@ int process_dialogs(int round, int presence_winfo) int updated = 0; db_query_f query_fn = pa_dbf.query_lock ? pa_dbf.query_lock : pa_dbf.query; - if (++subset > (pres_waitn_time * pres_notifier_poll_rate) -1) - subset = 0; - query_cols[n_query_cols] = &str_updated_col; query_vals[n_query_cols].type = DB1_INT; query_vals[n_query_cols].nul = 0; @@ -3000,6 +2997,9 @@ void pres_timer_send_notify(unsigned int ticks, void *param) int round = subset + (pres_waitn_time * pres_notifier_poll_rate * process_num); + if (++subset > (pres_waitn_time * pres_notifier_poll_rate) -1) + subset = 0; + if (process_dialogs(round, 0) < 0) { LM_ERR("Handling non presence.winfo dialogs\n"); diff --git a/modules/presence_dialoginfo/notify_body.c b/modules/presence_dialoginfo/notify_body.c index 6a63d3eba..cc65efb91 100644 --- a/modules/presence_dialoginfo/notify_body.c +++ b/modules/presence_dialoginfo/notify_body.c @@ -147,14 +147,15 @@ str* agregate_xmls(str* pres_user, str* pres_domain, str** body_array, int n) /* LM_DBG("number of bodies in total [n]=%d, number of useful bodies [j]=%d\n", n, j ); */ /* create the new NOTIFY body */ - if ( (pres_user->len + pres_domain->len + 1) > MAX_URI_SIZE) { + if ( (pres_user->len + pres_domain->len + 1 + 4 + 1) >= MAX_URI_SIZE) { LM_ERR("entity URI too long, maximum=%d\n", MAX_URI_SIZE); return NULL; } - memcpy(buf, pres_user->s, pres_user->len); - buf[pres_user->len] = '@'; - memcpy(buf + pres_user->len + 1, pres_domain->s, pres_domain->len); - buf[pres_user->len + 1 + pres_domain->len]= '\0'; + memcpy(buf, "sip:", 4); + memcpy(buf+4, pres_user->s, pres_user->len); + buf[pres_user->len+4] = '@'; + memcpy(buf + pres_user->len + 5, pres_domain->s, pres_domain->len); + buf[pres_user->len + 5 + pres_domain->len]= '\0'; doc = xmlNewDoc(BAD_CAST "1.0"); if(doc==0) diff --git a/modules/rls/notify.c b/modules/rls/notify.c index 7b5bec357..6738f915d 100644 --- a/modules/rls/notify.c +++ b/modules/rls/notify.c @@ -1073,6 +1073,7 @@ int process_list_and_exec(xmlNodePtr list_node, str username, str domain, else { LM_ERR("unable to parse URI for \n"); + xmlFree(uri.s); return -1; } } diff --git a/modules/tm/t_lookup.c b/modules/tm/t_lookup.c index 86a45e464..fec6e8b25 100644 --- a/modules/tm/t_lookup.c +++ b/modules/tm/t_lookup.c @@ -1030,33 +1030,38 @@ int t_reply_matching( struct sip_msg *p_msg , int *p_branch ) REF_UNSAFE( T ); UNLOCK_HASH(hash_index); DBG("DEBUG: t_reply_matching: reply matched (T=%p)!\n",T); - /* if this is a 200 for INVITE, we will wish to store to-tags to be - * able to distinguish retransmissions later and not to call - * TMCB_RESPONSE_OUT uselessly; we do it only if callbacks are - * enabled -- except callback customers, nobody cares about - * retransmissions of multiple 200/INV or ACK/200s - */ - if (unlikely( is_invite(p_cell) && p_msg->REPLY_STATUS>=200 - && p_msg->REPLY_STATUS<300 - && ((!is_local(p_cell) && - has_tran_tmcbs(p_cell, - TMCB_RESPONSE_OUT|TMCB_RESPONSE_READY - |TMCB_E2EACK_IN|TMCB_E2EACK_RETR_IN) ) - || (is_local(p_cell)&&has_tran_tmcbs(p_cell, TMCB_LOCAL_COMPLETED)) - )) ) { - if (parse_headers(p_msg, HDR_TO_F, 0)==-1) { - LOG(L_ERR, "ERROR: t_reply_matching: to parsing failed\n"); + if(likely(!(p_msg->msg_flags&FL_TM_RPL_MATCHED))) { + /* if this is a 200 for INVITE, we will wish to store to-tags to be + * able to distinguish retransmissions later and not to call + * TMCB_RESPONSE_OUT uselessly; we do it only if callbacks are + * enabled -- except callback customers, nobody cares about + * retransmissions of multiple 200/INV or ACK/200s + */ + if (unlikely( is_invite(p_cell) && p_msg->REPLY_STATUS>=200 + && p_msg->REPLY_STATUS<300 + && ((!is_local(p_cell) && + has_tran_tmcbs(p_cell, + TMCB_RESPONSE_OUT|TMCB_RESPONSE_READY + |TMCB_E2EACK_IN|TMCB_E2EACK_RETR_IN) ) + || (is_local(p_cell)&&has_tran_tmcbs(p_cell, TMCB_LOCAL_COMPLETED)) + )) ) { + if (parse_headers(p_msg, HDR_TO_F, 0)==-1) { + LOG(L_ERR, "ERROR: t_reply_matching: to parsing failed\n"); + } } - } - if (unlikely(has_tran_tmcbs(T, TMCB_RESPONSE_IN | - TMCB_LOCAL_RESPONSE_IN))){ - if (!is_local(p_cell)) { - run_trans_callbacks( TMCB_RESPONSE_IN, T, T->uas.request, - p_msg, p_msg->REPLY_STATUS); - }else{ - run_trans_callbacks( TMCB_LOCAL_RESPONSE_IN, T, T->uas.request, - p_msg, p_msg->REPLY_STATUS); + if (unlikely(has_tran_tmcbs(T, TMCB_RESPONSE_IN | + TMCB_LOCAL_RESPONSE_IN))){ + if (!is_local(p_cell)) { + run_trans_callbacks( TMCB_RESPONSE_IN, T, T->uas.request, + p_msg, p_msg->REPLY_STATUS); + }else{ + run_trans_callbacks( TMCB_LOCAL_RESPONSE_IN, T, T->uas.request, + p_msg, p_msg->REPLY_STATUS); + } } + p_msg->msg_flags |= FL_TM_RPL_MATCHED; + } else { + DBG("reply in callbacks already done (T=%p)!\n", T); } return 1; } /* for cycle */ diff --git a/modules/topoh/topoh_mod.c b/modules/topoh/topoh_mod.c index 73ebf2165..e5e70587f 100644 --- a/modules/topoh/topoh_mod.c +++ b/modules/topoh/topoh_mod.c @@ -227,7 +227,13 @@ int th_prepare_msg(sip_msg_t *msg) LM_ERR("cannot parse FROM header\n"); return 3; } - + + if(get_to(msg)==NULL) + { + LM_ERR("cannot parse TO header\n"); + return 3; + } + return 0; } diff --git a/modules/uac/replace.c b/modules/uac/replace.c index 791d69b0f..7f1f92c97 100644 --- a/modules/uac/replace.c +++ b/modules/uac/replace.c @@ -39,6 +39,7 @@ #include "../../parser/parse_from.h" #include "../../mem/mem.h" #include "../../data_lump.h" +#include "../../route.h" #include "../../modules/tm/h_table.h" #include "../../modules/tm/tm_load.h" #include "../rr/api.h" @@ -251,10 +252,12 @@ int replace_uri( struct sip_msg *msg, str *display, str *uri, str * dlgvar_names; uac_flag = (hdr==msg->from)?FL_USE_UAC_FROM:FL_USE_UAC_TO; - if(msg->msg_flags & uac_flag) - { - LM_ERR("Called uac_replace multiple times on the message\n"); - return -1; + if(get_route_type()==REQUEST_ROUTE) { + if(msg->msg_flags & uac_flag) + { + LM_ERR("Called uac_replace multiple times on the message\n"); + return -1; + } } /* consistency check! in AUTO mode, do NOT allow URI changing diff --git a/modules/uac_redirect/Makefile b/modules/uac_redirect/Makefile index d8c2ae143..0b7e22dac 100644 --- a/modules/uac_redirect/Makefile +++ b/modules/uac_redirect/Makefile @@ -10,4 +10,6 @@ LIBS= DEFS+=-DKAMAILIO_MOD_INTERFACE +SERLIBPATH=../../lib +SER_LIBS+=$(SERLIBPATH)/srutils/srutils include ../../Makefile.modules diff --git a/modules/uac_redirect/rd_funcs.c b/modules/uac_redirect/rd_funcs.c index 2f85ed1b8..19b4dad7c 100644 --- a/modules/uac_redirect/rd_funcs.c +++ b/modules/uac_redirect/rd_funcs.c @@ -32,11 +32,14 @@ #include "../../dprint.h" #include "../../qvalue.h" #include "../../parser/contact/parse_contact.h" +#include "../../lib/srutils/sruid.h" #include "../../qvalue.h" #include "rd_filter.h" #include "rd_funcs.h" +extern sruid_t _redirect_sruid; + #define MAX_CONTACTS_PER_REPLY 16 #define DEFAULT_Q_VALUE 10 @@ -54,6 +57,7 @@ int get_redirect( struct sip_msg *msg , int maxt, int maxb, int n; int i; int first_branch; + char code_buf[INT2STR_MAX_LEN]; /* get transaction */ t = rd_tmb.t_gett(); @@ -92,6 +96,9 @@ int get_redirect( struct sip_msg *msg , int maxt, int maxb, } if (max==0) continue; + /* put the response code into the acc_param reason struct */ + reason->code = t->uac[i].last_received; + reason->code_s.s = int2bstr((unsigned long)reason->code, code_buf, &reason->code_s.len); /* get the contact from it */ n = shmcontact2dset( msg, t->uac[i].reply, max, reason, bflags); if ( n<0 ) { @@ -115,7 +122,7 @@ error: /* returns the number of contacts put in the sorted array */ -static int sort_contacts(contact_t *ct_list, contact_t **ct_array, +static int sort_contacts(hdr_field_t *chdr, contact_t **ct_array, qvalue_t *q_array) { param_t *q_para; @@ -123,48 +130,54 @@ static int sort_contacts(contact_t *ct_list, contact_t **ct_array, int n; int i,j; char backup; + contact_t *ct_list; + hdr_field_t *hdr; n = 0; /* number of sorted contacts */ - for( ; ct_list ; ct_list = ct_list->next ) { - /* check the filters first */ - backup = ct_list->uri.s[ct_list->uri.len]; - ct_list->uri.s[ct_list->uri.len] = 0; - if ( run_filters( ct_list->uri.s )==-1 ){ - ct_list->uri.s[ct_list->uri.len] = backup; - continue; - } - ct_list->uri.s[ct_list->uri.len] = backup; - /* does the contact has a q val? */ - q_para = ct_list->q; - if (q_para==0 || q_para->body.len==0) { - q = DEFAULT_Q_VALUE; - } else { - if (str2q( &q, q_para->body.s, q_para->body.len)!=0) { - LM_ERR("invalid q param\n"); - /* skip this contact */ + for(hdr=chdr; hdr; hdr=hdr->next) { + if(hdr->type != HDR_CONTACT_T) continue; + ct_list = ((contact_body_t*)hdr->parsed)->contacts; + for( ; ct_list ; ct_list = ct_list->next ) { + /* check the filters first */ + backup = ct_list->uri.s[ct_list->uri.len]; + ct_list->uri.s[ct_list->uri.len] = 0; + if ( run_filters( ct_list->uri.s )==-1 ){ + ct_list->uri.s[ct_list->uri.len] = backup; continue; } - } - LM_DBG("sort_contacts: <%.*s> q=%d\n", - ct_list->uri.len,ct_list->uri.s,q); - /*insert the contact into the sorted array */ - for(i=0;i=i ; j-- ) { - ct_array[j+1] = ct_array[j]; - q_array[j+1] = q_array[j]; + ct_list->uri.s[ct_list->uri.len] = backup; + /* does the contact has a q val? */ + q_para = ct_list->q; + if (q_para==0 || q_para->body.len==0) { + q = DEFAULT_Q_VALUE; + } else { + if (str2q( &q, q_para->body.s, q_para->body.len)!=0) { + LM_ERR("invalid q param\n"); + /* skip this contact */ + continue; + } + } + LM_DBG("sort_contacts: <%.*s> q=%d\n", + ct_list->uri.len,ct_list->uri.s,q); + /*insert the contact into the sorted array */ + for(i=0;i=i ; j-- ) { + ct_array[j+1] = ct_array[j]; + q_array[j+1] = q_array[j]; + } + ct_array[j+1] = ct_list; + q_array[j+1] = q; + if (n!=MAX_CONTACTS_PER_REPLY) + n++; } - ct_array[j+1] = ct_list; - q_array[j+1] = q; - if (n!=MAX_CONTACTS_PER_REPLY) - n++; } } return n; @@ -211,7 +224,7 @@ static int shmcontact2dset(struct sip_msg *req, struct sip_msg *sh_rpl, memcpy( &dup_rpl, sh_rpl, sizeof(struct sip_msg) ); dup = 2; /* ok -> force the parsing of contact header */ - if ( parse_headers( &dup_rpl, HDR_CONTACT_F, 0)<0 ) { + if ( parse_headers( &dup_rpl, HDR_EOH_F, 0)<0 ) { LM_ERR("dup_rpl parse failed\n"); ret = -1; goto restore; @@ -224,7 +237,7 @@ static int shmcontact2dset(struct sip_msg *req, struct sip_msg *sh_rpl, } else { dup = 3; /* force the parsing of contact header */ - if ( parse_headers( sh_rpl, HDR_CONTACT_F, 0)<0 ) { + if ( parse_headers( sh_rpl, HDR_EOH_F, 0)<0 ) { LM_ERR("sh_rpl parse failed\n"); ret = -1; goto restore; @@ -239,18 +252,23 @@ static int shmcontact2dset(struct sip_msg *req, struct sip_msg *sh_rpl, contact_hdr = sh_rpl->contact; } - /* parse the body of contact header */ - if (contact_hdr->parsed==0) { - if ( parse_contact(contact_hdr)<0 ) { - LM_ERR("contact hdr parse failed\n"); - ret = -1; - goto restore; + /* parse the body of contact headers */ + hdr = contact_hdr; + while(hdr) { + if (hdr->type == HDR_CONTACT_T) { + if (hdr->parsed==0) { + if(parse_contact(hdr) < 0) { + LM_ERR("failed to parse Contact body\n"); + ret = -1; + goto restore; + } + if (dup==0) + dup = 1; + } } - if (dup==0) - dup = 1; + hdr = hdr->next; } - /* we have the contact header and its body parsed -> sort the contacts * based on the q value */ contacts = ((contact_body_t*)contact_hdr->parsed)->contacts; @@ -258,7 +276,7 @@ static int shmcontact2dset(struct sip_msg *req, struct sip_msg *sh_rpl, LM_DBG("contact hdr has no contacts\n"); goto restore; } - n = sort_contacts( contacts, scontacts, sqvalues); + n = sort_contacts(contact_hdr, scontacts, sqvalues); if (n==0) { LM_DBG("no contacts left after filtering\n"); goto restore; @@ -274,17 +292,21 @@ static int shmcontact2dset(struct sip_msg *req, struct sip_msg *sh_rpl, for ( i=0 ; i\n", scontacts[i]->uri.len, scontacts[i]->uri.s); - if (km_append_branch( 0, &scontacts[i]->uri, 0, 0, sqvalues[i], - bflags, 0)<0) { - LM_ERR("failed to add contact to dset\n"); - } else { - added++; - if (rd_acc_fct!=0 && reason) { - /* log the redirect */ - req->new_uri = scontacts[i]->uri; - //FIXME - rd_acc_fct( req, (char*)reason, acc_db_table); + if(sruid_next(&_redirect_sruid)==0) { + if(append_branch( 0, &scontacts[i]->uri, 0, 0, sqvalues[i], + bflags, 0, &_redirect_sruid.uid, 0)<0) { + LM_ERR("failed to add contact to dset\n"); + } else { + added++; + if (rd_acc_fct!=0 && reason) { + /* log the redirect */ + req->new_uri = scontacts[i]->uri; + //FIXME + rd_acc_fct( req, (char*)reason, acc_db_table); + } } + } else { + LM_ERR("failed to generate ruid for a new branch\n"); } } diff --git a/modules/uac_redirect/redirect.c b/modules/uac_redirect/redirect.c index febd373f8..48dec8428 100644 --- a/modules/uac_redirect/redirect.c +++ b/modules/uac_redirect/redirect.c @@ -32,6 +32,7 @@ #include "../../str.h" #include "../../dprint.h" #include "../../mem/mem.h" +#include "../../lib/srutils/sruid.h" #include "../../modules/tm/tm_load.h" #include "rd_funcs.h" #include "rd_filter.h" @@ -56,9 +57,12 @@ unsigned int bflags = 0; #define ACCEPT_RULE_STR "accept" #define DENY_RULE_STR "deny" +/* sruid to get internal uid */ +sruid_t _redirect_sruid; static int redirect_init(void); +static int child_init(int rank); 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); @@ -103,7 +107,7 @@ struct module_exports exports = { redirect_init, /* Module initialization function */ 0, 0, - (child_init_function) 0 /* per-child init function */ + child_init /* per-child init function */ }; @@ -160,25 +164,24 @@ static int get_redirect_fixup(void** param, int param_no) pkg_free(*param); *param=(void*)(long)( (((unsigned short)maxt)<<8) | maxb); - } else if (param_no==2) { /* acc function loaded? */ - if (rd_acc_fct!=0) - return 0; - /* must import the acc stuff */ - 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 ) - fct = find_export(acc_fct_s, 1, REQUEST_ROUTE); - if ( fct==0 ) { - LM_ERR("cannot import %s function; is acc loaded and proper " - "compiled?\n", acc_fct_s); - return E_UNSPEC; + if (rd_acc_fct==0) { + /* must import the acc stuff */ + 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 ) + fct = find_export(acc_fct_s, 1, REQUEST_ROUTE); + 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; } - rd_acc_fct = fct; /* set the reason str */ accp = (struct acc_param*)pkg_malloc(sizeof(struct acc_param)); if (accp==0) { @@ -260,6 +263,7 @@ static int regexp_compile(char *re_s, regex_t **re) static int redirect_init(void) { regex_t *filter; + void *p; /* load the TM API */ if (load_tm_api(&rd_tmb)!=0) { @@ -267,6 +271,14 @@ static int redirect_init(void) goto error; } + p = (void*)acc_db_table; + /* fixup table name */ + if(fixup_var_pve_str_12(&p, 1)<0) { + LM_ERR("failed to fixup acc db table\n"); + goto error; + } + acc_db_table = p; + /* init filter */ init_filters(); @@ -295,11 +307,20 @@ static int redirect_init(void) } add_default_filter( DENY_FILTER, filter); + if(sruid_init(&_redirect_sruid, '-', "rdir", SRUID_INC)<0) + return -1; + return 0; error: return -1; } +static int child_init(int rank) +{ + if(sruid_init(&_redirect_sruid, '-', "rdir", SRUID_INC)<0) + return -1; + return 0; +} static inline void msg_tracer(struct sip_msg* msg, int reset) { diff --git a/modules/usrloc/README b/modules/usrloc/README index e861e23b8..2c1ffeff7 100644 --- a/modules/usrloc/README +++ b/modules/usrloc/README @@ -67,7 +67,7 @@ Bogdan-Andrei Iancu 3.29. db_check_update (string) 3.30. timer_procs (string) 3.31. xavp_contact (string) - 3.32. db_obs_ruid (string) + 3.32. db_ops_ruid (int) 4. Functions 5. MI Commands @@ -148,7 +148,7 @@ Bogdan-Andrei Iancu 1.29. Set db_check_update parameter 1.30. Set timer_procs parameter 1.31. Set xavp_contact parameter - 1.32. Set db_obs_ruid parameter + 1.32. Set db_ops_ruid parameter Chapter 1. Admin Guide @@ -196,7 +196,7 @@ Chapter 1. Admin Guide 3.29. db_check_update (string) 3.30. timer_procs (string) 3.31. xavp_contact (string) - 3.32. db_obs_ruid (string) + 3.32. db_ops_ruid (int) 4. Functions 5. MI Commands @@ -309,7 +309,7 @@ Chapter 1. Admin Guide 3.29. db_check_update (string) 3.30. timer_procs (string) 3.31. xavp_contact (string) - 3.32. db_obs_ruid (string) + 3.32. db_ops_ruid (int) 3.1. nat_bflag (integer) @@ -731,7 +731,7 @@ modparam("usrloc", "timer_procs", 4) modparam("usrloc", "xavp_contact", "ulattrs") ... -3.32. db_obs_ruid (string) +3.32. db_ops_ruid (int) If set to 1, database queries for update or delete are done using ruid value. If it is set to 0, the old style using aor, contact and call-id @@ -739,9 +739,9 @@ modparam("usrloc", "xavp_contact", "ulattrs") Default value is "0". - Example 1.32. Set db_obs_ruid parameter + Example 1.32. Set db_ops_ruid parameter ... -modparam("usrloc", "db_obs_ruid", 1) +modparam("usrloc", "db_ops_ruid", 1) ... 4. Functions diff --git a/modules/usrloc/doc/usrloc_admin.xml b/modules/usrloc/doc/usrloc_admin.xml index 199743418..9f389ad3b 100644 --- a/modules/usrloc/doc/usrloc_admin.xml +++ b/modules/usrloc/doc/usrloc_admin.xml @@ -844,8 +844,8 @@ modparam("usrloc", "xavp_contact", "ulattrs") -
- <varname>db_obs_ruid</varname> (string) +
+ <varname>db_ops_ruid</varname> (int) If set to 1, database queries for update or delete are done using ruid value. If it is set to 0, the old style using aor, contact and @@ -857,10 +857,10 @@ modparam("usrloc", "xavp_contact", "ulattrs") - Set <varname>db_obs_ruid</varname> parameter + Set <varname>db_ops_ruid</varname> parameter ... -modparam("usrloc", "db_obs_ruid", 1) +modparam("usrloc", "db_ops_ruid", 1) ... diff --git a/modules/usrloc/ucontact.c b/modules/usrloc/ucontact.c index 35dfa0df8..996e8d56d 100644 --- a/modules/usrloc/ucontact.c +++ b/modules/usrloc/ucontact.c @@ -93,6 +93,11 @@ ucontact_t* new_ucontact(str* _dom, str* _aor, str* _contact, ucontact_info_t* _ { ucontact_t *c; + if(unlikely(_ci->ruid.len<=0)) { + LM_ERR("no ruid for aor: %.*s\n", _aor->len, ZSW(_aor->s)); + return 0; + } + c = (ucontact_t*)shm_malloc(sizeof(ucontact_t)); if (!c) { LM_ERR("no more shm memory\n"); @@ -465,6 +470,11 @@ int db_insert_ucontact(ucontact_t* _c) if (_c->flags & FL_MEM) { return 0; } + if(unlikely(_c->ruid.len<=0)) { + LM_ERR("invalid ruid for aor: %.*s\n", + _c->aor->len, ZSW(_c->aor->s)); + return -1; + } keys[0] = &user_col; keys[1] = &contact_col; diff --git a/modules/usrloc/urecord.c b/modules/usrloc/urecord.c index dd9845009..75ddd1a8c 100644 --- a/modules/usrloc/urecord.c +++ b/modules/usrloc/urecord.c @@ -333,7 +333,9 @@ static inline void wb_timer(urecord_t* _r) /* Should we remove the contact from the database ? */ if (st_expired_ucontact(t) == 1) { if (db_delete_ucontact(t) < 0) { - LM_ERR("failed to delete contact from the database\n"); + LM_ERR("failed to delete contact from the database" + " (aor: %.*s)\n", + ptr->aor->len, ZSW(ptr->aor->s)); } } @@ -349,7 +351,9 @@ static inline void wb_timer(urecord_t* _r) case 1: /* insert */ if (db_insert_ucontact(ptr) < 0) { - LM_ERR("inserting contact into database failed\n"); + LM_ERR("inserting contact into database failed" + " (aor: %.*s)\n", + ptr->aor->len, ZSW(ptr->aor->s)); ptr->state = old_state; } break; @@ -360,7 +364,8 @@ static inline void wb_timer(urecord_t* _r) else res = db_update_ucontact(ptr); if (res < 0) { - LM_ERR("updating contact in db failed\n"); + LM_ERR("updating contact in db failed (aor: %.*s)\n", + ptr->aor->len, ZSW(ptr->aor->s)); ptr->state = old_state; } break; diff --git a/parser/msg_parser.h b/parser/msg_parser.h index 79194e343..245371543 100644 --- a/parser/msg_parser.h +++ b/parser/msg_parser.h @@ -119,6 +119,7 @@ typedef enum request_method { #define FL_SDP_BODY (1 << 12) /*!< msg has SDP in body */ #define FL_USE_UAC_FROM (1<<13) /* take FROM hdr from UAC instead of UAS*/ #define FL_USE_UAC_TO (1<<14) /* take TO hdr from UAC instead of UAS */ +#define FL_TM_RPL_MATCHED (1<<15) /* tm matched reply already */ /* WARNING: Value (1 << 28) is temporarily reserved for use in kamailio call_control * module (flag FL_USE_CALL_CONTROL )! */ diff --git a/pkg/kamailio/deb/debian/changelog b/pkg/kamailio/deb/debian/changelog index 0b080637b..c5405c8c1 100644 --- a/pkg/kamailio/deb/debian/changelog +++ b/pkg/kamailio/deb/debian/changelog @@ -1,3 +1,9 @@ +kamailio (4.0.3) unstable; urgency=low + + * update to 4.0.3 from upstream + + -- Daniel-Constantin Mierla Thu, 15 Aug 2013 10:35:20 +0100 + kamailio (4.0.2) unstable; urgency=low * update to 4.0.2 from upstream diff --git a/pkg/kamailio/deb/lenny/changelog b/pkg/kamailio/deb/lenny/changelog index 0b080637b..c5405c8c1 100644 --- a/pkg/kamailio/deb/lenny/changelog +++ b/pkg/kamailio/deb/lenny/changelog @@ -1,3 +1,9 @@ +kamailio (4.0.3) unstable; urgency=low + + * update to 4.0.3 from upstream + + -- Daniel-Constantin Mierla Thu, 15 Aug 2013 10:35:20 +0100 + kamailio (4.0.2) unstable; urgency=low * update to 4.0.2 from upstream diff --git a/pkg/kamailio/deb/lucid/changelog b/pkg/kamailio/deb/lucid/changelog index 0b080637b..c5405c8c1 100644 --- a/pkg/kamailio/deb/lucid/changelog +++ b/pkg/kamailio/deb/lucid/changelog @@ -1,3 +1,9 @@ +kamailio (4.0.3) unstable; urgency=low + + * update to 4.0.3 from upstream + + -- Daniel-Constantin Mierla Thu, 15 Aug 2013 10:35:20 +0100 + kamailio (4.0.2) unstable; urgency=low * update to 4.0.2 from upstream diff --git a/pkg/kamailio/deb/precise/changelog b/pkg/kamailio/deb/precise/changelog index 1c2ad0db8..bd08b6727 100644 --- a/pkg/kamailio/deb/precise/changelog +++ b/pkg/kamailio/deb/precise/changelog @@ -1,3 +1,9 @@ +kamailio (4.0.3) unstable; urgency=low + + * update to 4.0.3 from upstream + + -- Daniel-Constantin Mierla Thu, 15 Aug 2013 10:35:20 +0100 + kamailio (4.0.2) unstable; urgency=low * update to 4.0.2 from upstream diff --git a/pkg/kamailio/deb/squeeze/changelog b/pkg/kamailio/deb/squeeze/changelog index 0b080637b..c5405c8c1 100644 --- a/pkg/kamailio/deb/squeeze/changelog +++ b/pkg/kamailio/deb/squeeze/changelog @@ -1,3 +1,9 @@ +kamailio (4.0.3) unstable; urgency=low + + * update to 4.0.3 from upstream + + -- Daniel-Constantin Mierla Thu, 15 Aug 2013 10:35:20 +0100 + kamailio (4.0.2) unstable; urgency=low * update to 4.0.2 from upstream diff --git a/pkg/kamailio/deb/wheezy/changelog b/pkg/kamailio/deb/wheezy/changelog index 0b080637b..c5405c8c1 100644 --- a/pkg/kamailio/deb/wheezy/changelog +++ b/pkg/kamailio/deb/wheezy/changelog @@ -1,3 +1,9 @@ +kamailio (4.0.3) unstable; urgency=low + + * update to 4.0.3 from upstream + + -- Daniel-Constantin Mierla Thu, 15 Aug 2013 10:35:20 +0100 + kamailio (4.0.2) unstable; urgency=low * update to 4.0.2 from upstream diff --git a/pkg/kamailio/rpm/kamailio.spec-4.1 b/pkg/kamailio/rpm/kamailio.spec-4.1 index 9ee65324b..a044770cb 100644 --- a/pkg/kamailio/rpm/kamailio.spec-4.1 +++ b/pkg/kamailio/rpm/kamailio.spec-4.1 @@ -1,5 +1,5 @@ %define name kamailio -%define ver 4.0.2 +%define ver 4.0.3 %define rel 0 %define EXCLUDED_MODULES mysql jabber cpl-c avp_radius auth_radius group_radius uri_radius pa postgres osp tlsops unixodbc diff --git a/pkg/kamailio/rpm/kamailio.spec.CenOS b/pkg/kamailio/rpm/kamailio.spec.CenOS index e31fd6fd4..233a70f1a 100644 --- a/pkg/kamailio/rpm/kamailio.spec.CenOS +++ b/pkg/kamailio/rpm/kamailio.spec.CenOS @@ -1,5 +1,5 @@ %define name kamailio -%define ver 4.0.2 +%define ver 4.0.3 %define rel 0 %define _sharedir %{_prefix}/share diff --git a/pkg/kamailio/rpm/kamailio.spec.SuSE b/pkg/kamailio/rpm/kamailio.spec.SuSE index e53c28886..b19dcc86a 100644 --- a/pkg/kamailio/rpm/kamailio.spec.SuSE +++ b/pkg/kamailio/rpm/kamailio.spec.SuSE @@ -1,5 +1,5 @@ %define name kamailio -%define ver 4.0.2 +%define ver 4.0.3 %define rel 0 %define EXCLUDED_MODULES mysql jabber cpl-c auth_radius misc_radius peering postgress pa unixodbc osp tlsops diff --git a/resolve.c b/resolve.c index 0a77ed700..e739f4b5e 100644 --- a/resolve.c +++ b/resolve.c @@ -1702,6 +1702,7 @@ struct hostent* _sip_resolvehost(str* name, unsigned short* port, char* proto) #ifdef USE_NAPTR if (cfg_get(core, core_cfg, dns_try_naptr)) res = naptr_sip_resolvehost(name, port, proto); + else #endif res = srv_sip_resolvehost(name, 0, port, proto, 0, 0); if( unlikely(!res) ){