From c16b26d5965ec7c8bcd34ddc0034856218fd790a Mon Sep 17 00:00:00 2001 From: Donat Zenichev Date: Wed, 5 Aug 2026 13:04:01 +0200 Subject: [PATCH] New upstream version 6.1.3 --- CMakeLists.txt | 2 +- CMakelists.notes | 54 - ChangeLog | 2034 +++++++++++++++++ cmake/compiler-specific.cmake | 12 +- cmake/db_files.cmake | 2 +- cmake/dbschema.cmake | 24 +- cmake/modules/FindUnistring.cmake | 31 + cmake/os-specific/linux.cmake | 14 + pkg/kamailio/alpine/APKBUILD | 2 +- pkg/kamailio/deb/bookworm/changelog | 12 + pkg/kamailio/deb/bookworm/control | 26 +- .../kamailio-extra-modules.cmake-components | 1 + pkg/kamailio/deb/bookworm/rules | 1 + .../deb/bookworm/source.lintian-overrides | 1 - pkg/kamailio/deb/bookworm/watch | 3 - pkg/kamailio/deb/bullseye/changelog | 12 + pkg/kamailio/deb/bullseye/control | 26 +- .../kamailio-extra-modules.cmake-components | 1 + pkg/kamailio/deb/bullseye/rules | 1 + .../deb/bullseye/source.lintian-overrides | 1 - pkg/kamailio/deb/bullseye/watch | 3 - pkg/kamailio/deb/debian/backports/bookworm | 6 +- pkg/kamailio/deb/debian/backports/bullseye | 6 +- pkg/kamailio/deb/debian/backports/jammy | 6 +- pkg/kamailio/deb/debian/backports/noble | 3 + pkg/kamailio/deb/debian/backports/resolute | 36 + pkg/kamailio/deb/debian/backports/trixie | 3 + pkg/kamailio/deb/debian/changelog | 12 + pkg/kamailio/deb/debian/control | 27 +- .../kamailio-extra-modules.cmake-components | 1 + pkg/kamailio/deb/debian/rules | 2 + .../deb/debian/source.lintian-overrides | 1 - pkg/kamailio/deb/debian/watch | 3 - pkg/kamailio/deb/jammy/changelog | 12 + pkg/kamailio/deb/jammy/control | 26 +- .../kamailio-extra-modules.cmake-components | 1 + pkg/kamailio/deb/jammy/rules | 1 + .../deb/jammy/source.lintian-overrides | 1 - pkg/kamailio/deb/jammy/watch | 3 - pkg/kamailio/deb/noble/changelog | 12 + pkg/kamailio/deb/noble/control | 27 +- .../kamailio-extra-modules.cmake-components | 1 + pkg/kamailio/deb/noble/rules | 2 + .../deb/noble/source.lintian-overrides | 1 - pkg/kamailio/deb/noble/watch | 3 - pkg/kamailio/deb/resolute/changelog | 53 + pkg/kamailio/deb/resolute/control | 894 ++++++++ pkg/kamailio/deb/resolute/copyright | 309 +++ ...io-authblockchain-modules.cmake-components | 1 + .../kamailio-autheph-modules.cmake-components | 1 + ...kamailio-autheph-modules.lintian-overrides | 1 + .../kamailio-cnxcc-modules.cmake-components | 1 + .../kamailio-cpl-modules.cmake-components | 1 + .../kamailio-erlang-modules.cmake-components | 1 + .../kamailio-extra-modules.cmake-components | 7 + .../kamailio-geoip2-modules.cmake-components | 1 + .../kamailio-ims-modules.cmake-components | 1 + .../kamailio-json-modules.cmake-components | 1 + .../kamailio-kafka-modules.cmake-components | 1 + .../kamailio-kazoo-modules.cmake-components | 1 + .../kamailio-ldap-modules.cmake-components | 1 + .../kamailio-lua-modules.cmake-components | 1 + .../kamailio-lwsc-modules.cmake-components | 1 + ...amailio-memcached-modules.cmake-components | 1 + ...mailio-microhttpd-modules.cmake-components | 1 + .../kamailio-mongodb-modules.cmake-components | 1 + .../kamailio-mqtt-modules.cmake-components | 1 + .../kamailio-mysql-modules.cmake-components | 1 + .../kamailio-nats-modules.cmake-components | 1 + ...kamailio-outbound-modules.cmake-components | 1 + ...amailio-outbound-modules.lintian-overrides | 1 + .../kamailio-perl-modules.cmake-components | 1 + ...kamailio-phonenum-modules.cmake-components | 1 + ...kamailio-postgres-modules.cmake-components | 1 + ...kamailio-presence-modules.cmake-components | 1 + .../kamailio-python-modules.cmake-components | 1 + .../kamailio-python3-modules.cmake-components | 1 + ...kamailio-rabbitmq-modules.cmake-components | 1 + .../kamailio-radius-modules.cmake-components | 1 + .../kamailio-redis-modules.cmake-components | 1 + .../kamailio-ruby-modules.cmake-components | 1 + .../kamailio-sctp-modules.cmake-components | 1 + ...kamailio-secsipid-modules.cmake-components | 1 + ...amailio-secsipid-modules.lintian-overrides | 0 ...amailio-snmpstats-modules.cmake-components | 1 + .../kamailio-sqlite-modules.cmake-components | 1 + .../kamailio-systemd-modules.cmake-components | 1 + ...kamailio-systemd-modules.lintian-overrides | 0 .../kamailio-tls-modules.cmake-components | 1 + .../kamailio-tls-modules.lintian-overrides | 3 + ...ailio-tls-wolfssl-modules.cmake-components | 1 + ...kamailio-unixodbc-modules.cmake-components | 1 + .../kamailio-utils-modules.cmake-components | 1 + ...amailio-websocket-modules.cmake-components | 1 + ...mailio-websocket-modules.lintian-overrides | 1 + .../kamailio-xml-modules.cmake-components | 1 + .../kamailio-xmpp-modules.cmake-components | 1 + .../deb/resolute/kamailio.README.Debian | 39 + .../deb/resolute/kamailio.cmake-components | 2 + pkg/kamailio/deb/resolute/kamailio.default | 36 + pkg/kamailio/deb/resolute/kamailio.init | 162 ++ .../deb/resolute/kamailio.lintian-overrides | 1 + pkg/kamailio/deb/resolute/kamailio.postinst | 23 + pkg/kamailio/deb/resolute/kamailio.service | 27 + pkg/kamailio/deb/resolute/kamailio@.service | 26 + pkg/kamailio/deb/resolute/rules | 123 + pkg/kamailio/deb/resolute/source/format | 1 + pkg/kamailio/deb/sid/changelog | 12 + pkg/kamailio/deb/sid/control | 27 +- .../kamailio-extra-modules.cmake-components | 1 + pkg/kamailio/deb/sid/rules | 2 + pkg/kamailio/deb/sid/source.lintian-overrides | 1 - pkg/kamailio/deb/sid/watch | 3 - pkg/kamailio/deb/trixie/changelog | 12 + pkg/kamailio/deb/trixie/control | 27 +- .../kamailio-extra-modules.cmake-components | 1 + pkg/kamailio/deb/trixie/rules | 2 + .../deb/trixie/source.lintian-overrides | 1 - pkg/kamailio/deb/trixie/watch | 3 - pkg/kamailio/obs/kamailio.spec | 8 +- src/Makefile.defs | 2 +- src/core/atomic/atomic_stdatomic.h | 16 +- src/core/autover.h | 4 +- src/core/basex.c | 29 +- src/core/dns_cache.c | 17 + src/core/events.c | 14 +- src/core/events.h | 2 +- src/core/hashes.h | 147 +- src/core/lock_ops.h | 28 +- src/core/msg_translator.c | 51 +- src/core/parser/digest/param_parser.c | 71 +- src/core/parser/parse_body.c | 8 +- src/core/parser/sdp/sdp_helpr_funcs.c | 6 +- src/core/receive.c | 3 + src/core/resolve.c | 2 +- src/core/strutils.c | 104 +- src/core/tcp_main.c | 2 +- src/core/utils/srjson.c | 58 +- src/lib/srdb1/schema/version.xml | 2 +- src/modules/acc_json/README | 14 +- src/modules/acc_json/doc/acc_json_admin.xml | 8 +- src/modules/app_lua/CMakeLists.txt | 54 +- src/modules/app_perl/Makefile | 7 +- src/modules/auth/auth_mod.c | 43 +- src/modules/auth_db/auth_db_mod.c | 11 +- src/modules/auth_db/authorize.c | 44 +- src/modules/auth_diameter/authorize.c | 31 +- src/modules/auth_radius/sterman.c | 33 +- src/modules/cdp/peerstatemachine.c | 11 +- src/modules/db_cluster/dbcl_api.c | 32 +- src/modules/db_mysql/km_my_con.c | 11 +- src/modules/db_redis/redis_dbase.c | 16 +- src/modules/dialog/dlg_cseq.c | 4 + src/modules/dialog/dlg_handlers.c | 8 +- src/modules/dialog/dlg_hash.c | 3 + src/modules/dispatcher/dispatch.c | 12 + src/modules/dispatcher/dispatcher.c | 15 +- src/modules/evapi/evapi_dispatch.c | 10 +- src/modules/htable/ht_api.c | 26 +- src/modules/htable/ht_dmq.c | 45 +- src/modules/http_async_client/README | 2 +- src/modules/http_async_client/async_http.c | 85 +- .../doc/http_async_client_admin.xml | 2 +- src/modules/http_async_client/hm_hash.c | 13 + src/modules/http_async_client/http_multi.c | 123 +- src/modules/imc/imc.c | 4 +- src/modules/imc/imc_cmd.c | 49 +- src/modules/ims_charging/ccr.c | 2 +- src/modules/ims_ipsec_pcscf/sec_agree.c | 29 +- src/modules/ims_ocs/ims_ocs_mod.c | 8 + src/modules/ims_ocs/ocs_avp_helper.c | 7 +- src/modules/ims_qos/ims_qos_mod.c | 4 + src/modules/ims_registrar_pcscf/sec_agree.c | 30 +- src/modules/ims_usrloc_pcscf/pcontact.c | 1 - src/modules/jsonrpcs/README | 11 +- src/modules/jsonrpcs/doc/jsonrpcs_admin.xml | 10 +- src/modules/kazoo/README | 4 +- src/modules/kazoo/doc/kazoo_admin.xml | 2 +- src/modules/kemix/kemix_mod.c | 14 - src/modules/lcr/lcr_mod.c | 20 + src/modules/lost/utilities.c | 10 +- src/modules/maxfwd/mf_funcs.c | 10 +- src/modules/msrp/msrp_netio.c | 145 +- src/modules/msrp/msrp_parser.c | 39 +- src/modules/nathelper/nathelper.c | 166 +- src/modules/nathelper/nhelpr_funcs.c | 16 +- src/modules/ndb_redis/redis_client.c | 67 +- src/modules/permissions/hash.c | 4 +- src/modules/permissions/permissions.c | 6 + src/modules/permissions/rule.c | 5 +- src/modules/phonenum/CMakeLists.txt | 4 +- src/modules/pike/pike_top.c | 14 +- src/modules/pipelimit/pipelimit.c | 171 +- src/modules/pipelimit/pl_db.c | 41 +- src/modules/pipelimit/pl_ht.c | 7 + src/modules/prefix_route/pr_rpc.c | 9 +- src/modules/prefix_route/tree.c | 2 +- src/modules/presence/notify.c | 6 + src/modules/presence/publish.c | 16 +- src/modules/pua/README | 2 +- src/modules/pua/doc/pua_admin.xml | 2 +- src/modules/pua_bla/notify.c | 4 + src/modules/pv/pv_core.c | 14 +- src/modules/pv/pv_trans.c | 7 +- src/modules/pv/pv_xavp.c | 78 +- src/modules/pv_headers/pvh_xavp.c | 15 +- src/modules/regex/regex_mod.c | 26 +- src/modules/rr/loose.c | 2 +- src/modules/rr/record.c | 4 + src/modules/rtpengine/README | 49 +- src/modules/rtpengine/doc/rtpengine_admin.xml | 45 +- src/modules/rtpengine/rtpengine.c | 345 +-- src/modules/rtpproxy/rtpproxy_funcs.c | 31 - src/modules/rtpproxy/rtpproxy_funcs.h | 1 - src/modules/sanity/sanity.c | 9 +- src/modules/sdpops/sdpops_mod.c | 50 +- src/modules/siprepo/README | 44 +- src/modules/siprepo/doc/siprepo_admin.xml | 21 +- src/modules/siprepo/siprepo_data.c | 11 +- src/modules/siprepo/siprepo_mod.c | 9 +- src/modules/sipt/ss7_parser.c | 41 +- src/modules/siptrace/siptrace_hep.c | 7 +- src/modules/siputils/chargingvector.c | 25 +- src/modules/siputils/checks.c | 53 +- src/modules/siputils/contact_ops.c | 8 +- src/modules/siputils/utils.c | 10 +- src/modules/sl/sl.c | 15 +- src/modules/sl/sl_funcs.c | 19 +- src/modules/sl/sl_stats.c | 1 + src/modules/tcpops/tcpops_mod.c | 2 +- src/modules/textops/api.c | 33 + src/modules/textops/textops.c | 19 +- src/modules/textopsx/textopsx.c | 21 +- src/modules/tls/README | 95 +- src/modules/tls/doc/params.xml | 50 +- src/modules/tls/tls_domain.c | 2 +- src/modules/tls/tls_mod.c | 101 +- src/modules/tls/tls_select.c | 27 +- src/modules/tls/tls_server.c | 4 +- src/modules/tls_wolfssl/README | 16 + src/modules/tls_wolfssl/doc/tls_wolfssl.xml | 12 + src/modules/tls_wolfssl/tls_domain.c | 72 +- src/modules/tls_wolfssl/tls_select.c | 13 +- src/modules/tls_wolfssl/tls_server.c | 4 +- src/modules/tm/config.h | 3 - src/modules/tm/rpc_uac.c | 11 +- src/modules/tm/t_msgbuilder.c | 31 +- src/modules/tmx/t_var.c | 47 + src/modules/tmx/t_var.h | 1 + src/modules/tmx/tmx_mod.c | 4 + src/modules/tmx/tmx_pretran.c | 13 + src/modules/topos/README | 12 +- src/modules/topos/doc/topos_admin.xml | 26 +- src/modules/topos/topos_mod.c | 28 +- src/modules/topos/tps_storage.c | 4 +- src/modules/uac/auth.c | 27 +- src/modules/usrloc/urecord.c | 18 +- src/modules/websocket/CMakeLists.txt | 7 +- src/modules/xhttp_prom/prom_metric.c | 63 +- utils/kamctl/dbtextdb/__init__.py | 18 + utils/kamctl/dbtextdb/dbtextdb.py | 20 +- utils/kamctl/dbtextdb/dbtextdb_test.py | 18 + utils/kamctl/generate_version_create_mongo.sh | 18 + utils/kamctl/kamctl | 18 + utils/kamctl/kamctl.base | 18 + utils/kamctl/kamctl.ctlbase | 19 +- utils/kamctl/kamctl.dbtext | 18 + utils/kamctl/kamctl.mysql | 18 + utils/kamctl/kamctl.oracle | 18 + utils/kamctl/kamctl.pgsql | 18 + utils/kamctl/kamctl.rpcfifo | 19 +- utils/kamctl/kamctl.ser | 23 +- utils/kamctl/kamctl.sqlbase | 20 +- utils/kamctl/kamctl.sqlite | 19 +- utils/kamctl/kamdbctl | 18 + utils/kamctl/kamdbctl.base | 19 + utils/kamctl/kamdbctl.dbtext | 22 +- utils/kamctl/kamdbctl.mysql | 31 +- utils/kamctl/kamdbctl.oracle | 20 +- utils/kamctl/kamdbctl.pgsql | 43 +- utils/kamctl/kamdbctl.sqlite | 18 + utils/kamctl/kamdbfunc.oracle | 19 +- 282 files changed, 7123 insertions(+), 1535 deletions(-) delete mode 100644 CMakelists.notes create mode 100644 cmake/modules/FindUnistring.cmake delete mode 100644 pkg/kamailio/deb/bookworm/source.lintian-overrides delete mode 100644 pkg/kamailio/deb/bookworm/watch delete mode 100644 pkg/kamailio/deb/bullseye/source.lintian-overrides delete mode 100644 pkg/kamailio/deb/bullseye/watch create mode 100755 pkg/kamailio/deb/debian/backports/resolute delete mode 100644 pkg/kamailio/deb/debian/source.lintian-overrides delete mode 100644 pkg/kamailio/deb/debian/watch delete mode 100644 pkg/kamailio/deb/jammy/source.lintian-overrides delete mode 100644 pkg/kamailio/deb/jammy/watch delete mode 100644 pkg/kamailio/deb/noble/source.lintian-overrides delete mode 100644 pkg/kamailio/deb/noble/watch create mode 100644 pkg/kamailio/deb/resolute/changelog create mode 100644 pkg/kamailio/deb/resolute/control create mode 100644 pkg/kamailio/deb/resolute/copyright create mode 100644 pkg/kamailio/deb/resolute/kamailio-authblockchain-modules.cmake-components create mode 100644 pkg/kamailio/deb/resolute/kamailio-autheph-modules.cmake-components create mode 100644 pkg/kamailio/deb/resolute/kamailio-autheph-modules.lintian-overrides create mode 100644 pkg/kamailio/deb/resolute/kamailio-cnxcc-modules.cmake-components create mode 100644 pkg/kamailio/deb/resolute/kamailio-cpl-modules.cmake-components create mode 100644 pkg/kamailio/deb/resolute/kamailio-erlang-modules.cmake-components create mode 100644 pkg/kamailio/deb/resolute/kamailio-extra-modules.cmake-components create mode 100644 pkg/kamailio/deb/resolute/kamailio-geoip2-modules.cmake-components create mode 100644 pkg/kamailio/deb/resolute/kamailio-ims-modules.cmake-components create mode 100644 pkg/kamailio/deb/resolute/kamailio-json-modules.cmake-components create mode 100644 pkg/kamailio/deb/resolute/kamailio-kafka-modules.cmake-components create mode 100644 pkg/kamailio/deb/resolute/kamailio-kazoo-modules.cmake-components create mode 100644 pkg/kamailio/deb/resolute/kamailio-ldap-modules.cmake-components create mode 100644 pkg/kamailio/deb/resolute/kamailio-lua-modules.cmake-components create mode 100644 pkg/kamailio/deb/resolute/kamailio-lwsc-modules.cmake-components create mode 100644 pkg/kamailio/deb/resolute/kamailio-memcached-modules.cmake-components create mode 100644 pkg/kamailio/deb/resolute/kamailio-microhttpd-modules.cmake-components create mode 100644 pkg/kamailio/deb/resolute/kamailio-mongodb-modules.cmake-components create mode 100644 pkg/kamailio/deb/resolute/kamailio-mqtt-modules.cmake-components create mode 100644 pkg/kamailio/deb/resolute/kamailio-mysql-modules.cmake-components create mode 100644 pkg/kamailio/deb/resolute/kamailio-nats-modules.cmake-components create mode 100644 pkg/kamailio/deb/resolute/kamailio-outbound-modules.cmake-components create mode 100644 pkg/kamailio/deb/resolute/kamailio-outbound-modules.lintian-overrides create mode 100644 pkg/kamailio/deb/resolute/kamailio-perl-modules.cmake-components create mode 100644 pkg/kamailio/deb/resolute/kamailio-phonenum-modules.cmake-components create mode 100644 pkg/kamailio/deb/resolute/kamailio-postgres-modules.cmake-components create mode 100644 pkg/kamailio/deb/resolute/kamailio-presence-modules.cmake-components create mode 100644 pkg/kamailio/deb/resolute/kamailio-python-modules.cmake-components create mode 100644 pkg/kamailio/deb/resolute/kamailio-python3-modules.cmake-components create mode 100644 pkg/kamailio/deb/resolute/kamailio-rabbitmq-modules.cmake-components create mode 100644 pkg/kamailio/deb/resolute/kamailio-radius-modules.cmake-components create mode 100644 pkg/kamailio/deb/resolute/kamailio-redis-modules.cmake-components create mode 100644 pkg/kamailio/deb/resolute/kamailio-ruby-modules.cmake-components create mode 100644 pkg/kamailio/deb/resolute/kamailio-sctp-modules.cmake-components create mode 100644 pkg/kamailio/deb/resolute/kamailio-secsipid-modules.cmake-components create mode 100644 pkg/kamailio/deb/resolute/kamailio-secsipid-modules.lintian-overrides create mode 100644 pkg/kamailio/deb/resolute/kamailio-snmpstats-modules.cmake-components create mode 100644 pkg/kamailio/deb/resolute/kamailio-sqlite-modules.cmake-components create mode 100644 pkg/kamailio/deb/resolute/kamailio-systemd-modules.cmake-components create mode 100644 pkg/kamailio/deb/resolute/kamailio-systemd-modules.lintian-overrides create mode 100644 pkg/kamailio/deb/resolute/kamailio-tls-modules.cmake-components create mode 100644 pkg/kamailio/deb/resolute/kamailio-tls-modules.lintian-overrides create mode 100644 pkg/kamailio/deb/resolute/kamailio-tls-wolfssl-modules.cmake-components create mode 100644 pkg/kamailio/deb/resolute/kamailio-unixodbc-modules.cmake-components create mode 100644 pkg/kamailio/deb/resolute/kamailio-utils-modules.cmake-components create mode 100644 pkg/kamailio/deb/resolute/kamailio-websocket-modules.cmake-components create mode 100644 pkg/kamailio/deb/resolute/kamailio-websocket-modules.lintian-overrides create mode 100644 pkg/kamailio/deb/resolute/kamailio-xml-modules.cmake-components create mode 100644 pkg/kamailio/deb/resolute/kamailio-xmpp-modules.cmake-components create mode 100644 pkg/kamailio/deb/resolute/kamailio.README.Debian create mode 100644 pkg/kamailio/deb/resolute/kamailio.cmake-components create mode 100644 pkg/kamailio/deb/resolute/kamailio.default create mode 100644 pkg/kamailio/deb/resolute/kamailio.init create mode 100644 pkg/kamailio/deb/resolute/kamailio.lintian-overrides create mode 100644 pkg/kamailio/deb/resolute/kamailio.postinst create mode 100644 pkg/kamailio/deb/resolute/kamailio.service create mode 100644 pkg/kamailio/deb/resolute/kamailio@.service create mode 100755 pkg/kamailio/deb/resolute/rules create mode 100644 pkg/kamailio/deb/resolute/source/format delete mode 100644 pkg/kamailio/deb/sid/source.lintian-overrides delete mode 100644 pkg/kamailio/deb/sid/watch delete mode 100644 pkg/kamailio/deb/trixie/source.lintian-overrides delete mode 100644 pkg/kamailio/deb/trixie/watch diff --git a/CMakeLists.txt b/CMakeLists.txt index 38f14d45f..0b0085937 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,7 +5,7 @@ cmake_minimum_required(VERSION 3.13) # Set the project name project( kamailio - VERSION 6.1.1 + VERSION 6.1.3 DESCRIPTION "Kamailio SIP Server" HOMEPAGE_URL "https://www.kamailio.org" ) diff --git a/CMakelists.notes b/CMakelists.notes deleted file mode 100644 index e4e3db902..000000000 --- a/CMakelists.notes +++ /dev/null @@ -1,54 +0,0 @@ -USE_TCP is required ---- -error: invalid use of undefined type ‘struct tcp_connection’ -================== - -USE_DANGLE is required ----- -warning: ‘tcp_proto_no’ defined but not used [-Wunused-variable] -================== - -USE_TLS requires TLS_HOOKS support - -#ifdef CORE_TLS -#include "core/tls/tls_init.h" THIS FOLDER DOES not exist -#define tls_has_init_si() 1 -#define tls_loaded() 1 -#else -#include "core/tls_hooks_init.h" - -CORE_TLS obsolete? -================== - -USE_NAPTR is required also requires USE_DNS_CACHE - -create_srv_name is not defined - -================== - -F_MALLOC and Q_MALLOC and TSLF_MALLOC are required -undefined reference to `fm_malloc_init_shm_manager' same for others - -This also requires MALLOC_STATS to compile or else it will give -``` -error: ‘SREV_PKG_UPDATE_STATS’ undeclared (first use in this function) - 820 | sr_event_exec(SREV_PKG_UPDATE_STATS, 0); -``` - -================== - -REQUIRES #ifdef STATISTICS - -pv_stats.c:49:2: error: unknown type name ‘stat_var’ - 49 | stat_var *stat; - -tmx_mod.c:92:1: error: unknown type name ‘stat_var’; did you mean ‘start_retr’? - -registrar.h:117:8: error: unknown type name ‘stat_var’ - -usrloc/udomain.h:53:2: error: unknown type name ‘stat_var’ - 53 | stat_var *users; - -================== - -presence requires libxml \ No newline at end of file diff --git a/ChangeLog b/ChangeLog index 87f16fbce..d83bf1d5a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,2037 @@ +===================== 2026-05-27 Version 6.1.3 Released ===================== + +===================== Changes Since Version 6.1.2 =========================== + +commit 5f089268c7d2b2de09c990c05240b2a02fddaf2b +Author: Daniel-Constantin Mierla +Date: Wed May 27 13:26:01 2026 +0200 + + src: version set to 6.1.3 + +commit c9f68109edc0c41f698d9539632f49ddeeca6f4a +Author: Daniel-Constantin Mierla +Date: Wed May 27 13:23:53 2026 +0200 + + pkg/kamailio/deb: version set 6.1.3 [skip ci] + +commit 25f11bd6b29b83ef94fe32b17bd2882a0426d784 +Author: Daniel-Constantin Mierla +Date: Wed May 27 13:22:50 2026 +0200 + + pkg/kamailio: version set to 6.1.3 for rpms and alpine [skip ci] + +commit a0d195a7c7b5b36ab041dfb7313fc119fee1c0cb +Author: Kamailio Dev +Date: Tue May 26 12:46:21 2026 +0200 + + modules: readme files regenerated - modules ... [skip ci] + +commit 076ffc367992b7d923479db976a5720323f47486 +Author: Daniel-Constantin Mierla +Date: Tue May 26 12:27:32 2026 +0200 + + core: try to find ws connection also without local socket + + (cherry picked from commit b26678f93639967b40ca251bd0c4a262d2c17552) + +commit a03335c567cdbf96c08704637f1592766bbacde3 +Author: Daniel-Constantin Mierla +Date: Mon May 25 08:02:08 2026 +0200 + + topos: restore old values after event route execution + + (cherry picked from commit e8167a570b534f4fd1af8441af573539543d485b) + +commit c49ab0e3115b5875bf013b4388a768e97ee5afb2 +Author: Daniel-Constantin Mierla +Date: Thu May 21 07:33:11 2026 +0200 + + prefix_route: increase the name size to match database field + + (cherry picked from commit ecd888ecbc1fe806406555328fc9e4efaa91367e) + +commit 5c5a4fd07a6dd56af1ebd05228bc41d5a08fcf37 +Author: Daniel-Constantin Mierla +Date: Thu May 21 07:25:25 2026 +0200 + + prefix_route: reformat exported rpc structure + + (cherry picked from commit e7426761bfa9a300b073dafe997d6d68840ec2c1) + +commit 3add46e3d6ce48d53fbd1a16c9fadcf0a0bdcb6c +Author: Ovidiu Sas +Date: Mon May 11 01:47:31 2026 -0400 + + core: re-attempt the lock if EINTR occurs (POSIX_SEM) + + (cherry picked from commit b06d969cf00d816182a639acb7de191c763c9d73) + +commit 1f489b057e03446c9b4b522c4ec9d6ab7cb792e3 +Author: Alessio Garzi +Date: Tue May 19 16:49:59 2026 +0200 + + db_redis: Adjust log level in Redis dbase from warning to debug + + Use LM_DBG instead of LM_WARN when performing full table scan on table + + (cherry picked from commit e11ad32b1af248367700acf95b6beeb68344a545) + +commit 7dfbd0a6d522f69319c97a5e07a4e078a18a2bb7 +Author: Ben Kaufman +Date: Tue May 12 12:57:49 2026 -0500 + + topos: Documentation for event_mode [skip ci] + + - Update documenation for default value of event_mode param #4738 + + (cherry picked from commit b80d3b6883eeb46795f4e108e72f1db6b32cbb2b) + +commit 6d090bcf33ce357ca0fdd960d209d26d371b4fab +Author: Daniel-Constantin Mierla +Date: Wed May 20 07:21:22 2026 +0200 + + sdpops: export sdp_get_address_family() to kemi + + (cherry picked from commit f3a34ff69c246c807f25d34b0abf3046d76e1938) + +commit f599e3fc9369fe0bb37d428354b0df90831ea7b0 +Author: Sergey KHripchenko +Date: Thu May 14 19:16:27 2026 +0500 + + htable: fix expire value assignment on string cell replacements + + - assign the expire value to the newly allocated cell when + replacing an existing entry, instead of updating the old cell that is freed immediately after + - fixes ht_set_cell_ex() + + (cherry picked from commit 87e940522fcf97119b997ed3a9ff757b34ce9381) + +commit f7c10b35c9aa990188d18316c7f9c5df7ec1c89f +Author: Daniel-Constantin Mierla +Date: Tue May 19 11:54:41 2026 +0200 + + core: execute event_route[core:receive-parse-error] on receive for parsing madatory headers failure + + - stop processing of the message if drop is used + + (cherry picked from commit 8888108e75a0f245636dd511e657de9e2957c2d7) + +commit 0ebc6f4ad0233fc4e15f443354afbfee7530b734 +Author: Daniel-Constantin Mierla +Date: Tue May 19 08:30:18 2026 +0200 + + core: events - detect drop used inside event_route[core:receive-parse-error] + + (cherry picked from commit c0e4f40c576d92f0d5fe98e9a64f3944e3f1559b) + +commit d2c85d046b4d0eac3fce2914a29b1da4d8ef062f +Author: Victor Seva +Date: Tue May 26 08:57:56 2026 +0200 + + pkg/kamailio/deb: remove kamailio-dbg package [skip ci] + + * nowadays we produce dbgsym packages + + (cherry picked from commit 565e0f7390aa13fe338a14a04e17a1b0245861eb) + +commit 81fdc50dc4d11e9a09fda45461be016fde331737 +Author: Victor Seva +Date: Tue May 26 08:51:02 2026 +0200 + + pkg/kamailio/deb: [resolute] remove alien-tag errors [skip ci] + + (cherry picked from commit cdb446cf8ac489f40b228bcb810665706df402a0) + +commit 0b2f8729dad27b4613b360aa2a40d2b3d72cdc53 +Author: Victor Seva +Date: Tue May 26 08:42:43 2026 +0200 + + pkg/kamailio/deb: remove watch file [skip ci] + + * debian-watch-file-in-native-package + + (cherry picked from commit b7d4dfaa50537679f7ceea0fa994e507a9b7c3fd) + +commit 41037577b59e47a44f3e46b8e631ec60fe935f08 +Author: Victor Seva +Date: Fri May 22 10:43:05 2026 +0200 + + pkg/kamailio/deb: add support for Ubuntu Resolute 26.04 LTS [skip ci] + + based from commit 502b6c75245d5ba89463ff5a773f9cd3e2626a24 + +commit b2cf3bd82c856036f46fd2e2f3273fbebbc81e69 +Author: Kamailio Dev +Date: Mon May 18 11:01:26 2026 +0200 + + modules: readme files regenerated - modules ... [skip ci] + +commit c1f0c5ebae930d6dcca8fb8d97cc2679de4ecba6 +Author: Daniel-Constantin Mierla +Date: Mon May 18 10:23:22 2026 +0200 + + Revert "dmq: Fix compiler warning deprecated-non-prototype" + + This reverts commit dc55adfc1e9417fa574b548ed8796427ce08ea81. + +commit dccbe368dff8e4e7b82ba0f79d658ff89a2bf218 +Author: Daniel-Constantin Mierla +Date: Sun May 17 08:44:16 2026 +0200 + + sdpops: loost at address family in streams if none in session + + - GH #4718 + + (cherry picked from commit 1440a865f61129461ca7d04424af98fb2d0c2406) + +commit 742bb4d04ffff12b03683e74d7abdad3208181c8 +Author: Daniel-Constantin Mierla +Date: Sat May 16 09:48:51 2026 +0200 + + tcpops: proper check for tcp connection get result + + (cherry picked from commit 9319a33ae3912280e35e1cbf6d26e32195f4c258) + +commit 3cadb0c2b61116fe650e602effb6560a8c6c3cc0 +Author: Daniel-Constantin Mierla +Date: Sat May 16 09:23:27 2026 +0200 + + imc: gradual building of headers with size checks + + (cherry picked from commit e13c49fbce91511bd543e85eeca5dd4651340bec) + +commit d4935396fdf0a4448b44d56d3300b63d0bf0dad3 +Author: Daniel-Constantin Mierla +Date: Fri May 15 10:05:59 2026 +0200 + + rtpproxy: remove duplicated function ser_memmem() + + - same as the one in core and already available via included headers + + (cherry picked from commit 59eddb54d200e29041c3606f66524ac1d88a8ebc) + +commit 42f446adc6d4e85e87eb59a8718a915cca4b234a +Author: Alessio Garzi +Date: Thu May 14 14:15:36 2026 +0200 + + siputils: validate SIP URI produced by tel2sip and tel2sip2 + + After constructing the SIP URI, call parse_uri() to verify the result + is well-formed before writing it to the output pvar. If validation + fails, free the allocated pkg memory and return -1. + + (cherry picked from commit 75e3cdfacbe4172fcd6b16ab94d96e2e29229878) + +commit afdde89c736b332554312cee586bfbac4e6300b5 +Author: Daniel-Constantin Mierla +Date: Thu May 14 13:20:12 2026 +0200 + + imc: check for content-type for building response headers + + (cherry picked from commit 46accd70c68ab410d3f87d4188aee8dbc7c60673) + +commit 2c6108e4b01570fe2fdf666b36797270017a7874 +Author: Daniel-Constantin Mierla +Date: Thu May 14 12:58:40 2026 +0200 + + core: utils/srjson - check the 4 hex chars for \u + + (cherry picked from commit c72b414c62f20aa1f6db9273326d4e8ed3167b40) + +commit fe308784e1883addd3be407b55806921754922db +Author: Daniel-Constantin Mierla +Date: Thu May 14 12:43:20 2026 +0200 + + core: sdp parser - check char search result in extract_bwidth() + + (cherry picked from commit 9825a757a059cc6fa2fc58f24f4eff9a528f1e49) + +commit 4c6073d9321e16bf337dda2326d804364774b96c +Author: Daniel-Constantin Mierla +Date: Wed May 13 10:58:01 2026 +0200 + + core: prser - check on other parm names + + (cherry picked from commit d82e980a85f1a28498e3883a77c4789caff0c15e) + +commit 60b1dea32cf1d634f00dfa25feed99796379976b +Author: Daniel-Constantin Mierla +Date: Tue May 12 08:24:33 2026 +0200 + + core: set upper limit for b58 encode input + + (cherry picked from commit 0e02061319df55da027840809641c3e2dece8f3a) + +commit 8f93634a4f987975403b88be08124ae050d6b6be +Author: Daniel-Constantin Mierla +Date: Mon May 11 10:30:10 2026 +0200 + + auth_radius: check input parameters + + (cherry picked from commit 64118b0b008c61580f96aefa3ea1f99341638db5) + +commit 25b94bee60c11e234e9136907a140e37d6d31ab0 +Author: Daniel-Constantin Mierla +Date: Sun May 10 16:27:59 2026 +0200 + + presence: check content type for publish + + (cherry picked from commit 2db510a4a6719d47e56b807c66b6d2dc5a4c02aa) + +commit 4620d178b6f3e46eafcd8e5482b136eb6788063a +Author: Daniel-Constantin Mierla +Date: Sun May 10 14:41:59 2026 +0200 + + textops: check content type for appending multibody + + (cherry picked from commit 02b74b4c752ba6ee89e262f41727d2830905b5f8) + +commit b26e4d386a39614a39c80ce51355b1edf70b8bda +Author: Daniel-Constantin Mierla +Date: Sun May 10 11:21:59 2026 +0200 + + core: b58 decode compute output lenght from size + + (cherry picked from commit 5a49de2a7d5623ca65c756468d22bef7ae50b439) + +commit 58aeb581fa5712101fbfd22ab9dc68f8155eeed2 +Author: Daniel-Constantin Mierla +Date: Sun May 10 08:08:38 2026 +0200 + + core: check input and use for-loop for urlencode() + + (cherry picked from commit f52a278b35ee369e9e4e489aa191f437f81aaf0d) + +commit f6db642e73e1265cb9b499c429dcd682880908b8 +Author: Daniel-Constantin Mierla +Date: Sat May 9 08:56:58 2026 +0200 + + core: use for loop for unescape_user() + + (cherry picked from commit 6527c1e6c0483def2ea05e0c7fab347a002eb985) + +commit 779260e903849a27103c6d96858b7a0c8e11e256 +Author: Daniel-Constantin Mierla +Date: Fri May 8 20:45:18 2026 +0200 + + ndb_redis: rework of reconnect when server not available at startup + + (cherry picked from commit 2451072a315e3c59e235ef62b4b7fcda7882bf36) + +commit 9ff29ce9e45aad7dec338230fe3f039f99356b3c +Author: Daniel-Constantin Mierla +Date: Thu May 7 07:05:15 2026 +0200 + + core: parser/digest - check available input size + + (cherry picked from commit 6ff17cbe1b17233db51405e2007cdbf32eb658db) + +commit ff37e84d490c89e6a640eb867f7a38a11181c69f +Author: Sebastian Damm +Date: Wed May 6 16:29:15 2026 +0200 + + rtpengine: add "debug" to rtpengine_offer flags docs + + (cherry picked from commit 9309dc76d2fa0d1fdf815fb11c7df07ec4c97922) + +commit 857baf567408bdd730922ec1169e03ee3333ac49 +Author: Bastian Triller +Date: Fri May 8 08:57:33 2026 +0200 + + rtpengine: Fix siprec example in docs + + Also change route to request_route and fix some whitespace. + + (cherry picked from commit 5dbe81c8e837bf479d38c9fffe1e20cfc9f4d664) + +commit ac4bd9214f67440af155853abbd96e7c4924d1bd +Author: Bastian Triller +Date: Fri May 8 09:42:41 2026 +0200 + + pua: Remove spurious gt + + (cherry picked from commit 3d9d27895899e79195141e3f33df15343e23edf0) + +commit 5d4ee36dcdceea766df56a318cb55dc8650a5c3b +Author: Bastian Triller +Date: Fri May 8 09:42:22 2026 +0200 + + kazoo: Remove spurious gt + + (cherry picked from commit 5801be02804db356d9176421b32bb9e94662b7f4) + +commit ff433d26a4dc9ba8f85a9b5d34e1982ea5b61c3c +Author: Bastian Triller +Date: Fri May 8 09:40:44 2026 +0200 + + lib: Remove spurious gt + + (cherry picked from commit 70d2e99de833454513f63ace4b0ab7572b3bb7ee) + +commit dc55adfc1e9417fa574b548ed8796427ce08ea81 +Author: Bastian Triller +Date: Thu May 7 23:25:55 2026 +0200 + + dmq: Fix compiler warning deprecated-non-prototype + + Fixes: e60a77e020 ("dmq: added init_with_single parameter") + (cherry picked from commit 39c79265e6f46af57d54953be248fbe53e7d3cbd) + +commit 7be4cfc14d3230353690fa510e98896d8dca85d6 +Author: Daniel-Constantin Mierla +Date: Tue May 5 17:01:55 2026 +0200 + + core: hashes - cast to unsigned to accommodate shifted value + + (cherry picked from commit 151428fc0611487500c43667a26f73dc98fbd7ef) + +commit 3c346aa70ced0fa9a8aa79cba766b1b0bd5b7f00 +Author: Daniel-Constantin Mierla +Date: Mon May 4 13:17:16 2026 +0200 + + core: free in case of error for cmp_str_params() + + (cherry picked from commit 65fd1e01d8db46719abaef7126611176588f0036) + +commit 89dcbc68a58b4c58c128253e1781e98bd1301d96 +Author: Xenofon Karamanos +Date: Mon May 4 15:45:28 2026 +0000 + + evapi: Limit digits allowed + + (cherry picked from commit 3fc061dfa3a0db26591164af88abb6ce31afc61a) + +commit 0767d7386ddc5892e3e9d5b19fb4219fb2020fe0 +Author: Xenofon Karamanos +Date: Mon May 4 13:45:29 2026 +0000 + + pua_bla: Verify header length + + (cherry picked from commit 7f4c4c5a6694e6f36a6b9e41aa4d25636bb008eb) + +commit a88a6cbbb599c3faa0c88677107027ed13c311a5 +Author: Xenofon Karamanos +Date: Mon May 4 14:09:16 2026 +0000 + + lost: enhance lost_parse_geo to check for truncation of coordinates + + (cherry picked from commit 7c6d17eb1d72760df0751d5ad6549383c51729ac) + +commit cd5228ec7e0b9d3675282dcba8d7d025872d4363 +Author: Xenofon Karamanos +Date: Mon May 4 14:51:23 2026 +0000 + + imc: Check member uri length + + (cherry picked from commit c4c7b919b84ae861b02bc85d2fbc5bd747739b17) + +commit 6120325bdecf0bb33ec72ed43b9e1104ecdb9b6f +Author: Xenofon Karamanos +Date: Mon May 4 14:46:55 2026 +0000 + + imc: Add length check + + (cherry picked from commit 53b63b8f559dc7bc192efca45382794a99b596ff) + +commit c609f121cf5a6c926338849dac7dd2f26a5ccce6 +Author: Daniel-Constantin Mierla +Date: Sun May 3 20:55:15 2026 +0200 + + core: cast to unsigned for shifting in digest parser + + (cherry picked from commit be7d523965517d75363faeff511a3af0b63d4e3a) + +commit bfcd848a93f790a916b783a0fde2fdd9031dfd0a +Author: Daniel-Constantin Mierla +Date: Sun May 3 20:15:18 2026 +0200 + + core: strutils - cast to unsigned for shifting in urldecode() + + (cherry picked from commit cc80f1dd141c608ce271c38521a96031ab6f56fb) + +commit c0992205465ebea43457e4abb45c8c51cc34e763 +Author: Daniel-Constantin Mierla +Date: Sun May 3 11:34:34 2026 +0200 + + core: cast to unsigned when shifting for hashing + + (cherry picked from commit 997a92c47f2126f1603c4c9a51839049bea416bc) + +commit 8f878d071ff635f61deadba316bcb53c370dd3e4 +Author: Daniel-Constantin Mierla +Date: Sun May 3 10:09:41 2026 +0200 + + core: added params check for b58_decode() + + (cherry picked from commit 9ddf96759a14820bca0ed217892f60f01a0be9ba) + +commit 9921cf9cbb2f710ba064c7cdd77ae90984ce58f6 +Author: Daniel-Constantin Mierla +Date: Sun May 3 09:49:40 2026 +0200 + + tmx: checks of sizes for attributes matching pre-tran + + - test uas request for replying on callid + + (cherry picked from commit 2885392b291d5de8e517500aaaa30edd0d27003d) + +commit 4967c8ae60756b2eadc96086a9ceede8e64be753 +Author: Daniel-Constantin Mierla +Date: Sat May 2 21:36:20 2026 +0200 + + tm: function to clean/reset local data + + (cherry picked from commit 7f072b018fee8607787bdef6d093e52990873c71) + +commit ea9f2c186a866f17639c810c395b42affeb5d303 +Author: Daniel-Constantin Mierla +Date: Sat May 2 19:33:12 2026 +0200 + + core: strutils - check end for hex escape in urlencode() + + (cherry picked from commit 35fb4b599b7e04fbac2045d2767799ec306907a3) + +commit b9639ece44614b409e57632d03e07dbd7762061d +Author: Daniel-Constantin Mierla +Date: Sat May 2 19:16:01 2026 +0200 + + core: strutils - proper size for control chars in ksr_str_json_escape() + + (cherry picked from commit 15da24b6c0d9ffc04d5ffaba15c95ce9741b16d3) + +commit 15f92d5386ec83297afb101ec487c6afca6e69f5 +Author: Daniel-Constantin Mierla +Date: Sat May 2 18:58:38 2026 +0200 + + core: strutils - check position at escape sequence for unescape_user() + + (cherry picked from commit 0ce7ba9f5366621e0394192e10873038267f68f5) + +commit 58e8f760df25f681f23c5434469d8ae4162b4cb7 +Author: Elena-Ramona Modroiu +Date: Sat May 2 12:01:47 2026 +0200 + + core: check value param for adding to dns cache + + (cherry picked from commit 9565defacd0a7f710b80425417a68384ba5793ea) + +commit abb36b45c97a1c570081303da6f7ae5d1a7ba181 +Author: Daniel-Constantin Mierla +Date: Sat May 2 08:53:07 2026 +0200 + + uac: parse auth header to find a supported one + + - GH #4698 + + (cherry picked from commit 7350442dced78f3e3cbf1dae6e5fcccea2e331c8) + +commit 45d2983a46d2a6d6d8d471ba7f216e4f5ddda92b +Author: Daniel-Constantin Mierla +Date: Sat May 2 08:33:05 2026 +0200 + + usrloc: delete contact immediately on handle lost tcp + + - GH #3479 + + (cherry picked from commit 390bcb11d182c26b9111d3497a3a451ffaf4be27) + +commit 5256eb7c34989b394cd68efcf34875245198ac8c +Author: Daniel-Constantin Mierla +Date: Sat May 2 08:20:33 2026 +0200 + + tmx: set callback for pv name free and check t branch index + + (cherry picked from commit 4d84419e569716222add1584871ab3fa8a38b4dc) + +commit 1eafcdb4c03b7de464166f9221ae2aadb9b87e07 +Author: Daniel-Constantin Mierla +Date: Sat May 2 08:02:51 2026 +0200 + + tmx: check via branch len for pretran test + + (cherry picked from commit f8f2f2d34866f1e6e6ba5d88b817c70c4f703b66) + +commit aadc471d6c8127945ca3f5a34a196987bc572e34 +Author: Daniel-Constantin Mierla +Date: Fri May 1 19:21:18 2026 +0200 + + app_lua: cmake option to specify the lua version to compile with + + - with -DKSR_LUA_VERSION or env variable KSR_LUA_VERSION + - example: cmake -DINCLUDE_MODULES="app_lua" -DKSR_LUA_VERSION=5.2 .. + + (cherry picked from commit 96ca0439f049c87e8b623408991e13c98d9a3c48) + +commit 1b554a40412dd21633571a9e761b2bd4831194ee +Author: Daniel-Constantin Mierla +Date: Fri May 1 10:48:32 2026 +0200 + + lcr: check the result when creating pcre structures + + (cherry picked from commit d48f54781bd8b5045445d5b7c39a549c7bb7aea8) + +commit c979652cb107981a74c9e0e5756b044edb97f981 +Author: Daniel-Constantin Mierla +Date: Fri May 1 09:49:00 2026 +0200 + + regex: do not use global contexts for temporary per-match PCRE2 allocations + + - proper cleanup and check of returned values + - related to GH #4660 + + (cherry picked from commit 8ca16bc97a51871d8a59245318ef477e4f6dd193) + +commit 0ac74907b7b89f1e047729823c37216051282494 +Author: Daniel-Constantin Mierla +Date: Fri May 1 08:34:42 2026 +0200 + + dispatcher: return 0 for pvs on targets count 0 + + (cherry picked from commit cbe064bdae28521b74d1ebce5429eb8d62abd905) + +commit aec2810fe6ca3273d506c10b74e0d17bf2bfc948 +Author: Daniel-Constantin Mierla +Date: Fri May 1 08:24:15 2026 +0200 + + db_cluster: proper connection list in log messages + + - GH #4467 + + (cherry picked from commit abf471b3202107f03f9dd6f38e4ca15bb174e04a) + +commit a3ffa65c002874370b74cf841e78f93bafbaaab9 +Author: Daniel-Constantin Mierla +Date: Fri May 1 08:08:30 2026 +0200 + + dispatcher: check host length before copy + + (cherry picked from commit 408c63624905f35db6f4dd045bac090f1803ada1) + +commit 5548c7c38bfb88f75a0f03f1270d3c1f2a6e24dd +Author: Daniel-Constantin Mierla +Date: Thu Apr 30 20:40:32 2026 +0200 + + maxfwd: remove function name from logs + + - check for headers pointer + + (cherry picked from commit 3a4f5b83da90d67aa59e040a3612f95976ca2b47) + +commit db15b038fd6c8e429f1f622ef853fc316d5a5be0 +Author: Elena-Ramona Modroiu +Date: Thu Apr 30 19:48:48 2026 +0200 + + pipelimit: limits on number of slots and pipeid length + + - validate db values and cleanup on errors + + (cherry picked from commit 522aaf5e72af11e461086871f588da2eef0f8cf4) + +commit f669015970e4e136e022006dc4045b4106d14f30 +Author: Elena-Ramona Modroiu +Date: Thu Apr 30 08:07:34 2026 +0200 + + pipelimit: rewoked the cpu load parsing + + - check the value for timer interval + + (cherry picked from commit 609a5ab9727c2872c2cc31826ecc0716a54ab482) + +commit 88fa3736248038fdc3b455373c021007f9e20553 +Author: drTr0jan +Date: Mon Apr 27 13:45:54 2026 +0300 + + app_lua: [cmake] fixed lua include var + + After 2ccd8a1183690693038606735292e8586d325704 + + (cherry picked from commit 7fa4d437f47ae22a67f973e605bde379f2f49173) + +commit d6910331e70a8c25a269a4885e96687e1417170e +Author: Daniel-Constantin Mierla +Date: Thu Apr 30 10:16:00 2026 +0200 + + pv: callbacks to free xavp/* pv names + + (cherry picked from commit b8b9e309256ad9a82fdcb59cce0aaebec720d2f4) + +commit 135bc11812bc28a818778ddbda8bc90e4dc9f2bf +Author: Daniel-Constantin Mierla +Date: Thu Apr 30 08:53:35 2026 +0200 + + pv: updated check before looking for xavp param bracket + + (cherry picked from commit 8926426712d2547243dd504cd556b99fac8ced7d) + +commit 59d24530a25370c315dfadff19dacc9a28bd1abc +Author: Daniel-Constantin Mierla +Date: Thu Apr 30 06:41:24 2026 +0200 + + pv: check for empty value on xto attribute + + (cherry picked from commit f3cd1c138ee58cc43835be4c8e1186ac62bfed19) + +commit 471346eccd267fcee041dfe1f507f31aab3f1498 +Author: Daniel-Constantin Mierla +Date: Wed Apr 29 22:21:46 2026 +0200 + + permissions: free the expression reg value + + (cherry picked from commit 58b9eb157c17739cc2ae6594e0025f54606cd7af) + +commit 5471ffa557d9b030fcff8634a7abc45126f1fd6e +Author: Daniel-Constantin Mierla +Date: Wed Apr 29 21:45:53 2026 +0200 + + permissions: use the common max uri size for buffer + + (cherry picked from commit 6f0f0a5d3917a3a9d7e6144af1960e8ed9f2e929) + +commit 638333b7b846c447e3a8eb3f57646cb115941af2 +Author: Daniel-Constantin Mierla +Date: Wed Apr 29 21:40:08 2026 +0200 + + permissions: ensure to header is parsed for check register + + (cherry picked from commit 76789ae4f85e51f7b14cf856fffbad337814c9ef) + +commit fdc9807ac137948288300f11f191e43d87436f00 +Author: Daniel-Constantin Mierla +Date: Wed Apr 29 08:38:41 2026 +0200 + + siputils: use buffer size for snprintf() + + (cherry picked from commit 4e584da9ae0c42eca8eea7e85b8a174d6311e8c6) + +commit 4cfc9170590bca929d759c9e1204eb53beb293a0 +Author: Daniel-Constantin Mierla +Date: Wed Apr 29 06:46:35 2026 +0200 + + siputils: check the return of snprintf() for patching content length + + (cherry picked from commit d1dc1da78d31ec5ad6273b857b9c5c95016e627a) + +commit 504080283487faf76da4a0ef89c15a1717a6b742 +Author: Daniel-Constantin Mierla +Date: Wed Apr 29 06:34:32 2026 +0200 + + siputils: use ser memmem instead of strstr for charging vector + + - small optimization on search parameters + + (cherry picked from commit 60650c53f3ca957a8586ab7d6feb4f91e57ef16a) + +commit 9f1f2758d82e9a5a52ce0128078926b4f597d335 +Author: Daniel-Constantin Mierla +Date: Tue Apr 28 21:42:24 2026 +0200 + + textopsx: reworked condition on getting header parameter + + (cherry picked from commit 6908471e71086cc1cf6858220255b301906e0417) + +commit 2fff7005f6f619b865d82566b2897b8ffc973a79 +Author: Daniel-Constantin Mierla +Date: Tue Apr 28 19:44:31 2026 +0200 + + textopsx: check the return for snprintf() + + (cherry picked from commit a23646e873bc65105efd468bf7c671de4871159b) + +commit 33b7c0ab28111dc7357d35797af42b82838afd2d +Author: Daniel-Constantin Mierla +Date: Tue Apr 28 19:28:58 2026 +0200 + + textopsx: increment body line interator position before break + + (cherry picked from commit be7cff60d177d50a7c6230d68b0bada6a7c9b1f7) + +commit 956c0547531eef8ee7d3df3c6ebfd4b11800c05b +Author: Torrey Searle +Date: Tue Apr 28 13:58:56 2026 +0200 + + sipt: use the actual calculated encoded length + + (cherry picked from commit ed1790d404598f71417934465942fd3eb1b0dcd2) + +commit 112cdcbce17df1e511890c255d2a2a0681efa7cb +Author: Xenofon Karamanos +Date: Mon Apr 27 10:48:24 2026 +0000 + + sipt: Validate phone number length + + (cherry picked from commit 6fb59101a02db3baa7b87195f2d057ccf2ba4f44) + +commit f59ca48a409572684dfa7f32bf7bdf49c4801d15 +Author: Daniel-Constantin Mierla +Date: Tue Apr 28 08:24:14 2026 +0200 + + textops: check allocation result for several api functions + + (cherry picked from commit 7d9eca9943b51039fd624b4d4e5bb21b163bb3dc) + +commit b8f6abde0ca9e226ae30de05bdd5f4081ce26206 +Author: Daniel-Constantin Mierla +Date: Tue Apr 28 08:18:06 2026 +0200 + + textops: length check for generate_boundary() search + + (cherry picked from commit 023c302bb886579710239b71a41bf18344e367b4) + +commit 0ca34e5feaffd536fd97c42318a06a42924f5883 +Author: Daniel-Constantin Mierla +Date: Mon Apr 27 12:21:24 2026 +0200 + + rr: check user part for flow token + + (cherry picked from commit 23075bc8d2b646e736b8d6a5c811c13d72d4b6af) + +commit 89c87be9988083a0d7b704cf90396da637d34f80 +Author: Daniel-Constantin Mierla +Date: Mon Apr 27 12:07:41 2026 +0200 + + rr: check parameter for forcing socket + + (cherry picked from commit a3563a0de47016e3cb9616ad326a5fe3b7ef86a5) + +commit 306c1557818f214546e60f0e9d75c8b32e70e962 +Author: Daniel-Constantin Mierla +Date: Mon Apr 27 09:46:54 2026 +0200 + + htable: check for empty param in htable definition + + (cherry picked from commit a43df45a000070f390788276859b2b68a6ad5142) + +commit cc257ea0cad4800400d19ad6a4b7fa810c9f1091 +Author: Daniel-Constantin Mierla +Date: Mon Apr 27 08:18:31 2026 +0200 + + htable: wrapper to get dmq string from json + + (cherry picked from commit d68ad23f4d94449e7674b8d9a291974c5bde2c35) + +commit b3b006d77245958dd6d18b2bd48a0afa0bea86b5 +Author: Daniel-Constantin Mierla +Date: Mon Apr 27 08:09:55 2026 +0200 + + htable: check json field for dmq operation + + (cherry picked from commit 11b8cb0cb9bc235b89ab7c3b45968383467d5551) + +commit 9818651de3277abffe477b766906c958e992120f +Author: Daniel-Constantin Mierla +Date: Mon Apr 27 06:43:51 2026 +0200 + + pike: skip printing ip with invalid lenght + + (cherry picked from commit 8d21836c9fd8988e43861a481f037095c1f9bf01) + +commit c4dea19877458d9d04f9a19f06856021c2c25399 +Author: Daniel-Constantin Mierla +Date: Sun Apr 26 15:17:12 2026 +0200 + + sanity: check the return of add_lump_rpl() + + (cherry picked from commit 0bfdf5f75a50da4c250c66f02f10888a0f9a030a) + +commit fc6b86b62cf51533f23e34f415ef9db2a0d0f687 +Author: Daniel-Constantin Mierla +Date: Sun Apr 26 15:07:05 2026 +0200 + + auth_db: clean up on pv initialization error + + (cherry picked from commit e6610a3263555a1ceac47c39ad9a44421bc250a6) + +commit 0922846422fb7b87936d766f5ddac711f25028a3 +Author: Daniel-Constantin Mierla +Date: Sun Apr 26 12:17:44 2026 +0200 + + auth_db: properly handle db str or string results for password/ha1 + + (cherry picked from commit 34dcd50c81e290d0dec4d22d9bfc2c8828500538) + +commit 0e1d3a55a05fae501ac5fa2ee8d8e7433211634d +Author: Daniel-Constantin Mierla +Date: Sun Apr 26 11:38:49 2026 +0200 + + auth_db: use define for ha1 buffer size + + (cherry picked from commit f77ac0645e61b443f82ece21f024b878c46bad7e) + +commit c78e364a440bce4ca90daf5916f969f16e8de249 +Author: Daniel-Constantin Mierla +Date: Sun Apr 26 11:28:57 2026 +0200 + + auth: match first on algorithm length + + (cherry picked from commit 5a2994a3769b340f2920a9891fbd2b01abccc88d) + +commit f35221fad374764f65d22d9673789a4e6e8827e2 +Author: Daniel-Constantin Mierla +Date: Sun Apr 26 08:10:02 2026 +0200 + + auth: size checks for functions to get authenticate header + + (cherry picked from commit 60f647d2c6b8e0e13dacecbce23257c16670124a) + +commit c18a93581750314eeee3df6ceb477288edf6a44f +Author: Daniel-Constantin Mierla +Date: Sun Apr 26 07:56:51 2026 +0200 + + auth: check password parameter + + (cherry picked from commit e078b3fb3cb9d56d9969476358cc1d7940f8160d) + +commit 5a08fea69a2bce5bb22388d47baf56a4624d3ff6 +Author: Daniel-Constantin Mierla +Date: Sun Apr 26 07:21:14 2026 +0200 + + sl: reset stats on error + + (cherry picked from commit 7b0319ac9f460e0a72db130c42cbd9f7da501ad6) + +commit 80a3ecf489d3b8241bd16a4af95d647b01d7d790 +Author: Daniel-Constantin Mierla +Date: Sat Apr 25 21:01:27 2026 +0200 + + sl: checks for empty reason + + (cherry picked from commit bcb1dcd838dcdb323aa05c40554428a009840f98) + +commit bbbbfc67b0c600a0814f9a3fca4aeb1358e6931d +Author: Daniel-Constantin Mierla +Date: Sat Apr 25 19:06:14 2026 +0200 + + nathelper: check fields on nh timer ul buffer parsing + + (cherry picked from commit 1c4bbb286ef44f48c14f394decdda2197d5d7563) + +commit 4bc4c7df2d5530ee0b8253036aef07e1131c000c +Author: Daniel-Constantin Mierla +Date: Sat Apr 25 17:19:34 2026 +0200 + + nathelper: check for proto alias location + + (cherry picked from commit 56babfe27c98f0347f87167553ea9d89d7d6c5b1) + +commit 5737b3284feb092e297bddefe5d7b45ad8d33afb +Author: Daniel-Constantin Mierla +Date: Sat Apr 25 16:38:57 2026 +0200 + + nathelper: validity check for alias proto + + (cherry picked from commit f79fde802895fdd4a6fef5ff98b802cadcad5066) + +commit a44c3ed1a1512fa725969880b2bdc033f9598620 +Author: Daniel-Constantin Mierla +Date: Fri Apr 24 23:35:44 2026 +0200 + + nathelper: check for size of r-uri + + (cherry picked from commit 792819cddb249a9aeb42c80be41cbffd74e851d4) + +commit 1b2dad77102d8d8a0ef48225ad48f3d4f69719d7 +Author: Alessio Garzi +Date: Wed May 13 17:35:26 2026 +0200 + + pv_headers: Fix memory leak in pv_headers + + Before calling pvh_merge_uri(), c_data is allocated in shared memory. + If an error occurs inside pvh_merge_uri(), this allocation is not released, + leading to a potential leak. + Additionally, pvh_merge_uri() may allocate further memory inside c_data->value.s, + which also needs to be freed on failure. + + This commit ensures that all allocated memory is properly released in error paths, + preventing potential memory leaks. + + (cherry picked from commit 97985752afa4fc1e80e3fc5daf70a11266145b29) + +commit 787991d19797a08c250a3b1acb870b964bdb242d +Author: Daniel-Constantin Mierla +Date: Fri May 15 09:07:33 2026 +0200 + + core: via builder - print socket in log when failing to find ws connection + + - backport of 5dba946d56e9e2de1d9124b6912e525859c753f7 + +commit 1dc0f58da31895a522235970ec067ee99a7c8fad +Author: Kamailio Dev +Date: Mon May 4 12:01:21 2026 +0200 + + modules: readme files regenerated - modules ... [skip ci] + +commit fb53183b063af89ae490b869af7c58f1cf0149e2 +Author: Alexander Bakker +Date: Mon May 4 11:39:17 2026 +0200 + + acc_json: fix docs typo in pre-encoded prefix modparam name + + (cherry picked from commit 2fdcdc8fd1c89ba5a00b962424a2c38b80e76acb) + +commit bb74017208cdefdbc397d8b2474b73bde70e29f9 +Author: Victor Seva +Date: Mon May 4 11:43:06 2026 +0200 + + ims_registrar_pcscf: Fix problems with double mem free, take three + + related #4671 + + * free params->data.ipsec always + + (cherry picked from commit 5f6dd0bb09fa33a07397902f9822fb5c1a370945) + +commit de4fc33ce90c3c11382eff3e8dc4789e0ec8c084 +Author: Victor Seva +Date: Mon May 4 11:40:10 2026 +0200 + + ims_ipsec_pcscf: Fix problems with double mem free, take three + + related #4670 + + * free paramas->data.ipsec always + + (cherry picked from commit c257ac9aeabadabc24be8e59dee6e85b74d556e2) + +commit 72e19957e2097b5a96ef50437dde9fae75077a63 +Author: Victor Seva +Date: Mon May 4 11:08:26 2026 +0200 + + ims_registrar_pcscf: Fix problems with double mem free, take two + + * include sec_header check + * don't free data.ipsec before + + related #4671 + + (cherry picked from commit 824dc0d39bf067ba343d7503b218e131a1944eea) + +commit e47d4792de562b767d0796662525da902b270df3 +Author: Victor Seva +Date: Mon May 4 11:07:33 2026 +0200 + + ims_ipsec_pcscf: Fix problems with double mem free, take two + + related #4670 + + (cherry picked from commit d6e94a640097f31e14df652b039f017a90f20872) + +commit d04659303e7fbfb55d0884dedc6dde6ceac7c51b +Author: Victor Seva +Date: Mon May 4 10:45:44 2026 +0200 + + ims_ipsec_pcscf: Fix problems with double mem free + + fix #4670 + + same logic as 91c5ca751799db4f25a28a495350cc97f7c2f390 + + (cherry picked from commit c7f290cc92760365af81f99c290a905d4e5c609c) + +commit 66e0b5075dc741095bf3439e76d25833f8f82e52 +Author: Victor Seva +Date: Mon May 4 10:51:36 2026 +0200 + + ims_registrar_pcscf: Fix problems with double mem free + + fix #4671 + + same logic as 91c5ca751799db4f25a28a495350cc97f7c2f390 + + (cherry picked from commit 722c06b3efc53ccb369ce812c685c7d069508187) + +commit 9717f03647e4caf9fea497ed8cfe7a301c03740a +Author: Kamailio Dev +Date: Sat May 2 02:31:19 2026 +0200 + + modules: readme files regenerated - modules ... [skip ci] + +commit d506359154f8b57cfd2be6971ab9383d7c791651 +Author: S-P Chan +Date: Thu Apr 30 22:10:01 2026 +0800 + + tls_wolfssl: fix CRL loading + + Addresses GH #4695 + + (cherry-picked from c522225058e0072eddf2573aab6cc4aff209ce17) + (cherry-picked from 4501854dfc13e145a19c30e522bac9882a63f626) + +commit a514b8e67a7cfb6c2a7c72c8cffc966ac9c3ada0 +Author: Federico Cabiddu +Date: Thu Apr 30 13:31:26 2026 +0200 + + http_async_client: fix remaining memory leaks and use-after-free in cell params + + (cherry picked from commit 779cf46e2565e96103223bf9040a30fe612a3748) + +commit 2487a98bc0becc507782fcef744d82124f2d77b2 +Author: S-P Chan +Date: Thu Apr 30 22:56:49 2026 +0800 + + db_mysql: handle MariaDB connector 3.4+ defaulting to SSL + + MariaDB Connector/C 3.4.0 changed the default behavior to enforce SSL. + We must now explicitly disable the SSL_ENFORCE and + VERIFY_SERVER_CERT options when opt_ssl_mode is set to 0 or 1. + + Addresses GH #4692 + + (cherry-picked from fe5521cf46b8608823a4c380ab2e161146e0b4a7) + +commit b155e5862aaefaa557044d79eeceed182da2a3e1 +Author: Federico Cabiddu +Date: Mon Apr 27 12:42:43 2026 +0200 + + http_async_client: fix memory leaks, use-after-free and NULL derefs + + (cherry picked from commit 269610690da4d0b920b6521c85f5aaa7d23fd4d5) + +commit d415049f8e94758d0df6fd17e7944ce5ee67f09a +Author: Adrian Bunk +Date: Mon Apr 13 18:54:54 2026 +0200 + + cmake: stop setting -march on arm + + From https://bugs.debian.org/cgi-bin/bugreport.cgi?att=1;bug=1132834;filename=kamailio-6.1.1-2.1-nmu.diff;msg=10 + Details at https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1132834 + + (cherry picked from commit 21c3e2ae3ea38f8ec495557a935ff50825d890e1) + + +===================== 2026-04-22 Version 6.1.2 Released ===================== + +===================== Changes Since Version 6.1.1 =========================== + +commit 6adfcf115ac36006a4b1c621587acd6cd0b25790 +Author: Daniel-Constantin Mierla +Date: Wed Apr 22 09:08:46 2026 +0200 + + src: version set to 6.1.2 + +commit 9b914ff01d83bfb2c3dd694c41399c9d1c89341e +Author: Daniel-Constantin Mierla +Date: Wed Apr 22 08:54:12 2026 +0200 + + pkg/kamailio: version set to 6.1.2 for rpms and alpine [skip ci] + +commit fcf5d89c11d437675bd299aaa9aceb042e15feba +Author: Victor Seva +Date: Wed Apr 22 08:42:19 2026 +0200 + + pkg/kamailio/deb: version set 6.1.2 [skip ci] + +commit 86323fa28e1aa75547cc43c2803b14030d1c00ae +Author: Daniel-Constantin Mierla +Date: Wed Apr 22 08:40:31 2026 +0200 + + src: removed CMakelists.notes + + (cherry picked from commit 97610b799890e317a5e0b53f462c96a419d28faf) + +commit 4529bcfa59e4292b95fd30c20a74b54eff8018b7 +Author: Loi Dang +Date: Fri Apr 17 17:41:56 2026 +0700 + + topos: restore port/transport in contact URI for contact_mode=0 + + In 6.1 the contact-building logic in tps_storage_fill_contact was + refactored into helper functions. The else branch (ctmode=0 SKEYUSER + and ctmode=3 XAVPHOST) was unified into a single append_host_info call + with append_port_proto=0, which silently dropped port and transport from + the generated contact URI for ctmode=0. + + In 6.0 the equivalent inline code always appended port and transport, + producing contacts like . ctmode=3 + (XAVPHOST) did not exist in 6.0, so its omission of port/transport is + intentional and is kept as-is. + + Fix: pass append_port_proto=1 for TPS_CONTACT_MODE_SKEYUSER only. + + Co-Authored-By: Claude Sonnet 4.6 + (cherry picked from commit fc204822831f2732ce07864e1d2213d2d3c30bd6) + +commit 1626393aac97e7665a34cc2a6853d018c8a28e09 +Author: Michael Furmur +Date: Wed Apr 1 02:10:52 2026 +0300 + + core: _tcpconn_find: fix protocol checking for tls_connection_match_domain + + (cherry picked from commit a4ddf14d894a4bbcb7fb169aab6235abf749f21a) + +commit 3c783894c6679aef52dec8a86bec7dcff3f814aa +Author: Michael Furmur +Date: Wed Apr 1 02:10:37 2026 +0300 + + tls_wolfssl: fix tls_h_match_domain_f connection matching + + (cherry picked from commit f67cf74db5ebc80a4affe42921bd525fbdbb2a1c) + +commit 5c5b348831632ba739228c372408d2d7d7835c2f +Author: Michael Furmur +Date: Wed Apr 1 02:10:23 2026 +0300 + + tls: fix tls_h_match_domain_f connection matching + + (cherry picked from commit 337ac691039588fda41a98d055f32ed25630447d) + +commit 9a927829635e597688246485872c2d110cc08e4d +Author: Tim Anderson +Date: Wed Apr 15 13:18:38 2026 +1000 + + siptrace: fix segfault when hep tracing in transaction mode + + - added checking that the trace_uri is not null + + (cherry picked from commit d56c61bf93798860721937c6cac42f63c4af1319) + +commit ffb4a62f8b62aa30d59c69f6c9ee610b54382eaa +Author: Daniel-Constantin Mierla +Date: Sun Apr 19 17:25:10 2026 +0200 + + tls: use SSL_CTX_set_ciphersuites() for TLS 1.3 ciphers from libssl 1.1.1 + + (cherry picked from commit 8ee596f6972ff52648c8fea6246ff20972b67e52) + +commit 6a41ed61fc3dc359e473a35b40f9786b33cd05df +Author: Xenofon Karamanos +Date: Fri Apr 17 14:05:20 2026 +0000 + + ims_qos: Validate length before copying + + (cherry picked from commit af1ae1d1e08a9880062882789bd1c7acb1077852) + +commit e5d17078f33fab286af8d8d097f85f093f8cb8e0 +Author: Xenofon Karamanos +Date: Fri Apr 17 13:19:00 2026 +0000 + + ims_usrloc_pcscf: Improve error handling + + (cherry picked from commit 5e012c7b6039ed2d8ec04eb7694670d0edce63d8) + +commit c68def4c8628d4a1895f7f3e31561089f6c41ff1 +Author: Maksim Nesterov +Date: Mon Apr 20 22:45:30 2026 +0200 + + http_async_client: freeing event upon request completion + + (cherry picked from commit 383f5fb9ec9943a5435fdc107638a512469648ef) + +commit 5a281a77ba2cc104dab294471904afaa6aae641e +Author: Daniel-Constantin Mierla +Date: Sun Apr 19 18:26:21 2026 +0200 + + Revert "core: dns - Fix lookup of multiple NAPTR entries" + + This reverts commit 723528c4f91a1601575d454ef7f56609423e7b89. + +commit 84ebaa20790fc61670bd4ed85ddea38e23cdb8b3 +Author: Kamailio Dev +Date: Sun Apr 19 09:46:18 2026 +0200 + + modules: readme files regenerated - modules ... [skip ci] + +commit 48481b0bd8515556ab8ba66ef1af240b8db742bc +Author: Daniel-Constantin Mierla +Date: Fri Apr 17 21:08:23 2026 +0200 + + tls_wolfssl: check IP address length in get_alt() + + (cherry picked from commit eb53aace0f9941cfdf4d90a7f8f49a4533bf8e30) + +commit 5b0ff2dc8b52652c1ee46bb3c4d0b3c2495bd03e +Author: Daniel-Constantin Mierla +Date: Fri Apr 17 21:03:40 2026 +0200 + + tls: check IP address length in get_alt() + + (cherry picked from commit 6a5cb97f2a89573fe2e8252f34fe9da100cbfa2c) + +commit 83b3614407b08b467eaa06a7dc83187f1fe5ae79 +Author: Daniel-Constantin Mierla +Date: Fri Apr 17 20:56:06 2026 +0200 + + auth_diameter: use digest user field when appending realm + + (cherry picked from commit a79e8ce6d2f31a599147766feb76dba8901a0d08) + +commit 7933e0d44e64f588165760f306116a6c0f5c5a8f +Author: Daniel-Constantin Mierla +Date: Fri Apr 17 20:48:30 2026 +0200 + + auth_radius: use digest user field when appending realm + + (cherry picked from commit 9e24a3764f5957102486e3d9834c210223809ddd) + +commit e375affe23482b528326742cbb9418fba3c58d0a +Author: Daniel-Constantin Mierla +Date: Thu Apr 16 06:31:40 2026 +0200 + + siprepo: keep the rcv structure + + (cherry picked from commit 596398dd56d7a084c338829e9225df4c033d309b) + +commit 8c3fb89cfc5c7b1022c97ca4b08d3ba00e7bf20b +Author: Daniel-Constantin Mierla +Date: Thu Apr 16 06:01:49 2026 +0200 + + siprepo: removed unused structure + + (cherry picked from commit 42859aa15638f89135cf82ea760e8ba123644184) + +commit e8da8a16aafe469088ade4d0a3400a05057d1428 +Author: Daniel-Constantin Mierla +Date: Wed Apr 15 18:04:31 2026 +0200 + + htable: check if item is still expired after event route execution + + - event route for expired item might prolong lifetime with new + assignment + + (cherry picked from commit 7d091e2f11e977e533691d5b76ec495a640831fb) + +commit 64bc9747ad61702c0c646ff9384092f85be76da6 +Author: Daniel-Constantin Mierla +Date: Wed Apr 15 17:20:21 2026 +0200 + + pv: remove unnecessary r-uri parsing for geting it and o-uri + + (cherry picked from commit fa57bb58431a950f3691a288704ba603fa7aa7d6) + +commit 584f7e803021e4e313dae992fe28d6e590d0af47 +Author: Daniel-Constantin Mierla +Date: Wed Apr 15 17:14:34 2026 +0200 + + kemix: remove unnecessary r-uri parsing for geting it and o-uri + + (cherry picked from commit 675fe2335097da0d9583f5ca8a5b045b9e6354a4) + +commit 9c7e8026fa997c2be7d085060a814905e50b02c5 +Author: timando +Date: Wed Apr 15 10:39:00 2026 +1000 + + kamctl: Fix incorrectly spelled variable name in kamdbctl.pgsql + + - Fixed incorrectly spelled variable name DBCLI from DBCMD + + (cherry picked from commit 52b384386f26dbf611e4846c03daab820d75e591) + +commit 961f460de37fe03ad8a05b7c1b519f8f88f323d6 +Author: Daniel-Constantin Mierla +Date: Mon Apr 13 21:36:36 2026 +0200 + + siprepo: removed unnecessary conditions on ack and cancel + + (cherry picked from commit fdb8ea0e788640c278c6cbd7bd9bf311cd5afa2a) + +commit 9b6ced91d198adea48b8afcb077f429f5a1a3ceb +Author: Daniel-Constantin Mierla +Date: Mon Apr 13 21:30:22 2026 +0200 + + siprepo: docs updated with the missing rmode param + + (cherry picked from commit ebff50f398aed798fc169630d13c7250e59979b5) + +commit 0fa7499ab82cff9f5c8f343c976ed59684c31bae +Author: Daniel-Constantin Mierla +Date: Mon Apr 13 21:17:00 2026 +0200 + + siprepo: proper fixup free for sr_msg_push() + + (cherry picked from commit 17608acc4411c75fbc5e4ca1a48278333e1e72cb) + +commit b8905f36d1f020479678df16dce3b6d573e398d0 +Author: Daniel-Constantin Mierla +Date: Fri Apr 10 11:03:23 2026 +0200 + + nathelper: reworked detection of no contact or star value + + (cherry picked from commit 15705a76e112b38ed782ed380c28ef5f8a3934a0) + +commit 69392c24e218f5890f7ecb509792f627bc559079 +Author: Daniel-Constantin Mierla +Date: Fri Apr 10 10:25:53 2026 +0200 + + nathlper: get contact uri detect star header value + + - GH #4683 + + (cherry picked from commit 38d013a578a2c03cf880fe4bb26394ec865ccd07) + +commit f783f3a141626967daf0c6c3b1f24c8bf8a471f2 +Author: Daniel-Constantin Mierla +Date: Fri Apr 10 08:53:21 2026 +0200 + + app_perl: Makefile - use $(shell ...) instead of backticks + + (cherry picked from commit 3f3701d19d2b0620e03d386286a4ab2c378b6986) + +commit 87c54f0d454f350ebab4e1415790e6b29acc939b +Author: Bastian Triller +Date: Wed Apr 1 14:02:42 2026 +0200 + + http_async_client: Add $http_time parameter to docs + + (cherry picked from commit ce087ee796a3b1a6751a8286018cb2e5601d8fac) + +commit 053b6500fdd112fef5ed2c5bd134556240c3f561 +Author: Juha Heinanen +Date: Sat Apr 18 11:34:09 2026 +0300 + + Revert "Receive patch for fail2ban" + + This reverts commit 5bd7f4ed3e3a47cab2d8d2246176e26374427b5c. + +commit 65968e4d4c9d74f692c8217871b536a5e0805b3a +Author: Juha Heinanen +Date: Sat Apr 18 11:32:51 2026 +0300 + + Revert "Build related changes" + + This reverts commit 4e4df33e7f8dcdbad001f4b2c35fe9633608d508. + +commit 3a54116a4e8ec265d51393d06f67d1a51ec480e8 +Author: Juha Heinanen +Date: Sat Apr 18 11:32:39 2026 +0300 + + Revert "Increase size of permissions hash table" + + This reverts commit cd8d60b71e1824426f0898097dcccb5a4c1c8dfb. + +commit f91338b298138df58e49537fd978dcaa92503572 +Author: Juha Heinanen +Date: Sat Apr 18 11:32:02 2026 +0300 + + Revert "Added local module" + + This reverts commit c50bbf6caffe2bbaa1d124402a992abb757e6d57. + +commit cd8d60b71e1824426f0898097dcccb5a4c1c8dfb +Author: Juha Heinanen +Date: Sat Apr 18 11:06:37 2026 +0300 + + Increase size of permissions hash table + +commit 5bd7f4ed3e3a47cab2d8d2246176e26374427b5c +Author: Juha Heinanen +Date: Sat Apr 18 11:02:16 2026 +0300 + + Receive patch for fail2ban + +commit 4e4df33e7f8dcdbad001f4b2c35fe9633608d508 +Author: Juha Heinanen +Date: Sat Apr 18 10:53:47 2026 +0300 + + Build related changes + +commit c50bbf6caffe2bbaa1d124402a992abb757e6d57 +Author: Juha Heinanen +Date: Sat Apr 18 10:53:32 2026 +0300 + + Added local module + +commit 835c2de86d599c90a5b03119730aff8c031ac34f +Author: S-P Chan +Date: Tue Apr 7 16:35:29 2026 +0800 + + tls_wolfssl: improve setup of DH tmp key + + Cherry-picked from 0caa84ab481abf8584bf67a79b09f4c46caeabd8 + +commit 1b48726e1cb6046e217f54d65295d337799e555c +Author: Sergey Safarov +Date: Thu Mar 5 00:12:07 2026 +0200 + + pkg/kamailio: packaged peerstate and ptimer modules + + (cherry picked from commit 387d33bd62f784020bd7d7f9b855d9bdadb2ac11) + +commit 7c6aeed89f713fa3fd86c6bd89daf1e4b5e4cb0f +Author: Victor Seva +Date: Tue Mar 31 10:46:25 2026 +0200 + + kamctl: clarify license [skip ci] + + * remove history lines from files + + (cherry picked from commit 99f121429b6f97cad647518bfebc7bc984108315) + +commit bc4919177557a48f697d85aa9d7f6def826dc7e4 +Author: Xenofon Karamanos +Date: Tue Mar 31 11:03:15 2026 +0000 + + ims_ocs: Fix typos in comments + + (cherry picked from commit 0eb01e0515c84314b0b7e334b348b331afeaf233) + +commit 612dc997579fa5e2f37deb7345705e2003a3a0ff +Author: Xenofon Karamanos +Date: Tue Mar 31 11:02:47 2026 +0000 + + ims_ocs: Add memory check + + (cherry picked from commit 53b47f5be5961dfca0142c74d549f7de5ce768b8) + +commit b886b6623dec905b817bfc4c09e095ce1f582312 +Author: Xenofon Karamanos +Date: Tue Mar 31 10:52:11 2026 +0000 + + ims_ocs: Free after copying the values + + - Remove extra freeavplist call + - Add len check + + (cherry picked from commit a56942affd35d41890c23f1d3b5bb519f87ef5ad) + +commit 079f5900bef55e16d5183a32fa6c9b48175900a0 +Author: Victor Seva +Date: Tue Mar 31 09:02:12 2026 +0200 + + pkg-kamailio-deb: restore libjwt-dev dependency [skip ci] + + (cherry picked from commit 274edebc23f4ea9789149b4864167a4a8d8b3c75) + +commit 594764afc935b8d0225afd16ff0c1d13567c2cda +Author: Victor Seva +Date: Tue Mar 31 08:51:43 2026 +0200 + + pkg/kamailio/deb: restore jwt on supported releases [skip ci] + + (cherry picked from commit d7d0752558821e9a7c19da985ea59ab66a7b29bf) + +commit e69384f016fde821c84bbf978b9b915028038c68 +Author: S-P Chan +Date: Tue Mar 31 08:52:55 2026 +0800 + + tls: fix builds with OpenSSL 3.0.x + + Cherry-picked from d139f421b85df86d7dbeb97d74c6c65626b2079d + +commit bbe1aa9fd6ff81f15208fb3252d431bc325810e4 +Author: S-P Chan +Date: Mon Mar 30 15:24:26 2026 +0800 + + tls: fix compilation on OpenSSL 1.1.1 + +commit f613089ae78e34b84f61fa29e4c379e900eda70b +Author: S-P Chan +Date: Sun Mar 29 15:51:48 2026 +0800 + + tls_wolfssl: use accessors for ASN1 + + Cherry-picked from 6c3807836f6deeefa29508b2a01e09d87a3bdbfc + +commit 701960a8a5c324d2585bf72e36aa809d71c75593 +Author: S-P Chan +Date: Sun Mar 29 15:19:52 2026 +0800 + + tls: fix compilation with OpenSSL 4 + + Replace direct field access with accessor functions/macros. + + Cherry-picked from 403c87522327e005e7387fc464519c8fa19c3719 + +commit 9a64f7580635f4b641c45810e9bbbc02f68bb282 +Author: Kamailio Dev +Date: Sun Mar 29 03:16:19 2026 +0200 + + modules: readme files regenerated - modules ... [skip ci] + +commit 912e14ec2631cf3abfadd0f2126ec713d3d91d64 +Author: S-P Chan +Date: Sat Mar 28 10:00:41 2026 +0800 + + tls: fix loading of providers in MP-mode in OpenSSL >= 3.3 + + - like engines in 1.1.1 we cannot use the config mechanism to + load in the child anymore + - provide a new parameter provider_quirks_config that points + to a provider configuration file + - required due to changes in OpenSSL 3.3+ + - updated docs + + Cherry-picked from b69fbf0001494fe45546c4f847364d34a40f8c57 + Cherry-picked from 6a038dc232ddb908c8c1c066bfa0c918fa3566f1 + +commit 02cdbb1d4e28ee587722ab6c04000f7530b4c385 +Author: Daniel-Constantin Mierla +Date: Wed Mar 25 14:36:17 2026 +0100 + + msrp: reformat initialized structures + + (cherry picked from commit 2c860b61afd0207e897f47a65e644c0b6a1c54d2) + +commit 6e4cd0366db49ecc59a987f8841aaa06417c409d +Author: Julien Chavanton +Date: Mon Mar 23 21:50:05 2026 -0400 + + textopsx: fix segfault in pv_get_hf_iterator_hname() + + Use correct array index [k] instead of [i] after loop exit. + Variable 'i' contains undefined value after the search loop completes, + causing segfault when dereferencing _hf_iterators[i].it->name. + + The loop finds the iterator at index i and stores it in k (line 2476), + but then incorrectly uses _hf_iterators[i] instead of _hf_iterators[k] + after the loop (lines 2486, 2489). + + Crash backtrace: + #0 pv_get_strval() - dereferencing invalid pointer + #1 pv_get_hf_iterator_hname() at textopsx.c:2489 + Passing garbage pointer &_hf_iterators[i].it->name where i is undefined + + This bug causes crashes when processing SIP replies with header iterators. + + (cherry picked from commit af593600fb7ae0297ce649ff099536aebf490134) + +commit f2edccb1df540f0b90184756df8802b349f354be +Author: Victor Seva +Date: Wed Mar 25 16:06:36 2026 +0100 + + pkg/kamailio/deb: missing nghttp2 module in rules [skip ci] + + (cherry picked from commit 2d9f3f0d3e5cf2a9151691c2c17850cdccb449a5) + +commit 6ea2d7fd96d98882f1a64a0a7ccfe4bf4a1bbdff +Author: Victor Seva +Date: Wed Mar 25 15:56:48 2026 +0100 + + pkg/kamailio/deb: add missing libnghttp2-dev build dependency [skip ci] + + (cherry picked from commit ab3342136f05ae27793388cfbbbdf5a4560f9638) + +commit 80f5817fe9013352634697602f0f8ec9db98e8a1 +Author: Victor Seva +Date: Wed Mar 25 15:49:48 2026 +0100 + + pkg/kamailio/deb: add nghttp2 module to extra package [skip ci] + + (cherry picked from commit 73e675504e6e1cddc4cb8766eaf34c5eca94c6ac) + +commit 741e4e9dc2fd335405997c9682588884639ab77d +Author: Kamailio Dev +Date: Wed Mar 25 12:31:18 2026 +0100 + + modules: readme files regenerated - modules ... [skip ci] + +commit a856aef46d536bb4d5dd13a04615cb0961ba551c +Author: Daniel-Constantin Mierla +Date: Tue Mar 24 11:10:43 2026 +0100 + + core: parser: guard conditions for limits on multipart body processing + + - GH #4656, GH #4657 + + (cherry picked from commit d20a5bae01f8eaa8e8fec271cd964d6e3b2fb694) + +commit e70e3da19b4230d8bd7a0ebde0e683861c7fcbd9 +Author: Daniel-Constantin Mierla +Date: Mon Mar 23 11:58:04 2026 +0100 + + siputils: find special chars with limit for set user/host functions + + - copy values with size to target buffer + + (cherry picked from commit f678332df50ec60a2fb4f587dcd40f217aec32b5) + +commit 87233d8aac1c67ff7445d7356321d33a5b05828b +Author: Daniel-Constantin Mierla +Date: Mon Mar 23 07:27:46 2026 +0100 + + nathelper: check size of built contact for select operation + + (cherry picked from commit 3c4746dc3873ce6766eb01fae598c47bbaaa5ea0) + +commit 5e7a360a7a5127395ebd81a77723c9ed06724cbe +Author: Daniel-Constantin Mierla +Date: Sun Mar 22 16:04:23 2026 +0100 + + dialog: skip other state tests on dlg clean run on a match + + (cherry picked from commit 6b5b97849c1cda9013ef4090809472e7aa047161) + +commit dd7588a07007daa151a0f764d2f8f47ba5c0937f +Author: Daniel-Constantin Mierla +Date: Sun Mar 22 15:46:47 2026 +0100 + + dialog: unref after dmq operation on dlg timeout + + (cherry picked from commit 1b723b4d3ec6df6cf721a3794998c7d2fcab9582) + +commit 9557d3e73f6e2e900e637400dae982291cd37063 +Author: Daniel-Constantin Mierla +Date: Sun Mar 22 11:03:23 2026 +0100 + + nathelper: check the length for alias ip and port + + (cherry picked from commit f2896a23725df88469faa89b1b864727d7bc6534) + +commit 2ec277a1566a73c313eeaf42842f56c640be2fcc +Author: Daniel-Constantin Mierla +Date: Sun Mar 22 10:41:19 2026 +0100 + + core: check boundaries - init lb size, keep reference to last boundary list item + + - rename local variable for clarity + + (cherry picked from commit 762ef9169a0aaabb74989494057d025383d0cb3f) + +commit 44809658f4d6506613c55fb9cfe63fb739381dbc +Author: Daniel-Constantin Mierla +Date: Sun Mar 22 09:32:21 2026 +0100 + + core: dns cname result - allocate space for full name + + (cherry picked from commit fa3587c929e53c37d37b3396511ee165f8affeff) + +commit 4328c00dda75d88af8a3f3ef1481fb133056b247 +Author: Daniel-Constantin Mierla +Date: Sat Mar 21 21:28:36 2026 +0100 + + msrp: use macro to append to buffer + + (cherry picked from commit 61f9db0a1ae8539ac9684ca8439ba975b881b540) + +commit 0a49e11b6c36d0b8d8530b51c697c12ef532c611 +Author: Daniel-Constantin Mierla +Date: Sat Mar 21 20:24:44 2026 +0100 + + pv: zero terminate s.replace transformation result + + - check the result length + + (cherry picked from commit 6d21462c7c3c53dd0fab772d6acf288ff2e4759c) + +commit 20c6869d960e0242144cea261eecc78cef35315a +Author: Daniel-Constantin Mierla +Date: Tue Mar 17 21:58:17 2026 +0100 + + dispatcher: small updates to log messages + + (cherry picked from commit 3000a0c29b7d872842822287dbc5fe55ca00d502) + +commit 7e1faa1b8739bcbb2f153a1d98eacdb85b567c57 +Author: Daniel-Constantin Mierla +Date: Tue Mar 17 09:20:02 2026 +0100 + + dispatcher: export ds_ping_fr_timer to match the docs + + (cherry picked from commit a1c8a3650143ae2c5a70455453a89d16f5a8fa66) + +commit 7f699ade41a6411f333fa683c0895251a86b8f00 +Author: Daniel-Constantin Mierla +Date: Mon Mar 16 22:23:29 2026 +0100 + + evapi: use the appropriate define for tag size + + (cherry picked from commit 14a0d12e1d6e441e3d57fabd8f8aa416d6907056) + +commit 4874edb13d2df6264c128e126185ef413dbeca5a +Author: Michael Furmur +Date: Mon Mar 16 18:08:37 2026 +0200 + + core: tcp_main: do not check tls domain for non-tls connections + + (cherry picked from commit e1a8b303d9d46fa29c4da44b824fac83e518b29f) + +commit 5bb4fe0ac48aa1f9bdca51da242a7684419b5b87 +Author: Daniel-Constantin Mierla +Date: Sat Mar 14 22:08:38 2026 +0100 + + tm: uac build - use bracket condtion also for length + + (cherry picked from commit 311157f86c6707be68258df7537345cc8075f90b) + +commit e68cb00c6463d8e27e5eef85248cdcfad210301d +Author: S-P Chan +Date: Sat Mar 14 22:51:49 2026 +0800 + + tm: fix uninitialized variables tdname/fdname in build_uac_req() + + This caused a garbage (very large or negative) value to be passed to + shm_malloc(), resulting in allocation failure for any UAC-initiated + request with no display names in From/To headers - most visibly + dispatcher health check pings (OPTIONS/INFO). + + Introduced by: 2cc287dff638ea65aca3bf9fd55377f519bcab3f + ("tm: uac - keep the display name set via rpc") + + Fix: initialize tdname and fdname to 0 at declaration. + + Co-authored-by: Claude Sonnet 4.6 + (cherry picked from commit 6cc6b34f18e252f70501bb53d7dd38a326016406) + +commit 07cd43c63702dbee7380b0204320d09d3540a852 +Author: Norm Brandinger +Date: Tue Mar 10 00:10:35 2026 -0400 + + rtpengine: fix NULL pv_spec_t dereference in DTMF event handling + + Guard all pv_spec_t setf() calls in rtpengine_raise_dtmf_event() + with NULL checks. When DTMF event pvars are not configured via + modparams, the corresponding pv_spec_t pointers remain NULL, causing + a segfault when rtpengine sends a DTMF notification. + + Co-Authored-By: Claude Opus 4.6 + (cherry picked from commit 4767914ff7e29771ca4261dea38e8dff2b5dd3d2) + +commit dfb88b390df2979234f587f75b43f2b8deb02853 +Author: Alex Hermann +Date: Thu Mar 12 16:36:32 2026 +0100 + + rtpengine: Fix memory leak due to overwriting nodes + + idx should not get reset within the outer loop as it will cause overwriting + of earlier nodes and leaking their mem. + + (cherry picked from commit 80ae09ba669f5dba3b02a91c0ef19934843ee412) + +commit 5fd4473ec1574c30e9300261e029da90e657d9e5 +Author: Daniel-Constantin Mierla +Date: Thu Mar 12 07:18:24 2026 +0100 + + tm: uac - keep the display name set via rpc + + (cherry picked from commit 2cc287dff638ea65aca3bf9fd55377f519bcab3f) + +commit 3efa3ec85cf0d23060bb278366fc5a3a7419228f +Author: Daniel-Constantin Mierla +Date: Tue Mar 10 17:54:12 2026 +0100 + + jsonrpcs: docs for transports and store_path field + + (cherry picked from commit 8ef9cedc1609ec519fbd029a70960fc27abbf37d) + +commit 723528c4f91a1601575d454ef7f56609423e7b89 +Author: Kilian Wöber +Date: Thu Jan 29 15:31:48 2026 +0100 + + core: dns - Fix lookup of multiple NAPTR entries + + - Allow storing NAPTR entries in dns_srv_handle + - When resolving NAPTR, try to reuse entry after initial lookup + + (cherry picked from commit 34844f3b235235c9d44681f89098893967e3b408) + +commit 5bc12fc123958eda051ba4f4259664b78f632132 +Author: Victor Seva +Date: Mon Mar 9 18:52:02 2026 +0100 + + app_lua: [cmake] set missing LUA_INCLUDE_DIR when using PkgConfig + + > https://cmake.org/cmake/help/latest/module/FindPkgConfig.html + + (cherry picked from commit e54590d8758c978a452050a969db078fa3de2fdd) + +commit dbddf8989518dd374290bd59805e30039b93250d +Author: Victor Seva +Date: Mon Mar 9 14:16:32 2026 +0100 + + app_lua: [cmake] use proper lua include var + + > https://cmake.org/cmake/help/latest/module/FindLua.html + + (cherry picked from commit 2ccd8a1183690693038606735292e8586d325704) + +commit 12db0455efc88dc16f6ad799a59c8badcad1205f +Author: Victor Seva +Date: Mon Mar 9 12:53:16 2026 +0100 + + app_lua: cmake fix for detect lua5.5 + + (cherry picked from commit 876b2d1d579c0386fe1c17faa4dd6fdb871889f4) + +commit c71f6d37f658645c8563d85a644a032d09905b2c +Author: Joey Golan +Date: Sun Mar 8 08:12:34 2026 +0200 + + tls: fix segfault on musl libc due to uninitialized pthread TSD + + On musl libc (Alpine Linux), pthread thread-specific data (TSD) for + the main thread is not initialized until pthread_key_create() is + called at least once. The diagnostic loop in mod_init() calls + pthread_getspecific() with raw integer keys 0-31 before any key has + been created, causing a NULL pointer dereference on musl. + + Force TSD initialization by creating and immediately deleting a + pthread key before the diagnostic loop. + + Fixes: kamailio/kamailio-ci#20 + Related: #4534 + Made-with: Cursor + (cherry picked from commit d53dc5ab9b95b82a2e8769351d77e33ce8d43bb7) + +commit a24d88c19f68d9a94509aac83fd2d4679389e6d3 +Author: Xenofon Karamanos +Date: Tue Mar 24 13:48:48 2026 +0000 + + presence: Validate watcher URI length before copying + + (cherry picked from commit e134644d16ea54c17598e880f1cc791715f4ea31) + +commit 194343ba282a4fd52d0ca0b382f14098cfc0ce49 +Author: Xenofon Karamanos +Date: Mon Mar 23 17:01:41 2026 +0000 + + cdp: copy data before freeing + + (cherry picked from commit d08376c33ee97613eb99b00405af86b5dba45738) + +commit 77422bf8cc4a75317cb26669b9bc41dfed744c09 +Author: Xenofon Karamanos +Date: Tue Mar 24 15:39:41 2026 +0000 + + ims_charging: Free avp after traversing + + (cherry picked from commit 8d71214cddf1a82b229e0fb0ab11139878536178) + +commit f1a333b37bce0b6f4f1b177813a7d144ec252d97 +Author: Xenofon Karamanos +Date: Tue Mar 24 11:14:42 2026 +0000 + + cmake: Add back missing definitions + + - b4df3a4e9 removed some definition by mistake + +commit 03458f22adc4cb65858430d39bbf8fa88fd4f8c6 +Author: Victor Seva +Date: Fri Mar 6 16:20:57 2026 +0100 + + pkg/kamailio/deb: compile app_lua with the highest available Lua version [skip ci] + + (cherry picked from commit c49662d5cadf22a7612709d55c7bb0fd76dc05c2) + +commit 84de956799df6ee4f4c7bb46249f1477f334111e +Author: Victor Seva +Date: Mon Mar 16 08:54:51 2026 +0100 + + cmake: don't add executable perms to kamctl/kamctl.* files + + > W: kamailio: executable-not-elf-or-script [usr/lib/x86_64-linux-gnu/kamailio/kamctl/kamctl.base] + + (cherry picked from commit bbf67a6d94427da38d32b361e15175bce3d2195f) + +commit 02a444451598eef26481af781e047c62adc6ce14 +Author: S-P Chan +Date: Thu Mar 12 16:37:00 2026 +0800 + + tls: fix $tls_my_subject/$tls_peer_subject always returning null + + The PVs $tls_my_subject, $tls_my_issuer, $tls_peer_subject and + $tls_peer_issuer are registered with pv_comp() as their getter with + only PV_CERT_{LOCAL,PEER}|PV_CERT_{SUBJECT,ISSUER} flags — no + PV_COMP_* bit. After pv_comp() strips the cert/subject flags, + ind_local becomes 0, hitting the default: branch which sets + nid=NID_undef. get_comp() then called X509_NAME_get_index_by_NID() + with NID_undef which always returns -1, causing all four PVs to + silently return null regardless of the certificate content. + + Fix by handling NID_undef in get_comp() as a request for the full + distinguished name, using X509_NAME_oneline() to return the complete + subject or issuer string (e.g. /O=Example/CN=host.example.com). + + Cherry-picked from 86549be22f92442c192281bedcce1c3a1f80cac1 + +commit f1a6e0c8a05d658c4f3fab5a58d57e91d3236e44 +Author: Norm Brandinger +Date: Mon Mar 9 23:46:18 2026 -0400 + + core: fix swapped comparison in atomic_stdatomic.h dec/inc_and_test + + atomic_fetch_sub_explicit() returns the value BEFORE the subtraction. + To test whether the result reached zero, dec_and_test must compare the + old value against 1 (old=1, new=1-1=0). The code compared against -1, + which can never be true for a positive refcount, so the "reached zero" + condition was never triggered. + + The symmetric bug existed in inc_and_test: it compared the pre-increment + value against 1 instead of -1. + + This affected all 8 _and_test functions (int/long x relaxed/seq_cst). + + The practical impact is that any refcount-guarded free (TM transactions, + TCP connections, DNS cache entries, config blocks, WebSocket connections) + never fired on aarch64, causing shared memory to leak monotonically. + + Fixes: #4626 + + Co-Authored-By: Claude Opus 4.6 + (cherry picked from commit 79f5265057c99a6058bb92a3c0992fa1b9b0c121) + +commit acd0b07537a0f838da7e0003d032b1626756a654 +Author: Bastian Triller +Date: Fri Mar 13 20:44:02 2026 +0100 + + dialog: Check for Via header + + (cherry picked from commit 8f1565799c8ba55805005a3e4880d7b9808c6fc8) + +commit b97ca6ff380060e5c2ce5385dc87da627c6be231 +Author: Xenofon Karamanos +Date: Thu Mar 5 10:59:30 2026 +0000 + + cmake: Update dbschema generation flow + + - dbschema will build schema files into db files and copy them to source directory + + - install will copy source tree files (utils/kamctl/db*) to install folder + + (cherry picked from commit 9631c04c09fa128718ecd0fa0cb614188625fafd) + +commit 1a6cea4a43b9aa02a29aa80b4ee1f5ead3209995 +Author: Boris Korzun +Date: Mon Mar 9 16:37:36 2026 +0300 + + phonenum: cmake: Fix a typo + + (cherry picked from commit a898ee597e959cfe288853ed3521e7afb8e45e75) + +commit 4dbc6b328ba063cca6005819b845dfb15871b15a +Author: Xenofon Karamanos +Date: Fri Jan 30 13:02:41 2026 +0000 + + websocket: cmake: Use find_package to find unistring + + (cherry picked from commit f0437e30ce60fdbab1f56963ca15d04c9da43c30) + +commit 02643327bd18718a77c902d7aef8ad95919c0267 +Author: Xenofon Karamanos +Date: Fri Jan 30 14:16:44 2026 +0000 + + cmake: Add unistring module + + - Add as a find_package to allow easier custom installs + + (cherry picked from commit 46302eb4f5d7b2c0e85f19ff09a25fc9c74a2712) + +commit 02299bb855c5e82e20044ca52e5334219ceb78a4 +Author: Daniel-Constantin Mierla +Date: Thu Mar 5 16:32:50 2026 +0100 + + tm: remove unused define for mi fifo + + (cherry picked from commit 7b67d5a719b7ba0f5a34360e4713425a85911613) + +commit c116205815df569fb40d01b989a4958a12bf0710 +Author: Daniel-Constantin Mierla +Date: Thu Mar 5 17:06:22 2026 +0100 + + tm: disable char substitution for tm uac rpc + + - undocumented unexpected behaviour + - can be enabled with compile option (considered to be modparam if + needed) + + (cherry picked from commit 6796c967ab07616a9e749858de58f5e920ea9fdf) + +commit 361c7ac0dc35f9907bcb1e151c0cc6e7971367d8 +Author: Joel Serrano +Date: Fri Jan 30 01:38:30 2026 -0800 + + xhttp_prom: include global tags in user-defined metrics + + (cherry picked from commit 9f7838561daece724a9fa877cd140f744c81d452) + + ===================== 2026-03-04 Version 6.1.1 Released ===================== ===================== Changes Since Version 6.1.0 =========================== diff --git a/cmake/compiler-specific.cmake b/cmake/compiler-specific.cmake index c9addf33f..7af181b4c 100644 --- a/cmake/compiler-specific.cmake +++ b/cmake/compiler-specific.cmake @@ -188,9 +188,7 @@ elseif(TARGET_ARCH STREQUAL "arm7") target_compile_definitions(common_compiler_flags INTERFACE CC_GCC_LIKE_ASM) # ARM specific flags - target_compile_options( - common_compiler_flags INTERFACE -march=armv7-a -funroll-loops -fsigned-char - ) + target_compile_options(common_compiler_flags INTERFACE -funroll-loops -fsigned-char) if(CMAKE_C_COMPILER_VERSION VERSION_GREATER 4.2.0) target_compile_options(common_compiler_flags INTERFACE -ftree-vectorize -fno-strict-overflow) elseif(CMAKE_C_COMPILER_VERSION VERSION_GREATER 4.0) @@ -206,9 +204,7 @@ elseif(TARGET_ARCH STREQUAL "arm7") elseif(TARGET_ARCH STREQUAL "arm6") if(CMAKE_C_COMPILER_ID STREQUAL "GNU") target_compile_definitions(common_compiler_flags INTERFACE CC_GCC_LIKE_ASM) - target_compile_options( - common_compiler_flags INTERFACE -march=armv6 -funroll-loops -fsigned-char - ) + target_compile_options(common_compiler_flags INTERFACE -funroll-loops -fsigned-char) if(CMAKE_C_COMPILER_VERSION VERSION_GREATER 4.2.0) target_compile_options(common_compiler_flags INTERFACE -ftree-vectorize -fno-strict-overflow) elseif(CMAKE_C_COMPILER_VERSION VERSION_GREATER 4.0) @@ -226,9 +222,7 @@ elseif(TARGET_ARCH STREQUAL "arm") target_compile_definitions(common_compiler_flags INTERFACE CC_GCC_LIKE_ASM) # ARM specific flags - target_compile_options( - common_compiler_flags INTERFACE -marm -march=armv5t -funroll-loops -fsigned-char - ) + target_compile_options(common_compiler_flags INTERFACE -marm -funroll-loops -fsigned-char) if(CMAKE_C_COMPILER_VERSION VERSION_GREATER 4.2.0) target_compile_options(common_compiler_flags INTERFACE -ftree-vectorize -fno-strict-overflow) elseif(CMAKE_C_COMPILER_VERSION VERSION_GREATER 4.0) diff --git a/cmake/db_files.cmake b/cmake/db_files.cmake index 89ea86129..cb8c04057 100644 --- a/cmake/db_files.cmake +++ b/cmake/db_files.cmake @@ -33,7 +33,7 @@ function(add_db_files group_name file kamctl) set_property(GLOBAL APPEND PROPERTY KAMDBCTL_DEPENDENCIES "kamdbctl_${file}") endif() install( - PROGRAMS ${CMAKE_BINARY_DIR}/utils/kamctl/${file} + FILES ${CMAKE_BINARY_DIR}/utils/kamctl/${file} DESTINATION ${CMAKE_INSTALL_LIBDIR}/${MAIN_NAME}/kamctl COMPONENT ${group_name} ) diff --git a/cmake/dbschema.cmake b/cmake/dbschema.cmake index b557ad578..5e2b745a0 100644 --- a/cmake/dbschema.cmake +++ b/cmake/dbschema.cmake @@ -28,6 +28,7 @@ function(add_db_target db_name xsl_file) endif() find_group_name(${db_name_folder}) + # message(WARNING "group name is ${group_name}") add_custom_target( dbschema_${db_name} @@ -119,14 +120,25 @@ function(add_db_target db_name xsl_file) add_dependencies(dbschema dbschema_${db_name}) add_dependencies(dbschema_clean dbschema_${db_name}_clean) - # message(WARNING "group name is ${group_name}") - # Before installing, ensure the target is built `dbschema_${db_name}` - # install as previously done in makefile folder. see naming above - # TODO: when tools adopt to new folder structure, replace the install_folder variable - # with ${db_name_folder} + # When a schema file is updated, we should run the `dbschema_${db_name}` + # target to update the generated schema files in the source directory. + # TODO: when tools adopt to new folder structure, replace the install_folder + # variable with ${db_name_folder} + + # Copy the generated schema files to the source directory + add_custom_command( + TARGET dbschema_${db_name} + POST_BUILD + COMMAND + ${CMAKE_COMMAND} -E copy_directory + "${CMAKE_BINARY_DIR}/utils/kamctl/${db_name_folder}/${folder_suffix}" + "${CMAKE_SOURCE_DIR}/utils/kamctl/${install_folder}/${folder_suffix}" + COMMENT "Copying generated schema files for ${db_name} to source directory" + ) + # Install from source tree (should always be up to date) install( - DIRECTORY ${CMAKE_BINARY_DIR}/utils/kamctl/${db_name_folder}/ + DIRECTORY ${CMAKE_SOURCE_DIR}/utils/kamctl/${install_folder}/ DESTINATION ${CMAKE_INSTALL_DATADIR}/${MAIN_NAME}/${install_folder} OPTIONAL COMPONENT ${group_name} diff --git a/cmake/modules/FindUnistring.cmake b/cmake/modules/FindUnistring.cmake new file mode 100644 index 000000000..9303146b7 --- /dev/null +++ b/cmake/modules/FindUnistring.cmake @@ -0,0 +1,31 @@ +# https://github.com/fsaric/libsentences/blob/master/cmake/FindUnistring.cmake +# - Find UNISTRING +# Find the unistring includes and library +# +# Unistring_INCLUDE_DIRS - where to find unistr.h, etc. +# Unistring_LIBRARIES - unistring library. +# Unistring_FOUND - True if unistring found. +# +# Hints: +# Unistring_ROOT=/path/to/unistring/installation + +find_path(Unistring_INCLUDE_DIRS unistr.h DOC "Path to unistring include directory") + +find_library( + Unistring_LIBRARIES + NAMES unistring libunistring + DOC "Path to unistring library" +) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(Unistring DEFAULT_MSG Unistring_LIBRARIES Unistring_INCLUDE_DIRS) + +# Create the Unistring::Unistring imported target +if(Unistring_FOUND) + add_library(Unistring::Unistring UNKNOWN IMPORTED) + set_target_properties( + Unistring::Unistring PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${Unistring_INCLUDE_DIRS}" + IMPORTED_LOCATION "${Unistring_LIBRARIES}" + ) +endif() +mark_as_advanced(Unistring_LIBRARIES Unistring_INCLUDE_DIRS) diff --git a/cmake/os-specific/linux.cmake b/cmake/os-specific/linux.cmake index b96b406ab..c3dfa6365 100644 --- a/cmake/os-specific/linux.cmake +++ b/cmake/os-specific/linux.cmake @@ -17,6 +17,20 @@ target_compile_definitions( target_link_libraries(common INTERFACE ${CMAKE_DL_LIBS} resolv) target_link_libraries(common_utils INTERFACE resolv) +if(NOT NO_SELECT) + target_compile_definitions(common INTERFACE HAVE_SELECT) +endif() + +# TODO introduce check for epoll +if(NOT NO_EPOLL) + target_compile_definitions(common INTERFACE HAVE_EPOLL) +endif() + +# TODO introduce check for sigio +if(NOT NO_SIGIO_RT) + target_compile_definitions(common INTERFACE HAVE_SIGIO_RT SIGINFO64_WORKAROUND) +endif() + if(${RAW_SOCKS}) target_compile_definitions(common INTERFACE USE_RAW_SOCKS) endif() diff --git a/pkg/kamailio/alpine/APKBUILD b/pkg/kamailio/alpine/APKBUILD index d5845770d..a1e079637 100644 --- a/pkg/kamailio/alpine/APKBUILD +++ b/pkg/kamailio/alpine/APKBUILD @@ -5,7 +5,7 @@ # Maintainer: Nathan Angelacos pkgname=kamailio -pkgver=6.1.1 +pkgver=6.1.3 pkgrel=0 # If building from a git snapshot, specify the gitcommit diff --git a/pkg/kamailio/deb/bookworm/changelog b/pkg/kamailio/deb/bookworm/changelog index 9069c16c6..cd4511ca0 100644 --- a/pkg/kamailio/deb/bookworm/changelog +++ b/pkg/kamailio/deb/bookworm/changelog @@ -1,3 +1,15 @@ +kamailio (6.1.3) unstable; urgency=medium + + * version set 6.1.3 + + -- Victor Seva Wed, 27 May 2026 13:23:19 +0200 + +kamailio (6.1.2) unstable; urgency=medium + + * version set 6.1.2 + + -- Victor Seva Wed, 22 Apr 2026 08:41:27 +0200 + kamailio (6.1.1) unstable; urgency=medium * version set 6.1.1 diff --git a/pkg/kamailio/deb/bookworm/control b/pkg/kamailio/deb/bookworm/control index 9a1f3bb85..a10ff6a9f 100644 --- a/pkg/kamailio/deb/bookworm/control +++ b/pkg/kamailio/deb/bookworm/control @@ -25,7 +25,7 @@ Build-Depends: libjansson-dev, libjson-c-dev, libldap2-dev, - liblua5.1-0-dev, + liblua5.4-dev, libmaxminddb-dev, libmemcached-dev, libmicrohttpd-dev, @@ -34,6 +34,7 @@ Build-Depends: libmosquitto-dev, libnats-dev, libncurses-dev, + libnghttp2-dev, libpcre2-dev, libperl-dev, libphonenumber-dev (>= 7), @@ -83,7 +84,6 @@ Replaces: kamailio-carrierroute-modules, Suggests: kamailio-cpl-modules, - kamailio-dbg, kamailio-ldap-modules, kamailio-lua-modules, kamailio-mysql-modules, @@ -124,24 +124,6 @@ Description: very fast, dynamic and configurable SIP server This package contains the main Kamailio binary along with the principal modules and support binaries. -Package: kamailio-dbg -Priority: extra -Section: debug -Architecture: any -Multi-Arch: same -Pre-Depends: - ${misc:Pre-Depends}, -Depends: - kamailio (= ${binary:Version}), - ${misc:Depends}, -Description: very fast and configurable SIP server [debug symbols] - Kamailio is a very fast and flexible SIP (RFC3261) - server. Written entirely in C, Kamailio can handle thousands calls - per second even on low-budget hardware. - . - This package contains the debugging symbols for the Kamailio binaries and - modules. You only need to install it if you need to debug Kamailio. - Package: kamailio-geoip2-modules Architecture: any Multi-Arch: same @@ -861,7 +843,9 @@ Description: Extra modules for the Kamailio SIP Server . This package provides a set of modules for compression of SIP attachments, UUID usage, JSON data structure support, HTTP restful API asynchronous - access and a few more functions: gzcompress uuid evapi jansson janssonrpcc http_async_client + access and a few more functions: + . + gzcompress uuid evapi jansson janssonrpcc http_async_client nghttp2 Package: kamailio-nth Architecture: any diff --git a/pkg/kamailio/deb/bookworm/kamailio-extra-modules.cmake-components b/pkg/kamailio/deb/bookworm/kamailio-extra-modules.cmake-components index 6686c7f12..2e4ee136c 100644 --- a/pkg/kamailio/deb/bookworm/kamailio-extra-modules.cmake-components +++ b/pkg/kamailio/deb/bookworm/kamailio-extra-modules.cmake-components @@ -3,3 +3,4 @@ KGZCOMPRESS KJANSSON KUUID KHTTP_ASYNC +KNGHTTP2 diff --git a/pkg/kamailio/deb/bookworm/rules b/pkg/kamailio/deb/bookworm/rules index d09b6fdb3..ef9f499c6 100755 --- a/pkg/kamailio/deb/bookworm/rules +++ b/pkg/kamailio/deb/bookworm/rules @@ -95,6 +95,7 @@ EXTRA_GROUPS += gzcompress EXTRA_GROUPS += jansson EXTRA_GROUPS += uuid EXTRA_GROUPS += http_async +EXTRA_GROUPS += nghttp2 INSTALL_MODULES := $(addprefix install_, $(PACKAGE_GROUPS)) diff --git a/pkg/kamailio/deb/bookworm/source.lintian-overrides b/pkg/kamailio/deb/bookworm/source.lintian-overrides deleted file mode 100644 index 620d9ffdd..000000000 --- a/pkg/kamailio/deb/bookworm/source.lintian-overrides +++ /dev/null @@ -1 +0,0 @@ -kamailio source: debian-watch-file-in-native-package diff --git a/pkg/kamailio/deb/bookworm/watch b/pkg/kamailio/deb/bookworm/watch deleted file mode 100644 index 202b656a4..000000000 --- a/pkg/kamailio/deb/bookworm/watch +++ /dev/null @@ -1,3 +0,0 @@ -version=3 -opts=dversionmangle=s/\~svn([\d]+)//; \ -https://www.kamailio.org/pub/kamailio/([\d.]+)/src/kamailio-([\d.]+)_src\.tar\.gz diff --git a/pkg/kamailio/deb/bullseye/changelog b/pkg/kamailio/deb/bullseye/changelog index 9069c16c6..cd4511ca0 100644 --- a/pkg/kamailio/deb/bullseye/changelog +++ b/pkg/kamailio/deb/bullseye/changelog @@ -1,3 +1,15 @@ +kamailio (6.1.3) unstable; urgency=medium + + * version set 6.1.3 + + -- Victor Seva Wed, 27 May 2026 13:23:19 +0200 + +kamailio (6.1.2) unstable; urgency=medium + + * version set 6.1.2 + + -- Victor Seva Wed, 22 Apr 2026 08:41:27 +0200 + kamailio (6.1.1) unstable; urgency=medium * version set 6.1.1 diff --git a/pkg/kamailio/deb/bullseye/control b/pkg/kamailio/deb/bullseye/control index c6a9fac2a..bd11e7859 100644 --- a/pkg/kamailio/deb/bullseye/control +++ b/pkg/kamailio/deb/bullseye/control @@ -25,7 +25,7 @@ Build-Depends: libjansson-dev, libjson-c-dev, libldap2-dev, - liblua5.1-0-dev, + liblua5.4-dev, libmaxminddb-dev, libmemcached-dev, libmicrohttpd-dev, @@ -33,6 +33,7 @@ Build-Depends: libmongoc-dev, libmosquitto-dev, libncurses5-dev, + libnghttp2-dev, libpcre2-dev, libperl-dev, libphonenumber-dev (>= 7), @@ -85,7 +86,6 @@ Replaces: kamailio-carrierroute-modules, Suggests: kamailio-cpl-modules, - kamailio-dbg, kamailio-ldap-modules, kamailio-lua-modules, kamailio-mysql-modules, @@ -126,24 +126,6 @@ Description: very fast, dynamic and configurable SIP server This package contains the main Kamailio binary along with the principal modules and support binaries. -Package: kamailio-dbg -Priority: extra -Section: debug -Architecture: any -Multi-Arch: same -Pre-Depends: - ${misc:Pre-Depends}, -Depends: - kamailio (= ${binary:Version}), - ${misc:Depends}, -Description: very fast and configurable SIP server [debug symbols] - Kamailio is a very fast and flexible SIP (RFC3261) - server. Written entirely in C, Kamailio can handle thousands calls - per second even on low-budget hardware. - . - This package contains the debugging symbols for the Kamailio binaries and - modules. You only need to install it if you need to debug Kamailio. - Package: kamailio-geoip2-modules Architecture: any Multi-Arch: same @@ -862,7 +844,9 @@ Description: Extra modules for the Kamailio SIP Server . This package provides a set of modules for compression of SIP attachments, UUID usage, JSON data structure support, HTTP restful API asynchronous - access and a few more functions: gzcompress uuid evapi jansson janssonrpcc http_async_client + access and a few more functions: + . + gzcompress uuid evapi jansson janssonrpcc http_async_client nghttp2 Package: kamailio-nth Architecture: any diff --git a/pkg/kamailio/deb/bullseye/kamailio-extra-modules.cmake-components b/pkg/kamailio/deb/bullseye/kamailio-extra-modules.cmake-components index 6686c7f12..2e4ee136c 100644 --- a/pkg/kamailio/deb/bullseye/kamailio-extra-modules.cmake-components +++ b/pkg/kamailio/deb/bullseye/kamailio-extra-modules.cmake-components @@ -3,3 +3,4 @@ KGZCOMPRESS KJANSSON KUUID KHTTP_ASYNC +KNGHTTP2 diff --git a/pkg/kamailio/deb/bullseye/rules b/pkg/kamailio/deb/bullseye/rules index dbed84e7a..d53328297 100755 --- a/pkg/kamailio/deb/bullseye/rules +++ b/pkg/kamailio/deb/bullseye/rules @@ -95,6 +95,7 @@ EXTRA_GROUPS += gzcompress EXTRA_GROUPS += jansson EXTRA_GROUPS += uuid EXTRA_GROUPS += http_async +EXTRA_GROUPS += nghttp2 INSTALL_MODULES := $(addprefix install_, $(PACKAGE_GROUPS)) diff --git a/pkg/kamailio/deb/bullseye/source.lintian-overrides b/pkg/kamailio/deb/bullseye/source.lintian-overrides deleted file mode 100644 index 620d9ffdd..000000000 --- a/pkg/kamailio/deb/bullseye/source.lintian-overrides +++ /dev/null @@ -1 +0,0 @@ -kamailio source: debian-watch-file-in-native-package diff --git a/pkg/kamailio/deb/bullseye/watch b/pkg/kamailio/deb/bullseye/watch deleted file mode 100644 index 202b656a4..000000000 --- a/pkg/kamailio/deb/bullseye/watch +++ /dev/null @@ -1,3 +0,0 @@ -version=3 -opts=dversionmangle=s/\~svn([\d]+)//; \ -https://www.kamailio.org/pub/kamailio/([\d.]+)/src/kamailio-([\d.]+)_src\.tar\.gz diff --git a/pkg/kamailio/deb/debian/backports/bookworm b/pkg/kamailio/deb/debian/backports/bookworm index 4c033328a..e46432c14 100755 --- a/pkg/kamailio/deb/debian/backports/bookworm +++ b/pkg/kamailio/deb/debian/backports/bookworm @@ -20,7 +20,8 @@ sed -i -e '/lsb-base/d' ${DIST}/control sed -i -e 's/libncurses5-dev/libncurses-dev/g' ${DIST}/control # libjwt < 1.12 -sed -i -e '/libjwt-dev/d' -e 's/, JWT (JSON Web Token)//' ${DIST}/control +sed -i -e '/libjwt-dev/d' -e 's/, JWT (JSON Web Token)//' \ + -e 's/ jwt//' ${DIST}/control sed -i -e '/^EXTRA_GROUPS += jwt$/d' ${DIST}/rules sed -i -e '/KJWT/d' ${DIST}/kamailio-extra-modules.cmake-components @@ -31,6 +32,9 @@ sed -i -e '/^ libsecp256k1-dev,/d' \ sed -i -e '/^PACKAGE_GROUPS += auth_blockchain$/d' ${DIST}/rules sed -i -e '/--EXCLUDED--/i EXTRA_EXCLUDED_MODULES += auth_blockchain' ${DIST}/rules +# latest higher lua version available +sed -i -e 's/liblua5.5-dev/liblua5.4-dev/g' ${DIST}/control + wrap-and-sort -sat -d ${DIST} # clean backports scripts diff --git a/pkg/kamailio/deb/debian/backports/bullseye b/pkg/kamailio/deb/debian/backports/bullseye index 8a3cdf095..38fd3be53 100755 --- a/pkg/kamailio/deb/debian/backports/bullseye +++ b/pkg/kamailio/deb/debian/backports/bullseye @@ -24,7 +24,8 @@ sed -i -e '/^PACKAGE_GROUPS += tls_wolfssl/d' ${DIST}/rules sed -i -e '/--EXCLUDED--/i EXTRA_EXCLUDED_MODULES += tls_wolfssl' ${DIST}/rules # libjwt < 1.12 -sed -i -e '/libjwt-dev/d' -e 's/, JWT (JSON Web Token)//' ${DIST}/control +sed -i -e '/libjwt-dev/d' -e 's/, JWT (JSON Web Token)//' \ + -e 's/ jwt//' ${DIST}/control sed -i -e '/^EXTRA_GROUPS += jwt$/d' ${DIST}/rules sed -i -e '/KJWT/d' ${DIST}/kamailio-extra-modules.cmake-components @@ -35,6 +36,9 @@ sed -i -e '/^ libsecp256k1-dev,/d' \ sed -i -e '/^PACKAGE_GROUPS += auth_blockchain$/d' ${DIST}/rules sed -i -e '/--EXCLUDED--/i EXTRA_EXCLUDED_MODULES += auth_blockchain' ${DIST}/rules +# latest higher lua version available +sed -i -e 's/liblua5.5-dev/liblua5.4-dev/g' ${DIST}/control + wrap-and-sort -sat -d ${DIST} # clean backports scripts diff --git a/pkg/kamailio/deb/debian/backports/jammy b/pkg/kamailio/deb/debian/backports/jammy index af7176f7f..9f8b8e993 100755 --- a/pkg/kamailio/deb/debian/backports/jammy +++ b/pkg/kamailio/deb/debian/backports/jammy @@ -14,7 +14,8 @@ sed -i -e '/^PACKAGE_GROUPS += python$/d' ${DIST}/rules sed -i -e '/--EXCLUDED--/i EXTRA_EXCLUDED_MODULES += python' ${DIST}/rules # libjwt < 1.12 -sed -i -e '/libjwt-dev/d' -e 's/, JWT (JSON Web Token)//' ${DIST}/control +sed -i -e '/libjwt-dev/d' -e 's/, JWT (JSON Web Token)//' \ + -e 's/ jwt//' ${DIST}/control sed -i -e '/^EXTRA_GROUPS += jwt$/d' ${DIST}/rules sed -i -e '/KJWT/d' ${DIST}/kamailio-extra-modules.cmake-components @@ -25,6 +26,9 @@ sed -i -e '/^ libsecp256k1-dev,/d' \ sed -i -e '/^PACKAGE_GROUPS += auth_blockchain$/d' ${DIST}/rules sed -i -e '/--EXCLUDED--/i EXTRA_EXCLUDED_MODULES += auth_blockchain' ${DIST}/rules +# latest higher lua version available +sed -i -e 's/liblua5.5-dev/liblua5.4-dev/g' ${DIST}/control + wrap-and-sort -sat -d ${DIST} # clean backports scripts diff --git a/pkg/kamailio/deb/debian/backports/noble b/pkg/kamailio/deb/debian/backports/noble index 88b2a3d50..cb10811c5 100755 --- a/pkg/kamailio/deb/debian/backports/noble +++ b/pkg/kamailio/deb/debian/backports/noble @@ -26,6 +26,9 @@ sed -i -e '/^ libsecp256k1-dev,/d' \ sed -i -e '/^PACKAGE_GROUPS += auth_blockchain$/d' ${DIST}/rules sed -i -e '/--EXCLUDED--/i EXTRA_EXCLUDED_MODULES += auth_blockchain' ${DIST}/rules +# latest higher lua version available +sed -i -e 's/liblua5.5-dev/liblua5.4-dev/g' ${DIST}/control + wrap-and-sort -sat -d ${DIST} # clean backports scripts diff --git a/pkg/kamailio/deb/debian/backports/resolute b/pkg/kamailio/deb/debian/backports/resolute new file mode 100755 index 000000000..4a83abf37 --- /dev/null +++ b/pkg/kamailio/deb/debian/backports/resolute @@ -0,0 +1,36 @@ +#!/bin/bash +# +# Target dist: Ubuntu Resolute +DIST=resolute + +rm -rf ${DIST} +cp -r debian ${DIST} + +# missing dependency at libphonenumber-dev +sed -i -e '/^ libphonenumber-dev/a\ libicu-dev,' ${DIST}/control + +# missing dependency for tlsa +sed -i -e '/^ libssl-dev/a\ libjitterentropy3-dev,' ${DIST}/control + +# no python2 +sed -i -e '/^ python,/d' -e '/python-dev/d' \ + -e '/^Package: kamailio-python-modules/,/^$/d' \ + ${DIST}/control +sed -i -e '/^PACKAGE_GROUPS += python$/d' ${DIST}/rules +sed -i -e '/--EXCLUDED--/i EXTRA_EXCLUDED_MODULES += python' ${DIST}/rules + +# no lsb-base +sed -i -e '/lsb-base/d' ${DIST}/control + +# libncurses +sed -i -e 's/libncurses5-dev/libncurses-dev/g' ${DIST}/control + +# remove alien tags +while read -r f ; do + sed -i -e '/library-not-linked-against-libc/d' "${f}" +done < <(find ${DIST} -type f -name '*.lintian-overrides') +wrap-and-sort -sat -d ${DIST} + +# clean backports scripts +rm -rf ${DIST}/backports +exit 0 diff --git a/pkg/kamailio/deb/debian/backports/trixie b/pkg/kamailio/deb/debian/backports/trixie index ab18f8dbb..5f05cc2ff 100755 --- a/pkg/kamailio/deb/debian/backports/trixie +++ b/pkg/kamailio/deb/debian/backports/trixie @@ -19,6 +19,9 @@ sed -i -e '/lsb-base/d' ${DIST}/control # libncurses sed -i -e 's/libncurses5-dev/libncurses-dev/g' ${DIST}/control +# latest higher lua version available +sed -i -e 's/liblua5.5-dev/liblua5.4-dev/g' ${DIST}/control + wrap-and-sort -sat -d ${DIST} # clean backports scripts diff --git a/pkg/kamailio/deb/debian/changelog b/pkg/kamailio/deb/debian/changelog index 9069c16c6..cd4511ca0 100644 --- a/pkg/kamailio/deb/debian/changelog +++ b/pkg/kamailio/deb/debian/changelog @@ -1,3 +1,15 @@ +kamailio (6.1.3) unstable; urgency=medium + + * version set 6.1.3 + + -- Victor Seva Wed, 27 May 2026 13:23:19 +0200 + +kamailio (6.1.2) unstable; urgency=medium + + * version set 6.1.2 + + -- Victor Seva Wed, 22 Apr 2026 08:41:27 +0200 + kamailio (6.1.1) unstable; urgency=medium * version set 6.1.1 diff --git a/pkg/kamailio/deb/debian/control b/pkg/kamailio/deb/debian/control index 9e309f2cf..f2adb7a38 100644 --- a/pkg/kamailio/deb/debian/control +++ b/pkg/kamailio/deb/debian/control @@ -25,7 +25,8 @@ Build-Depends: libjansson-dev, libjson-c-dev, libldap2-dev, - liblua5.1-0-dev, + liblua5.5-dev, + libjwt-dev, libmaxminddb-dev, libmemcached-dev, libmicrohttpd-dev, @@ -34,6 +35,7 @@ Build-Depends: libmosquitto-dev, libnats-dev, libncurses5-dev, + libnghttp2-dev, libpcre2-dev, libperl-dev, libphonenumber-dev (>= 7), @@ -87,7 +89,6 @@ Replaces: kamailio-carrierroute-modules, Suggests: kamailio-cpl-modules, - kamailio-dbg, kamailio-ldap-modules, kamailio-lua-modules, kamailio-mysql-modules, @@ -128,24 +129,6 @@ Description: very fast, dynamic and configurable SIP server This package contains the main Kamailio binary along with the principal modules and support binaries. -Package: kamailio-dbg -Priority: extra -Section: debug -Architecture: any -Multi-Arch: same -Pre-Depends: - ${misc:Pre-Depends}, -Depends: - kamailio (= ${binary:Version}), - ${misc:Depends}, -Description: very fast and configurable SIP server [debug symbols] - Kamailio is a very fast and flexible SIP (RFC3261) - server. Written entirely in C, Kamailio can handle thousands calls - per second even on low-budget hardware. - . - This package contains the debugging symbols for the Kamailio binaries and - modules. You only need to install it if you need to debug Kamailio. - Package: kamailio-geoip2-modules Architecture: any Multi-Arch: same @@ -898,7 +881,9 @@ Description: Extra modules for the Kamailio SIP Server . This package provides a set of modules for compression of SIP attachments, UUID usage, JSON data structure support, HTTP restful API asynchronous - access and a few more functions: gzcompress uuid evapi jansson janssonrpcc http_async_client + access, JWT (JSON Web Token) and a few more functions: + . + gzcompress uuid evapi jansson janssonrpcc http_async_client jwt nghttp2 Package: kamailio-nth Architecture: any diff --git a/pkg/kamailio/deb/debian/kamailio-extra-modules.cmake-components b/pkg/kamailio/deb/debian/kamailio-extra-modules.cmake-components index eaa7ad8fb..44063d1a2 100644 --- a/pkg/kamailio/deb/debian/kamailio-extra-modules.cmake-components +++ b/pkg/kamailio/deb/debian/kamailio-extra-modules.cmake-components @@ -4,3 +4,4 @@ KJANSSON KUUID KHTTP_ASYNC KJWT +KNGHTTP2 diff --git a/pkg/kamailio/deb/debian/rules b/pkg/kamailio/deb/debian/rules index 1b486db09..2c40bae2b 100755 --- a/pkg/kamailio/deb/debian/rules +++ b/pkg/kamailio/deb/debian/rules @@ -95,6 +95,8 @@ EXTRA_GROUPS += gzcompress EXTRA_GROUPS += jansson EXTRA_GROUPS += uuid EXTRA_GROUPS += http_async +EXTRA_GROUPS += jwt +EXTRA_GROUPS += nghttp2 INSTALL_MODULES := $(addprefix install_, $(PACKAGE_GROUPS)) diff --git a/pkg/kamailio/deb/debian/source.lintian-overrides b/pkg/kamailio/deb/debian/source.lintian-overrides deleted file mode 100644 index 620d9ffdd..000000000 --- a/pkg/kamailio/deb/debian/source.lintian-overrides +++ /dev/null @@ -1 +0,0 @@ -kamailio source: debian-watch-file-in-native-package diff --git a/pkg/kamailio/deb/debian/watch b/pkg/kamailio/deb/debian/watch deleted file mode 100644 index 202b656a4..000000000 --- a/pkg/kamailio/deb/debian/watch +++ /dev/null @@ -1,3 +0,0 @@ -version=3 -opts=dversionmangle=s/\~svn([\d]+)//; \ -https://www.kamailio.org/pub/kamailio/([\d.]+)/src/kamailio-([\d.]+)_src\.tar\.gz diff --git a/pkg/kamailio/deb/jammy/changelog b/pkg/kamailio/deb/jammy/changelog index 9069c16c6..cd4511ca0 100644 --- a/pkg/kamailio/deb/jammy/changelog +++ b/pkg/kamailio/deb/jammy/changelog @@ -1,3 +1,15 @@ +kamailio (6.1.3) unstable; urgency=medium + + * version set 6.1.3 + + -- Victor Seva Wed, 27 May 2026 13:23:19 +0200 + +kamailio (6.1.2) unstable; urgency=medium + + * version set 6.1.2 + + -- Victor Seva Wed, 22 Apr 2026 08:41:27 +0200 + kamailio (6.1.1) unstable; urgency=medium * version set 6.1.1 diff --git a/pkg/kamailio/deb/jammy/control b/pkg/kamailio/deb/jammy/control index 7ab49e914..fa22a13d2 100644 --- a/pkg/kamailio/deb/jammy/control +++ b/pkg/kamailio/deb/jammy/control @@ -25,7 +25,7 @@ Build-Depends: libjansson-dev, libjson-c-dev, libldap2-dev, - liblua5.1-0-dev, + liblua5.4-dev, libmaxminddb-dev, libmemcached-dev, libmicrohttpd-dev, @@ -34,6 +34,7 @@ Build-Depends: libmosquitto-dev, libnats-dev, libncurses5-dev, + libnghttp2-dev, libpcre2-dev, libperl-dev, libphonenumber-dev (>= 7), @@ -84,7 +85,6 @@ Replaces: kamailio-carrierroute-modules, Suggests: kamailio-cpl-modules, - kamailio-dbg, kamailio-ldap-modules, kamailio-lua-modules, kamailio-mysql-modules, @@ -125,24 +125,6 @@ Description: very fast, dynamic and configurable SIP server This package contains the main Kamailio binary along with the principal modules and support binaries. -Package: kamailio-dbg -Priority: extra -Section: debug -Architecture: any -Multi-Arch: same -Pre-Depends: - ${misc:Pre-Depends}, -Depends: - kamailio (= ${binary:Version}), - ${misc:Depends}, -Description: very fast and configurable SIP server [debug symbols] - Kamailio is a very fast and flexible SIP (RFC3261) - server. Written entirely in C, Kamailio can handle thousands calls - per second even on low-budget hardware. - . - This package contains the debugging symbols for the Kamailio binaries and - modules. You only need to install it if you need to debug Kamailio. - Package: kamailio-geoip2-modules Architecture: any Multi-Arch: same @@ -862,7 +844,9 @@ Description: Extra modules for the Kamailio SIP Server . This package provides a set of modules for compression of SIP attachments, UUID usage, JSON data structure support, HTTP restful API asynchronous - access and a few more functions: gzcompress uuid evapi jansson janssonrpcc http_async_client + access and a few more functions: + . + gzcompress uuid evapi jansson janssonrpcc http_async_client nghttp2 Package: kamailio-nth Architecture: any diff --git a/pkg/kamailio/deb/jammy/kamailio-extra-modules.cmake-components b/pkg/kamailio/deb/jammy/kamailio-extra-modules.cmake-components index 6686c7f12..2e4ee136c 100644 --- a/pkg/kamailio/deb/jammy/kamailio-extra-modules.cmake-components +++ b/pkg/kamailio/deb/jammy/kamailio-extra-modules.cmake-components @@ -3,3 +3,4 @@ KGZCOMPRESS KJANSSON KUUID KHTTP_ASYNC +KNGHTTP2 diff --git a/pkg/kamailio/deb/jammy/rules b/pkg/kamailio/deb/jammy/rules index d09b6fdb3..ef9f499c6 100755 --- a/pkg/kamailio/deb/jammy/rules +++ b/pkg/kamailio/deb/jammy/rules @@ -95,6 +95,7 @@ EXTRA_GROUPS += gzcompress EXTRA_GROUPS += jansson EXTRA_GROUPS += uuid EXTRA_GROUPS += http_async +EXTRA_GROUPS += nghttp2 INSTALL_MODULES := $(addprefix install_, $(PACKAGE_GROUPS)) diff --git a/pkg/kamailio/deb/jammy/source.lintian-overrides b/pkg/kamailio/deb/jammy/source.lintian-overrides deleted file mode 100644 index 620d9ffdd..000000000 --- a/pkg/kamailio/deb/jammy/source.lintian-overrides +++ /dev/null @@ -1 +0,0 @@ -kamailio source: debian-watch-file-in-native-package diff --git a/pkg/kamailio/deb/jammy/watch b/pkg/kamailio/deb/jammy/watch deleted file mode 100644 index 202b656a4..000000000 --- a/pkg/kamailio/deb/jammy/watch +++ /dev/null @@ -1,3 +0,0 @@ -version=3 -opts=dversionmangle=s/\~svn([\d]+)//; \ -https://www.kamailio.org/pub/kamailio/([\d.]+)/src/kamailio-([\d.]+)_src\.tar\.gz diff --git a/pkg/kamailio/deb/noble/changelog b/pkg/kamailio/deb/noble/changelog index 9069c16c6..cd4511ca0 100644 --- a/pkg/kamailio/deb/noble/changelog +++ b/pkg/kamailio/deb/noble/changelog @@ -1,3 +1,15 @@ +kamailio (6.1.3) unstable; urgency=medium + + * version set 6.1.3 + + -- Victor Seva Wed, 27 May 2026 13:23:19 +0200 + +kamailio (6.1.2) unstable; urgency=medium + + * version set 6.1.2 + + -- Victor Seva Wed, 22 Apr 2026 08:41:27 +0200 + kamailio (6.1.1) unstable; urgency=medium * version set 6.1.1 diff --git a/pkg/kamailio/deb/noble/control b/pkg/kamailio/deb/noble/control index 9a1f3bb85..f203755d8 100644 --- a/pkg/kamailio/deb/noble/control +++ b/pkg/kamailio/deb/noble/control @@ -24,8 +24,9 @@ Build-Depends: libhiredis-dev (>= 0.10.0), libjansson-dev, libjson-c-dev, + libjwt-dev, libldap2-dev, - liblua5.1-0-dev, + liblua5.4-dev, libmaxminddb-dev, libmemcached-dev, libmicrohttpd-dev, @@ -34,6 +35,7 @@ Build-Depends: libmosquitto-dev, libnats-dev, libncurses-dev, + libnghttp2-dev, libpcre2-dev, libperl-dev, libphonenumber-dev (>= 7), @@ -83,7 +85,6 @@ Replaces: kamailio-carrierroute-modules, Suggests: kamailio-cpl-modules, - kamailio-dbg, kamailio-ldap-modules, kamailio-lua-modules, kamailio-mysql-modules, @@ -124,24 +125,6 @@ Description: very fast, dynamic and configurable SIP server This package contains the main Kamailio binary along with the principal modules and support binaries. -Package: kamailio-dbg -Priority: extra -Section: debug -Architecture: any -Multi-Arch: same -Pre-Depends: - ${misc:Pre-Depends}, -Depends: - kamailio (= ${binary:Version}), - ${misc:Depends}, -Description: very fast and configurable SIP server [debug symbols] - Kamailio is a very fast and flexible SIP (RFC3261) - server. Written entirely in C, Kamailio can handle thousands calls - per second even on low-budget hardware. - . - This package contains the debugging symbols for the Kamailio binaries and - modules. You only need to install it if you need to debug Kamailio. - Package: kamailio-geoip2-modules Architecture: any Multi-Arch: same @@ -861,7 +844,9 @@ Description: Extra modules for the Kamailio SIP Server . This package provides a set of modules for compression of SIP attachments, UUID usage, JSON data structure support, HTTP restful API asynchronous - access and a few more functions: gzcompress uuid evapi jansson janssonrpcc http_async_client + access, JWT (JSON Web Token) and a few more functions: + . + gzcompress uuid evapi jansson janssonrpcc http_async_client jwt nghttp2 Package: kamailio-nth Architecture: any diff --git a/pkg/kamailio/deb/noble/kamailio-extra-modules.cmake-components b/pkg/kamailio/deb/noble/kamailio-extra-modules.cmake-components index eaa7ad8fb..44063d1a2 100644 --- a/pkg/kamailio/deb/noble/kamailio-extra-modules.cmake-components +++ b/pkg/kamailio/deb/noble/kamailio-extra-modules.cmake-components @@ -4,3 +4,4 @@ KJANSSON KUUID KHTTP_ASYNC KJWT +KNGHTTP2 diff --git a/pkg/kamailio/deb/noble/rules b/pkg/kamailio/deb/noble/rules index d09b6fdb3..81eb5bcba 100755 --- a/pkg/kamailio/deb/noble/rules +++ b/pkg/kamailio/deb/noble/rules @@ -95,6 +95,8 @@ EXTRA_GROUPS += gzcompress EXTRA_GROUPS += jansson EXTRA_GROUPS += uuid EXTRA_GROUPS += http_async +EXTRA_GROUPS += jwt +EXTRA_GROUPS += nghttp2 INSTALL_MODULES := $(addprefix install_, $(PACKAGE_GROUPS)) diff --git a/pkg/kamailio/deb/noble/source.lintian-overrides b/pkg/kamailio/deb/noble/source.lintian-overrides deleted file mode 100644 index 620d9ffdd..000000000 --- a/pkg/kamailio/deb/noble/source.lintian-overrides +++ /dev/null @@ -1 +0,0 @@ -kamailio source: debian-watch-file-in-native-package diff --git a/pkg/kamailio/deb/noble/watch b/pkg/kamailio/deb/noble/watch deleted file mode 100644 index 202b656a4..000000000 --- a/pkg/kamailio/deb/noble/watch +++ /dev/null @@ -1,3 +0,0 @@ -version=3 -opts=dversionmangle=s/\~svn([\d]+)//; \ -https://www.kamailio.org/pub/kamailio/([\d.]+)/src/kamailio-([\d.]+)_src\.tar\.gz diff --git a/pkg/kamailio/deb/resolute/changelog b/pkg/kamailio/deb/resolute/changelog new file mode 100644 index 000000000..cd4511ca0 --- /dev/null +++ b/pkg/kamailio/deb/resolute/changelog @@ -0,0 +1,53 @@ +kamailio (6.1.3) unstable; urgency=medium + + * version set 6.1.3 + + -- Victor Seva Wed, 27 May 2026 13:23:19 +0200 + +kamailio (6.1.2) unstable; urgency=medium + + * version set 6.1.2 + + -- Victor Seva Wed, 22 Apr 2026 08:41:27 +0200 + +kamailio (6.1.1) unstable; urgency=medium + + * version set 6.1.1 + + -- Victor Seva Wed, 04 Mar 2026 09:00:15 +0100 + +kamailio (6.1.0) unstable; urgency=medium + + * version set 6.1.0 + + -- Victor Seva Wed, 18 Feb 2026 10:45:51 +0100 + +kamailio (6.1.0~rc0) unstable; urgency=medium + + * version set 6.1.0~rc0 + + -- Victor Seva Tue, 27 Jan 2026 09:29:50 +0100 + +kamailio (6.1.0~pre1) unstable; urgency=medium + + * version set 6.1.0~pre1 + + -- Victor Seva Tue, 27 Jan 2026 09:28:41 +0100 + +kamailio (6.1.0~pre0) unstable; urgency=medium + + * version set 6.1.0~pre0 + + -- Victor Seva Fri, 09 Jan 2026 08:55:11 +0100 + +kamailio (6.1.0~dev1) unstable; urgency=medium + + * version set 6.1.0~dev1 + + -- Victor Seva Tue, 06 May 2025 15:37:46 +0200 + +kamailio (6.1.0~dev0) unstable; urgency=medium + + * version set 6.1.0~dev0 + + -- Victor Seva Thu, 23 Jan 2025 08:51:36 +0100 diff --git a/pkg/kamailio/deb/resolute/control b/pkg/kamailio/deb/resolute/control new file mode 100644 index 000000000..ae0525114 --- /dev/null +++ b/pkg/kamailio/deb/resolute/control @@ -0,0 +1,894 @@ +Source: kamailio +Section: net +Priority: optional +Maintainer: Kamailio Admin Group +Uploaders: + Victor Seva , +Build-Depends: + debhelper-compat (= 13), + dh-cmake, + dh-cmake-compat (= 1), + dh-sequence-cmake, + dpkg-dev (>= 1.16.1.1), + bison, + cmake (>= 3.10), + default-libmysqlclient-dev, + docbook-xml, + docbook-xsl, + erlang-dev, + flex, + libcurl4-openssl-dev, + libev-dev, + libevent-dev, + libexpat1-dev, + libhiredis-dev (>= 0.10.0), + libicu-dev, + libjansson-dev, + libjitterentropy3-dev, + libjson-c-dev, + libjwt-dev, + libldap2-dev, + liblua5.5-dev, + libmaxminddb-dev, + libmemcached-dev, + libmicrohttpd-dev, + libmnl-dev, + libmongoc-dev, + libmosquitto-dev, + libnats-dev, + libncurses-dev, + libnghttp2-dev, + libpcre2-dev, + libperl-dev, + libphonenumber-dev (>= 7), + libpq-dev, + librabbitmq-dev, + libradcli-dev, + librdkafka-dev, + libreadline-dev, + libsasl2-dev, + libsctp-dev [any], + libsecp256k1-dev, + libsecsipid-dev [amd64 arm64 armel armhf hurd-i386 i386 powerpc ppc64 ppc64el riscv64 s390x], + libsnmp-dev, + libsqlite3-dev, + libssl-dev, + libsystemd-dev, + libunistring-dev, + libwebsockets-dev, + libwolfssl-dev, + libxml2-dev, + lynx, + openssl, + pkg-config, + python3, + python3-dev, + ruby-dev, + unixodbc-dev, + uuid-dev, + xsltproc, + zlib1g-dev, +Standards-Version: 4.6.0.1 +Homepage: https://www.kamailio.org/ +Vcs-Git: https://github.com/kamailio/kamailio.git +Vcs-Browser: https://github.com/kamailio/kamailio/ +Rules-Requires-Root: no + +Package: kamailio +Architecture: any +Multi-Arch: foreign +Pre-Depends: + ${misc:Pre-Depends}, +Depends: + adduser, + python3, + ${misc:Depends}, + ${shlibs:Depends}, +Replaces: + kamailio-carrierroute-modules, +Suggests: + kamailio-cpl-modules, + kamailio-ldap-modules, + kamailio-lua-modules, + kamailio-mysql-modules, + kamailio-perl-modules, + kamailio-postgres-modules, + kamailio-presence-modules, + kamailio-python-modules, + kamailio-radius-modules, + kamailio-snmpstats-modules, + kamailio-tls-modules, + kamailio-unixodbc-modules, + kamailio-xml-modules, + kamailio-xmpp-modules, + stun-server | turn-server, +Provides: + sip-router, +Description: very fast, dynamic and configurable SIP server + Kamailio is a very fast and flexible SIP (RFC3261) + server. Written entirely in C, kamailio can handle thousands requests + per second even on low-budget hardware. It can be configured to act + as a SIP proxy, application server, session border controller, + or call load balancer to handle a set of media servers. + . + A C Shell like scripting language provides full control over the server's + behaviour. It's easy to integrate Kamailio with 3rd party API's and applications + using HTTP, AMQP, database drivers, LDAP, Radius and many other solutions. + In addition there is support for scripting using Lua, Python, Perl, Javascript. + . + Kamailio's modular architecture allows only required functionality to be loaded. + There are over 100 modules available: WebSockets for WebRTC, authentication, + multiple databases - both traditional SQL databases as well as no-SQL, + message bus systems like Rabbit MQ, instant messaging, a presence agent, + integration with REST-ful APIs using HTTP and JSON or XML, + radius authentication, record routing, an SMS gateway, a XMPP/jabber gateway, a + transaction and dialog module, OSP module, statistics support, + registrar and user location services, SNMP, SIMPLE Presence and much more. + . + This package contains the main Kamailio binary along with the principal modules + and support binaries. + +Package: kamailio-geoip2-modules +Architecture: any +Multi-Arch: same +Pre-Depends: + ${misc:Pre-Depends}, +Depends: + kamailio (= ${binary:Version}), + ${misc:Depends}, + ${shlibs:Depends}, +Description: The geoip2 module for the Kamailio SIP Server + Kamailio is a very fast and flexible SIP (RFC3261) + server. Written entirely in C, Kamailio can handle thousands calls + per second even on low-budget hardware. + . + This package provides the geoip2 module, an extension enabling + real-time queries against the Max Mind GeoIP2 database within the Kamailio + configuration file. + +Package: kamailio-sqlite-modules +Architecture: any +Multi-Arch: same +Pre-Depends: + ${misc:Pre-Depends}, +Depends: + kamailio (= ${binary:Version}), + ${misc:Depends}, + ${shlibs:Depends}, +Recommends: + sqlite3, +Description: SQLite database connectivity module for the Kamailio SIP server + Kamailio is a very fast and flexible SIP (RFC3261) + server. Written entirely in C, Kamailio can handle thousands calls + per second even on low-budget hardware. + . + This package provides the SQLite database driver for Kamailio. + +Package: kamailio-json-modules +Architecture: any +Multi-Arch: same +Pre-Depends: + ${misc:Pre-Depends}, +Depends: + kamailio (= ${binary:Version}), + ${misc:Depends}, + ${shlibs:Depends}, +Description: Json parser and Json-RPC modules for the Kamailio SIP server + Kamailio is a very fast and flexible SIP (RFC3261) + server. Written entirely in C, Kamailio can handle thousands calls + per second even on low-budget hardware. + . + This package provides a JSON parser for use in the Kamailio + configuration file and the JSON-RPC client over netstrings. + +Package: kamailio-memcached-modules +Architecture: any +Multi-Arch: same +Pre-Depends: + ${misc:Pre-Depends}, +Depends: + kamailio (= ${binary:Version}), + ${misc:Depends}, + ${shlibs:Depends}, +Replaces: + kamailio-memcached-module, +Description: interface to the memcached server, for the Kamailio SIP server + Kamailio is a very fast and flexible SIP (RFC3261) + server. Written entirely in C, Kamailio can handle thousands calls + per second even on low-budget hardware. + . + This package provides the memcached module, an interface to the memcached + server, a high-performance, distributed memory object caching system. + +Package: kamailio-lua-modules +Architecture: any +Multi-Arch: same +Pre-Depends: + ${misc:Pre-Depends}, +Depends: + kamailio (= ${binary:Version}), + ${misc:Depends}, + ${shlibs:Depends}, +Description: The app_lua module for Kamailio Lua support + Kamailio is a very fast and flexible SIP (RFC3261) + server. Written entirely in C, Kamailio can handle thousands calls + per second even on low-budget hardware. + . + This package provides the app_lua module, an extension allowing to + execute embedded Lua applications within the configuration file as + well as writing the entire configuration file in Lua. + +Package: kamailio-python3-modules +Architecture: any +Multi-Arch: same +Pre-Depends: + ${misc:Pre-Depends}, +Depends: + kamailio (= ${binary:Version}), + ${misc:Depends}, + ${shlibs:Depends}, +Description: The app_python3 module for the Kamailio SIP server + Kamailio is a very fast and flexible SIP (RFC3261) + server. Written entirely in C, Kamailio can handle thousands calls + per second even on low-budget hardware. + . + This package provides the app_python3 module, an extension allowing to + execute embedded Python applications within the Kamailio SIP routing script. + +Package: kamailio-ruby-modules +Architecture: any +Multi-Arch: same +Pre-Depends: + ${misc:Pre-Depends}, +Depends: + kamailio (= ${binary:Version}), + ${misc:Depends}, + ${shlibs:Depends}, +Description: The app_ruby module for Kamailio Ruby support + Kamailio is a very fast and flexible SIP (RFC3261) + server. Written entirely in C, Kamailio can handle thousands calls + per second even on low-budget hardware. + . + This package provides the app_ruby module, an extension allowing to + execute embedded Ruby applications within the Kamailio SIP routing script. + +Package: kamailio-redis-modules +Architecture: any +Multi-Arch: same +Pre-Depends: + ${misc:Pre-Depends}, +Depends: + kamailio (= ${binary:Version}), + ${misc:Depends}, + ${shlibs:Depends}, +Description: Redis database connectivity module for the Kamailio SIP server + Kamailio is a very fast and flexible SIP (RFC3261) + server. Written entirely in C, Kamailio can handle thousands calls + per second even on low-budget hardware. + . + This package provides the Redis NOSQL database driver for Kamailio. + +Package: kamailio-mysql-modules +Architecture: any +Multi-Arch: same +Pre-Depends: + ${misc:Pre-Depends}, +Depends: + default-mysql-client | virtual-mysql-client, + kamailio (= ${binary:Version}), + ${misc:Depends}, + ${shlibs:Depends}, +Description: MySQL database connectivity module for Kamailio + Kamailio is a very fast and flexible SIP (RFC3261) + server. Written entirely in C, Kamailio can handle thousands calls + per second even on low-budget hardware. + . + This package provides the MySQL database driver for Kamailio. + +Package: kamailio-postgres-modules +Architecture: any +Multi-Arch: same +Pre-Depends: + ${misc:Pre-Depends}, +Depends: + kamailio (= ${binary:Version}), + postgresql-client, + ${misc:Depends}, + ${shlibs:Depends}, +Description: PostgreSQL database connectivity module for the Kamailio SIP server + Kamailio is a very fast and flexible SIP (RFC3261) + server. Written entirely in C, Kamailio can handle thousands calls + per second even on low-budget hardware. + . + This package provides the PostgreSQL database driver for Kamailio. + +Package: kamailio-cpl-modules +Architecture: any +Multi-Arch: same +Pre-Depends: + ${misc:Pre-Depends}, +Depends: + kamailio (= ${binary:Version}), + ${misc:Depends}, + ${shlibs:Depends}, +Description: CPL module (CPL interpreter engine) for the Kamailio SIP server + Kamailio is a very fast and flexible SIP (RFC3261) + server. Written entirely in C, Kamailio can handle thousands calls + per second even on low-budget hardware. + . + This package provides a CPL (Call Processing Language) interpreter for + Kamailio, turning Kamailio into a CPL server (storage and interpreter). + +Package: kamailio-radius-modules +Architecture: any +Multi-Arch: same +Breaks: + kamailio (<<5.1), +Replaces: + kamailio (<<5.1), +Pre-Depends: + ${misc:Pre-Depends}, +Depends: + kamailio (= ${binary:Version}), + ${misc:Depends}, + ${shlibs:Depends}, +Description: RADIUS modules for the Kamailio SIP server + Kamailio is a very fast and flexible SIP (RFC3261) + server. Written entirely in C, Kamailio can handle thousands calls + per second even on low-budget hardware. + . + This package provides a set of RADIUS modules for Kamailio, for + authentication, peering, group membership and messages URIs checking against a + RADIUS server. + +Package: kamailio-unixodbc-modules +Architecture: any +Multi-Arch: same +Pre-Depends: + ${misc:Pre-Depends}, +Depends: + kamailio (= ${binary:Version}), + ${misc:Depends}, + ${shlibs:Depends}, +Description: unixODBC database connectivity module for the Kamailio SIP server + Kamailio is a very fast and flexible SIP (RFC3261) + server. Written entirely in C, Kamailio can handle thousands calls + per second even on low-budget hardware. + . + This package provides the unixODBC database driver for Kamailio. + +Package: kamailio-presence-modules +Architecture: any +Multi-Arch: same +Pre-Depends: + ${misc:Pre-Depends}, +Depends: + kamailio (= ${binary:Version}), + ${misc:Depends}, + ${shlibs:Depends}, +Description: SIP presence modules for Kamailio + Kamailio is a very fast and flexible SIP (RFC3261) + server. Written entirely in C, Kamailio can handle thousands calls + per second even on low-budget hardware. + . + This package provides several Kamailio modules for implementing a presence + server and presence user agent for rich presence, registrar-based presence, + external triggered presence with SIMPLE and XCAP support, as well as a + set of other SIP event packages.. + +Package: kamailio-perl-modules +Architecture: any +Multi-Arch: same +Pre-Depends: + ${misc:Pre-Depends}, +Depends: + kamailio (= ${binary:Version}), + ${misc:Depends}, + ${shlibs:Depends}, +Description: Perl extensions and database driver for the Kamailio SIP server + Kamailio is a very fast and flexible SIP (RFC3261) + server. Written entirely in C, Kamailio can handle thousands calls + per second even on low-budget hardware. + . + This package provides an interface for Kamailio to write Perl extensions and + the perlvdb database driver for Kamailio. + +Package: kamailio-snmpstats-modules +Architecture: any +Multi-Arch: same +Pre-Depends: + ${misc:Pre-Depends}, +Depends: + kamailio (= ${binary:Version}), + snmpd, + ${misc:Depends}, + ${shlibs:Depends}, +Description: SNMP AgentX subagent module for the Kamailio SIP server + Kamailio is a very fast and flexible SIP (RFC3261) + server. Written entirely in C, Kamailio can handle thousands calls + per second even on low-budget hardware. + . + This package provides the snmpstats module for Kamailio. This module acts + as an AgentX subagent which connects to a master agent. The Kamailio MIBS are + included. + +Package: kamailio-xmpp-modules +Architecture: any +Multi-Arch: same +Pre-Depends: + ${misc:Pre-Depends}, +Depends: + kamailio (= ${binary:Version}), + ${misc:Depends}, + ${shlibs:Depends}, +Description: XMPP gateway module for the Kamailio SIP server + Kamailio is a very fast and flexible SIP (RFC3261) + server. Written entirely in C, Kamailio can handle thousands calls + per second even on low-budget hardware. + . + This package provides the SIP to XMPP IM translator module for Kamailio. + +Package: kamailio-xml-modules +Architecture: any +Multi-Arch: same +Pre-Depends: + ${misc:Pre-Depends}, +Depends: + kamailio (= ${binary:Version}), + ${misc:Depends}, + ${shlibs:Depends}, +Replaces: + kamailio-xml-module, + kamailio-xmlrpc-module, +Provides: + kamailio-xmlrpc-modules, +Description: XML based extensions for Kamailio's Management Interface + Kamailio is a very fast and flexible SIP (RFC3261) + server. Written entirely in C, Kamailio can handle thousands calls + per second even on low-budget hardware. + . + This package provides: + - the XMLRPC transport implementations for Kamailio's + Management and Control Interface. + - xmlops module for XPath operations in configuration file + +Package: kamailio-ldap-modules +Architecture: any +Multi-Arch: same +Pre-Depends: + ${misc:Pre-Depends}, +Depends: + kamailio (= ${binary:Version}), + ${misc:Depends}, + ${shlibs:Depends}, +Description: LDAP modules for the Kamailio SIP server + Kamailio is a very fast and flexible SIP (RFC3261) + server. Written entirely in C, Kamailio can handle thousands calls + per second even on low-budget hardware. + . + This package provides the ldap and h350 modules for Kamailio, enabling LDAP + queries from the Kamailio routing scripts and storage of SIP account data in an LDAP + directory. + +Package: kamailio-ims-modules +Architecture: any +Multi-Arch: same +Pre-Depends: + ${misc:Pre-Depends}, +Depends: + kamailio (= ${binary:Version}), + ${misc:Depends}, + ${shlibs:Depends}, +Description: IMS module for the Kamailio SIP server + Kamailio is a very fast and flexible SIP (RFC3261) + server. Written entirely in C, Kamailio can handle thousands calls + per second even on low-budget hardware. + . + This package contains various Diameter interfaces and modules for Kamailio + to run as an IMS core. + +Package: kamailio-utils-modules +Architecture: any +Multi-Arch: same +Pre-Depends: + ${misc:Pre-Depends}, +Depends: + kamailio (= ${binary:Version}), + ${misc:Depends}, + ${shlibs:Depends}, +Description: Utility functions for the Kamailio SIP server + Kamailio is a very fast and flexible SIP (RFC3261) + server. Written entirely in C, Kamailio can handle thousands calls + per second even on low-budget hardware. + . + This package provides a set of utility functions for Kamailio, as well + as modules for restful HTTP API access using the CURL library in the + http_client module. + +Package: kamailio-sctp-modules +Architecture: any +Multi-Arch: same +Pre-Depends: + ${misc:Pre-Depends}, +Depends: + kamailio (= ${binary:Version}), + ${misc:Depends}, + ${shlibs:Depends}, +Description: SCTP SIP transport module for the Kamailio SIP server + Kamailio is a very fast and flexible SIP (RFC3261) + server. Written entirely in C, Kamailio can handle thousands calls + per second even on low-budget hardware. + . + This package provides the SCTP SIP transport module for Kamailio. + +Package: kamailio-tls-modules +Architecture: any +Multi-Arch: same +Pre-Depends: + ${misc:Pre-Depends}, +Depends: + kamailio (= ${binary:Version}), + ${misc:Depends}, + ${shlibs:Depends}, +Description: TLS support for the Kamailio SIP server (authentication, transport) + Kamailio is a very fast and flexible SIP (RFC3261) + server. Written entirely in C, Kamailio can handle thousands calls + per second even on low-budget hardware. + . + This package provides TLS support for encrypted and authenticated + SIP connections as well as generic TLS support for many Kamailio modules. + +Package: kamailio-tls-wolfssl-modules +Architecture: any +Multi-Arch: same +Pre-Depends: + ${misc:Pre-Depends}, +Depends: + kamailio (= ${binary:Version}), + ${misc:Depends}, + ${shlibs:Depends}, +Description: TLS support for the Kamailio SIP server (authentication, transport) + Kamailio is a very fast and flexible SIP (RFC3261) + server. Written entirely in C, Kamailio can handle thousands calls + per second even on low-budget hardware. + . + This package provides TLS support for encrypted and authenticated using wolfssl + SIP connections as well as generic TLS support for many Kamailio modules. + +Package: kamailio-outbound-modules +Architecture: any +Multi-Arch: same +Pre-Depends: + ${misc:Pre-Depends}, +Depends: + kamailio (= ${binary:Version}), + ${misc:Depends}, + ${shlibs:Depends}, +Description: SIP Outbound module for the Kamailio SIP server + Kamailio is a very fast and flexible SIP (RFC3261) + server. Written entirely in C, Kamailio can handle thousands calls + per second even on low-budget hardware. + . + This package contains the "outbound" module implementing SIP outbound extension. + +Package: kamailio-websocket-modules +Architecture: any +Multi-Arch: same +Pre-Depends: + ${misc:Pre-Depends}, +Depends: + kamailio (= ${binary:Version}), + ${misc:Depends}, + ${shlibs:Depends}, +Description: WebSocket module for the Kamailio SIP server + Kamailio is a very fast and flexible SIP (RFC3261) + server. Written entirely in C, Kamailio can handle thousands calls + per second even on low-budget hardware. + . + This package contains the module implementing WebSocket transport layer + for use in SIP over WebSockets, in combination with WebRTC media sessions.. + +Package: kamailio-autheph-modules +Architecture: any +Multi-Arch: same +Pre-Depends: + ${misc:Pre-Depends}, +Depends: + kamailio (= ${binary:Version}), + ${misc:Depends}, + ${shlibs:Depends}, +Description: authentication using ephemeral credentials for the Kamailio SIP server + Kamailio is a very fast and flexible SIP (RFC3261) + server. Written entirely in C, Kamailio can handle thousands calls + per second even on low-budget hardware. + . + This package provides the ephemeral authentication module for Kamailio, + enabling authentication using a Restful HTTP API. + +Package: kamailio-kazoo-modules +Architecture: any +Multi-Arch: same +Pre-Depends: + ${misc:Pre-Depends}, +Depends: + kamailio (= ${binary:Version}), + ${misc:Depends}, + ${shlibs:Depends}, +Description: kazoo modules for the Kamailio SIP server + Kamailio is a very fast and flexible SIP (RFC3261) + server. Written entirely in C, Kamailio can handle thousands calls + per second even on low-budget hardware. + . + This package provides the Kazoo application server integration module for Kamailio. + +Package: kamailio-rabbitmq-modules +Architecture: any +Multi-Arch: same +Pre-Depends: + ${misc:Pre-Depends}, +Depends: + kamailio (= ${binary:Version}), + ${misc:Depends}, + ${shlibs:Depends}, +Description: RabbitMQ and AMQP integration modules for the Kamailio SIP server + Kamailio is a very fast and flexible SIP (RFC3261) + server. Written entirely in C, Kamailio can handle thousands calls + per second even on low-budget hardware. + . + This package provides the RabbitMQ module for Kamailio, enabling AMQP + integration into the SIP routing scripts for third party service + support. + +Package: kamailio-cnxcc-modules +Architecture: any +Multi-Arch: same +Breaks: + kamailio (<<5.1), +Replaces: + kamailio (<<5.1), +Pre-Depends: + ${misc:Pre-Depends}, +Depends: + kamailio (= ${binary:Version}), + ${misc:Depends}, + ${shlibs:Depends}, +Description: cnxcc modules for the Kamailio SIP server + Kamailio is a very fast and flexible SIP (RFC3261) + server. Written entirely in C, Kamailio can handle thousands calls + per second even on low-budget hardware. + . + This package provides the cnxcc call charging control module for Kamailio. + +Package: kamailio-erlang-modules +Architecture: any +Multi-Arch: same +Pre-Depends: + ${misc:Pre-Depends}, +Depends: + kamailio (= ${binary:Version}), + ${misc:Depends}, + ${shlibs:Depends}, +Description: Erlang modules for the Kamailio SIP server + Kamailio is a very fast and flexible SIP (RFC3261) + server. Written entirely in C, Kamailio can handle thousands calls + per second even on low-budget hardware. + . + This Kamailio module provides interaction with the Erlang node from the Kamailio + SIP routing scripts. The module allows sending, receiving Erlang messages + and RPC calls between each other. + +Package: kamailio-systemd-modules +Architecture: any +Multi-Arch: same +Pre-Depends: + ${misc:Pre-Depends}, +Depends: + kamailio (= ${binary:Version}), + ${misc:Depends}, + ${shlibs:Depends}, +Description: systemd logging modules for the Kamailio SIP server + Kamailio is a very fast and flexible SIP (RFC3261) + server. Written entirely in C, Kamailio can handle thousands calls + per second even on low-budget hardware. + . + This package provides logging to systemd journal directly from the + Kamailio configuration and routing scripts. + +Package: kamailio-phonenum-modules +Architecture: any +Multi-Arch: same +Pre-Depends: + ${misc:Pre-Depends}, +Depends: + kamailio (= ${binary:Version}), + ${misc:Depends}, + ${shlibs:Depends}, +Description: phonenum modules for the Kamailio SIP server + Kamailio is a very fast and flexible SIP (RFC3261) + server. Written entirely in C, Kamailio can handle thousands calls + per second even on low-budget hardware. + . + This package provides real-time queries against the libphonenumber to be + performed directly from the Kamailio configuration and routing scripts. + +Package: kamailio-mongodb-modules +Architecture: any +Multi-Arch: same +Pre-Depends: + ${misc:Pre-Depends}, +Depends: + kamailio (= ${binary:Version}), + ${misc:Depends}, + ${shlibs:Depends}, +Description: mongodb modules for the Kamailio SIP server + Kamailio is a very fast and flexible SIP (RFC3261) + server. Written entirely in C, Kamailio can handle thousands calls + per second even on low-budget hardware. + . + This package provides the mongodb database driver and non-db connector for + Kamailio. + +Package: kamailio-mqtt-modules +Architecture: any +Multi-Arch: same +Pre-Depends: + ${misc:Pre-Depends}, +Depends: + kamailio (= ${binary:Version}), + ${misc:Depends}, + ${shlibs:Depends}, +Description: MQTT modules for the Kamailio SIP Server + Kamailio is a very fast and flexible SIP (RFC3261) + server. Written entirely in C, Kamailio can handle thousands calls + per second even on low-budget hardware. + . + MQTT module allows bidirectional publish/subscribe communication by + connecting Kamailio to a MQTT Broker. + . + Messages can be published from any point in the routing script. Also + the subscriptions can be fully controlled by scripting commands. + +Package: kamailio-secsipid-modules +Architecture: amd64 arm64 armel armhf hurd-i386 i386 powerpc ppc64 ppc64el riscv64 s390x +Multi-Arch: same +Pre-Depends: + ${misc:Pre-Depends}, +Depends: + kamailio (= ${binary:Version}), + ${misc:Depends}, + ${shlibs:Depends}, +Description: contains the secsipid module + Kamailio is a very fast and flexible SIP (RFC3261) + proxy server. Written entirely in C, Kamailio can handle thousands calls + per second even on low-budget hardware. + . + This package contains the secsipid Module. + +Package: kamailio-lwsc-modules +Architecture: any +Multi-Arch: same +Pre-Depends: + ${misc:Pre-Depends}, +Depends: + kamailio (= ${binary:Version}), + ${misc:Depends}, + ${shlibs:Depends}, +Description: Libwebsockets module for the Kamailio SIP server + Kamailio is a very fast and flexible SIP (RFC3261) + server. Written entirely in C, Kamailio can handle thousands calls + per second even on low-budget hardware. + . + This package contains the lwcs module, which provides a client-side WebSockets + API through libwebsockets. + +Package: kamailio-nats-modules +Architecture: any +Multi-Arch: same +Pre-Depends: + ${misc:Pre-Depends}, +Depends: + kamailio (= ${binary:Version}), + ${misc:Depends}, + ${shlibs:Depends}, +Description: Nats module for the Kamailio SIP server + Kamailio is a very fast and flexible SIP (RFC3261) + server. Written entirely in C, Kamailio can handle thousands calls + per second even on low-budget hardware. + . + This package contains the nats module, which provides a NATS consumer for Kamailio. + NATS is a real time distributed messaging platform, more details about it can be + found at nats.io. + +Package: kamailio-microhttpd-modules +Architecture: any +Multi-Arch: same +Pre-Depends: + ${misc:Pre-Depends}, +Depends: + kamailio (= ${binary:Version}), + ${misc:Depends}, + ${shlibs:Depends}, +Description: Microhttpd module for the Kamailio SIP server + Kamailio is a very fast and flexible SIP (RFC3261) + server. Written entirely in C, Kamailio can handle thousands calls + per second even on low-budget hardware. + . + This package provides an embedded HTTP server using libmicrohttpd. + +Package: kamailio-kafka-modules +Architecture: any +Multi-Arch: same +Pre-Depends: + ${misc:Pre-Depends}, +Depends: + kamailio (= ${binary:Version}), + ${misc:Depends}, + ${shlibs:Depends}, +Description: Kafka module for the Kamailio SIP server + Kamailio is a very fast and flexible SIP (RFC3261) + server. Written entirely in C, Kamailio can handle thousands calls + per second even on low-budget hardware. + . + This package provides an embedded kafka producer using librdkafka. + +Package: kamailio-authblockchain-modules +Architecture: any +Multi-Arch: same +Pre-Depends: + ${misc:Pre-Depends}, +Depends: + kamailio (= ${binary:Version}), + ${misc:Depends}, + ${shlibs:Depends}, +Description: Blockchain related modules for the Kamailio SIP server + Kamailio is a very fast and flexible SIP (RFC3261) + server. Written entirely in C, Kamailio can handle thousands calls + per second even on low-budget hardware. + . + This package provides auth_web3 and auth_arnacon modules. + +Package: kamailio-extra-modules +Architecture: any +Multi-Arch: same +Pre-Depends: + ${misc:Pre-Depends}, +Depends: + kamailio (= ${binary:Version}), + ${misc:Depends}, + ${shlibs:Depends}, +Description: Extra modules for the Kamailio SIP Server + Kamailio is a very fast and flexible SIP (RFC3261) + server. Written entirely in C, Kamailio can handle thousands calls + per second even on low-budget hardware. + . + This package provides a set of modules for compression of SIP attachments, + UUID usage, JSON data structure support, HTTP restful API asynchronous + access, JWT (JSON Web Token) and a few more functions: + . + gzcompress uuid evapi jansson janssonrpcc http_async_client jwt nghttp2 + +Package: kamailio-nth +Architecture: any +Pre-Depends: + ${misc:Pre-Depends}, +Depends: + binutils, + bison, + bvi, + flex, + gcc, + gdb, + iftop, + less | most, + lsof, + mc, + ngrep, + psmisc, + screen, + sipsak, + tcpdump, + vim, + ${misc:Depends}, +Description: Kamailio SIP server - package for "nice to have" utilities + This is a metapackage for easy installation various useful tools that may be + handy on server with Kamailio installed. diff --git a/pkg/kamailio/deb/resolute/copyright b/pkg/kamailio/deb/resolute/copyright new file mode 100644 index 000000000..0b23c6ca1 --- /dev/null +++ b/pkg/kamailio/deb/resolute/copyright @@ -0,0 +1,309 @@ +Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: Kamailio +Upstream-Contact: sr-dev@lists.kamailio.org +Source: https://www.kamailio.org/pub/kamailio/ + +Files: * +Copyright: + 2001-2003 FhG Fokus + 2006-2010 iptelorg GmbH + Various others (see AUTHORS file) +License: GPL-2.0+ + On Debian systems, the full text of the GNU General Public + License version 2 can be found in the file `/usr/share/common-licenses/GPL-2'. + +Files: debian/* +Copyright: 2012, 2013, 2014 Victor Seva + 2009, 2010, 2011, Daniel-Constantin Mierla + 2010, Jon Bonilla + 2009, Jonas Bergler + 2009, Henning Westerholt + 2007, Julien BLACHE +License: GPL-2+ + On Debian systems, the full text of the GNU General Public + License version 2 can be found in the file `/usr/share/common-licenses/GPL-2'. + + +Files: src/core/atomic/* src/core/atomic_ops.* src/core/basex.* src/core/bit_*.c + src/core/char_msg_val.h src/core/compiler_opt.h src/core/core_stats.h src/core/counters.* + src/core/endianness.* src/core/futexlock.h src/core/hashes.h src/core/io_wait.* + src/core/lock_ops.c src/core/lock_ops_init.h src/core/lvalue.* src/core/mem/ll_malloc.* + src/core/mem/memdbg.h src/core/mem/sf_malloc.* src/core/mod_fix.* src/modules/tm/rpc_uac.* + src/modules/counters/counters.c src/modules/tls/sbufq.h + src/modules/tls/tls_bio.* src/modules/tls/tls_cfg.* src/modules/tls/tls_cfg.h + src/modules/tls/tls_ct_wrq.* src/modules/tls/tls_ct_q.h src/modules/tls/tls_domain.* + src/modules/tls/tls_server.* src/modules/tls/tls_locking.* src/modules/tls/tls_rpc.* + src/modules/misctest/misctest_mod.c src/modules/blst/blst.c + src/core/parser/case_p_* src/core/parser/case_reas.h src/core/pvapi.h + src/core/pv_core.* src/core/rand/fastrand.* src/core/raw_* + src/core/rpc_lookup.* src/core/rvalue.* src/core/sctp_* src/core/ser_time.h + src/core/shm_init.* src/core/sip_msg_clone.* src/core/sock_ut.* + src/core/sr_compat.* src/core/str_hash.h src/core/switch.* + src/core/tcp_ev.h src/core/tcp_int_send.h src/core/tcp_options.* + src/core/tcp_read.h src/core/tcp_stats.* src/core/timer_proc.* + src/core/tls_hooks.* src/core/tls_hooks_init.h src/core/ver.* +Copyright: 2006-2010 iptelorg GmbH +License: ISC + +Files: src/modules/tls/tls_select.* src/modules/tls/tls_dump_vf.* +Copyright: 2005-2010 iptelorg GmbH +License: GPL-2+ with OpenSSL exception + +Files: src/modules/websocket/* src/modules/outbound/* src/modules/auth_ephemeral/* +Copyright: 2012-2013 Crocodile RCS Ltd +License: GPL-2+ with OpenSSL exception + +Files: src/core/daemonize.* src/core/fastlock.h src/core/lock_ops.h + src/core/mem/mem.* src/core/mem/f_malloc.h + src/core/mem/meminfo.h src/core/mem/memtest.c + src/core/mem/q_malloc.* + src/core/mem/f_malloc.c src/core/pt.* src/core/sched_yield.h src/core/ut.* +Copyright: 2001-2003 FhG Fokus +License: ISC + +Files: src/core/events.* src/modules/topoh/* +Copyright: 2009 SIP-Router.org +License: ISC + +Files: src/modules/pv/pv_xavp.* src/modules/usrloc/ul_rpc.* + src/core/ppcfg.* src/core/xavp.* +Copyright: 2009-2010 Daniel-Constantin Mierla (asipto.com) +License: ISC + +Files: src/modules/xmpp/xsnprintf.c +Copyright: 1995-1998, The Apache Group +License: Apache-1.0 + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + . + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + . + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + . + 3. All advertising materials mentioning features or use of this + software must display the following acknowledgment: + "This product includes software developed by the Apache Group + for use in the Apache HTTP server project (http://www.apache.org/)." + . + 4. The names "Apache Server" and "Apache Group" must not be used to + endorse or promote products derived from this software without + prior written permission. + . + 5. Redistributions of any form whatsoever must retain the following + acknowledgment: + "This product includes software developed by the Apache Group + for use in the Apache HTTP server project (http://www.apache.org/)." + . + THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY + EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR + ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + OF THE POSSIBILITY OF SUCH DAMAGE. + +Files: src/core/list.h +Copyright: 1991, 1993 The Regents of the University of California +License: BSD-3-clause + +Files: src/modules/tm/t_serial.* +Copyright: 2008 Juha Heinanen +License: BSD-2-clause + +Files: src/core/parser/sdp/sdp.* src/core/parser/sdp/sdp_helpr_funcs.* + src/core/parser/sdp/sdp_cloner.h +Copyright: + 2008-2009 SOMA Networks, INC. + 2010 VoIP Embedded, Inc +License: BSD-2-clause + +Files: src/modules/tls/fixed_c_zlib.h +Copyright:1998-2005 The OpenSSL Project +Comment: file copied from OpenSSL 0.9.8, refers to OpenSSL License. Note that + this code will not build by default in the Debian packaging. +License: OpenSSL + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + . + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + . + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + . + 3. All advertising materials mentioning features or use of this + software must display the following acknowledgment: + "This product includes software developed by the OpenSSL Project + for use in the OpenSSL Toolkit. (http://www.openssl.org/)" + . + 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + endorse or promote products derived from this software without + prior written permission. For written permission, please contact + openssl-core@openssl.org. + . + 5. Products derived from this software may not be called "OpenSSL" + nor may "OpenSSL" appear in their names without prior written + permission of the OpenSSL Project. + . + 6. Redistributions of any form whatsoever must retain the following + acknowledgment: + "This product includes software developed by the OpenSSL Project + for use in the OpenSSL Toolkit (http://www.openssl.org/)" + . + THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY + EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR + ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + OF THE POSSIBILITY OF SUCH DAMAGE. + +Files: src/core/crypto/md5.* src/core/crypto/md5utils.c +Copyright: 1991-2, RSA Data Security, Inc +Comment: Note that md5.c and md5.h have been replaced in the patches + plum_md5*.patch . + . + As for md5utils.c, according to a mail from Upstream (Daniel-Constantin + Mierla): while the initial commit log for it states that it is derived + from mddriver.c of RFC 1321, it seems that it was, in fact, written from + scratch by Jiri Kuthan (a core developer of SER at that time, working for + FhG Fokus Institute). As you can see it's rather trivial and uses a data + type of SER ("str"). I didn't reimplement it as it's too trivial and + looks like there's no other way to implement it. +License: RSA-MD5 + License to copy and use this software is granted provided that it + is identified as the "RSA Data Security, Inc. MD5 Message-Digest + Algorithm" in all material mentioning or referencing this software + or this function. + . + License is also granted to make and use derivative works provided + that such works are identified as "derived from the RSA Data + Security, Inc. MD5 Message-Digest Algorithm" in all material + mentioning or referencing the derived work. + . + RSA Data Security, Inc. makes no representations concerning either + the merchantability of this software or the suitability of this + software for any particular purpose. It is provided "as is" + without express or implied warranty of any kind. + . + These notices must be retained in any copies of any part of this + documentation and/or software. + +Files: src/core/mem/dl_* +Copyright: n/a +License: public-domain + This is a version (aka dlmalloc) of malloc/free/realloc written by + Doug Lea and released to the public domain, as explained at + http://creativecommons.org/licenses/publicdomain. Send questions, + comments, complaints, performance data, etc to dl@cs.oswego.edu + +Files: src/core/rand/isaac/* +Copyright: n/a +License: public-domain + By Bob Jenkins. My random number generator, ISAAC. Public Domain. + +License: ISC + Permission to use, copy, modify, and distribute this software for any + purpose with or without fee is hereby granted, provided that the above + copyright notice and this permission notice appear in all copies. + . + THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +Files: src/core/utils/srjson.* +Copyright: 2009 Dave Gamble +License: MIT + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + . + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + , + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + +License: GPL-2+ with OpenSSL exception + On Debian systems, the full text of the GNU General Public + License version 2 can be found in the file `/usr/share/common-licenses/GPL-2'. + * Exception: permission to copy, modify, propagate, and distribute a work + * formed by combining OpenSSL toolkit software and the code in this file, + * such as linking with software components and libraries released under + * OpenSSL project license. + +License: BSD-3-clause + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + 4. Neither the name of the University nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + . + THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + SUCH DAMAGE. + +License: BSD-2-clause + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + . + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + . + THIS SOFTWARE IS PROVIDED BY THE FREEBSD PROJECT ``AS IS'' AND ANY EXPRESS OR + IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + EVENT SHALL THE FREEBSD PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/pkg/kamailio/deb/resolute/kamailio-authblockchain-modules.cmake-components b/pkg/kamailio/deb/resolute/kamailio-authblockchain-modules.cmake-components new file mode 100644 index 000000000..9cfac8314 --- /dev/null +++ b/pkg/kamailio/deb/resolute/kamailio-authblockchain-modules.cmake-components @@ -0,0 +1 @@ +KAUTH_BLOCKCHAIN diff --git a/pkg/kamailio/deb/resolute/kamailio-autheph-modules.cmake-components b/pkg/kamailio/deb/resolute/kamailio-autheph-modules.cmake-components new file mode 100644 index 000000000..96e14fca8 --- /dev/null +++ b/pkg/kamailio/deb/resolute/kamailio-autheph-modules.cmake-components @@ -0,0 +1 @@ +KAUTHEPH diff --git a/pkg/kamailio/deb/resolute/kamailio-autheph-modules.lintian-overrides b/pkg/kamailio/deb/resolute/kamailio-autheph-modules.lintian-overrides new file mode 100644 index 000000000..dcb3d18c6 --- /dev/null +++ b/pkg/kamailio/deb/resolute/kamailio-autheph-modules.lintian-overrides @@ -0,0 +1 @@ +kamailio-autheph-modules binary: possible-gpl-code-linked-with-openssl diff --git a/pkg/kamailio/deb/resolute/kamailio-cnxcc-modules.cmake-components b/pkg/kamailio/deb/resolute/kamailio-cnxcc-modules.cmake-components new file mode 100644 index 000000000..c4b10c455 --- /dev/null +++ b/pkg/kamailio/deb/resolute/kamailio-cnxcc-modules.cmake-components @@ -0,0 +1 @@ +KCNXCC diff --git a/pkg/kamailio/deb/resolute/kamailio-cpl-modules.cmake-components b/pkg/kamailio/deb/resolute/kamailio-cpl-modules.cmake-components new file mode 100644 index 000000000..eb6ab48b3 --- /dev/null +++ b/pkg/kamailio/deb/resolute/kamailio-cpl-modules.cmake-components @@ -0,0 +1 @@ +KCPL diff --git a/pkg/kamailio/deb/resolute/kamailio-erlang-modules.cmake-components b/pkg/kamailio/deb/resolute/kamailio-erlang-modules.cmake-components new file mode 100644 index 000000000..9e404c39d --- /dev/null +++ b/pkg/kamailio/deb/resolute/kamailio-erlang-modules.cmake-components @@ -0,0 +1 @@ +KERLANG diff --git a/pkg/kamailio/deb/resolute/kamailio-extra-modules.cmake-components b/pkg/kamailio/deb/resolute/kamailio-extra-modules.cmake-components new file mode 100644 index 000000000..44063d1a2 --- /dev/null +++ b/pkg/kamailio/deb/resolute/kamailio-extra-modules.cmake-components @@ -0,0 +1,7 @@ +KEV +KGZCOMPRESS +KJANSSON +KUUID +KHTTP_ASYNC +KJWT +KNGHTTP2 diff --git a/pkg/kamailio/deb/resolute/kamailio-geoip2-modules.cmake-components b/pkg/kamailio/deb/resolute/kamailio-geoip2-modules.cmake-components new file mode 100644 index 000000000..87345ebb4 --- /dev/null +++ b/pkg/kamailio/deb/resolute/kamailio-geoip2-modules.cmake-components @@ -0,0 +1 @@ +KGEOIP2 diff --git a/pkg/kamailio/deb/resolute/kamailio-ims-modules.cmake-components b/pkg/kamailio/deb/resolute/kamailio-ims-modules.cmake-components new file mode 100644 index 000000000..b22bdfdd4 --- /dev/null +++ b/pkg/kamailio/deb/resolute/kamailio-ims-modules.cmake-components @@ -0,0 +1 @@ +KIMS diff --git a/pkg/kamailio/deb/resolute/kamailio-json-modules.cmake-components b/pkg/kamailio/deb/resolute/kamailio-json-modules.cmake-components new file mode 100644 index 000000000..90422a9f2 --- /dev/null +++ b/pkg/kamailio/deb/resolute/kamailio-json-modules.cmake-components @@ -0,0 +1 @@ +KJSON diff --git a/pkg/kamailio/deb/resolute/kamailio-kafka-modules.cmake-components b/pkg/kamailio/deb/resolute/kamailio-kafka-modules.cmake-components new file mode 100644 index 000000000..87da092de --- /dev/null +++ b/pkg/kamailio/deb/resolute/kamailio-kafka-modules.cmake-components @@ -0,0 +1 @@ +KKAFKA diff --git a/pkg/kamailio/deb/resolute/kamailio-kazoo-modules.cmake-components b/pkg/kamailio/deb/resolute/kamailio-kazoo-modules.cmake-components new file mode 100644 index 000000000..cc6b05937 --- /dev/null +++ b/pkg/kamailio/deb/resolute/kamailio-kazoo-modules.cmake-components @@ -0,0 +1 @@ +KKAZOO diff --git a/pkg/kamailio/deb/resolute/kamailio-ldap-modules.cmake-components b/pkg/kamailio/deb/resolute/kamailio-ldap-modules.cmake-components new file mode 100644 index 000000000..5da8e1ecc --- /dev/null +++ b/pkg/kamailio/deb/resolute/kamailio-ldap-modules.cmake-components @@ -0,0 +1 @@ +KLDAP diff --git a/pkg/kamailio/deb/resolute/kamailio-lua-modules.cmake-components b/pkg/kamailio/deb/resolute/kamailio-lua-modules.cmake-components new file mode 100644 index 000000000..461261251 --- /dev/null +++ b/pkg/kamailio/deb/resolute/kamailio-lua-modules.cmake-components @@ -0,0 +1 @@ +KLUA diff --git a/pkg/kamailio/deb/resolute/kamailio-lwsc-modules.cmake-components b/pkg/kamailio/deb/resolute/kamailio-lwsc-modules.cmake-components new file mode 100644 index 000000000..13f41f8a9 --- /dev/null +++ b/pkg/kamailio/deb/resolute/kamailio-lwsc-modules.cmake-components @@ -0,0 +1 @@ +KLWSC diff --git a/pkg/kamailio/deb/resolute/kamailio-memcached-modules.cmake-components b/pkg/kamailio/deb/resolute/kamailio-memcached-modules.cmake-components new file mode 100644 index 000000000..b014708e6 --- /dev/null +++ b/pkg/kamailio/deb/resolute/kamailio-memcached-modules.cmake-components @@ -0,0 +1 @@ +KMEMCACHED diff --git a/pkg/kamailio/deb/resolute/kamailio-microhttpd-modules.cmake-components b/pkg/kamailio/deb/resolute/kamailio-microhttpd-modules.cmake-components new file mode 100644 index 000000000..9fb4af66f --- /dev/null +++ b/pkg/kamailio/deb/resolute/kamailio-microhttpd-modules.cmake-components @@ -0,0 +1 @@ +KMICROHTTPD diff --git a/pkg/kamailio/deb/resolute/kamailio-mongodb-modules.cmake-components b/pkg/kamailio/deb/resolute/kamailio-mongodb-modules.cmake-components new file mode 100644 index 000000000..eef81650f --- /dev/null +++ b/pkg/kamailio/deb/resolute/kamailio-mongodb-modules.cmake-components @@ -0,0 +1 @@ +KMONGODB diff --git a/pkg/kamailio/deb/resolute/kamailio-mqtt-modules.cmake-components b/pkg/kamailio/deb/resolute/kamailio-mqtt-modules.cmake-components new file mode 100644 index 000000000..a53ca1acd --- /dev/null +++ b/pkg/kamailio/deb/resolute/kamailio-mqtt-modules.cmake-components @@ -0,0 +1 @@ +KMQTT diff --git a/pkg/kamailio/deb/resolute/kamailio-mysql-modules.cmake-components b/pkg/kamailio/deb/resolute/kamailio-mysql-modules.cmake-components new file mode 100644 index 000000000..84b2ec910 --- /dev/null +++ b/pkg/kamailio/deb/resolute/kamailio-mysql-modules.cmake-components @@ -0,0 +1 @@ +KMYSQL diff --git a/pkg/kamailio/deb/resolute/kamailio-nats-modules.cmake-components b/pkg/kamailio/deb/resolute/kamailio-nats-modules.cmake-components new file mode 100644 index 000000000..266e59115 --- /dev/null +++ b/pkg/kamailio/deb/resolute/kamailio-nats-modules.cmake-components @@ -0,0 +1 @@ +KNATS diff --git a/pkg/kamailio/deb/resolute/kamailio-outbound-modules.cmake-components b/pkg/kamailio/deb/resolute/kamailio-outbound-modules.cmake-components new file mode 100644 index 000000000..dd6328ba2 --- /dev/null +++ b/pkg/kamailio/deb/resolute/kamailio-outbound-modules.cmake-components @@ -0,0 +1 @@ +KOUTBOUND diff --git a/pkg/kamailio/deb/resolute/kamailio-outbound-modules.lintian-overrides b/pkg/kamailio/deb/resolute/kamailio-outbound-modules.lintian-overrides new file mode 100644 index 000000000..3050cfeb4 --- /dev/null +++ b/pkg/kamailio/deb/resolute/kamailio-outbound-modules.lintian-overrides @@ -0,0 +1 @@ +kamailio-outbound-modules binary: possible-gpl-code-linked-with-openssl diff --git a/pkg/kamailio/deb/resolute/kamailio-perl-modules.cmake-components b/pkg/kamailio/deb/resolute/kamailio-perl-modules.cmake-components new file mode 100644 index 000000000..a28b68b71 --- /dev/null +++ b/pkg/kamailio/deb/resolute/kamailio-perl-modules.cmake-components @@ -0,0 +1 @@ +KPERL diff --git a/pkg/kamailio/deb/resolute/kamailio-phonenum-modules.cmake-components b/pkg/kamailio/deb/resolute/kamailio-phonenum-modules.cmake-components new file mode 100644 index 000000000..c2f93e5d2 --- /dev/null +++ b/pkg/kamailio/deb/resolute/kamailio-phonenum-modules.cmake-components @@ -0,0 +1 @@ +KPHONENUM diff --git a/pkg/kamailio/deb/resolute/kamailio-postgres-modules.cmake-components b/pkg/kamailio/deb/resolute/kamailio-postgres-modules.cmake-components new file mode 100644 index 000000000..13458c1b7 --- /dev/null +++ b/pkg/kamailio/deb/resolute/kamailio-postgres-modules.cmake-components @@ -0,0 +1 @@ +KPOSTGRES diff --git a/pkg/kamailio/deb/resolute/kamailio-presence-modules.cmake-components b/pkg/kamailio/deb/resolute/kamailio-presence-modules.cmake-components new file mode 100644 index 000000000..7328fde6b --- /dev/null +++ b/pkg/kamailio/deb/resolute/kamailio-presence-modules.cmake-components @@ -0,0 +1 @@ +KPRESENCE diff --git a/pkg/kamailio/deb/resolute/kamailio-python-modules.cmake-components b/pkg/kamailio/deb/resolute/kamailio-python-modules.cmake-components new file mode 100644 index 000000000..4ab8e41c0 --- /dev/null +++ b/pkg/kamailio/deb/resolute/kamailio-python-modules.cmake-components @@ -0,0 +1 @@ +KPYTHON diff --git a/pkg/kamailio/deb/resolute/kamailio-python3-modules.cmake-components b/pkg/kamailio/deb/resolute/kamailio-python3-modules.cmake-components new file mode 100644 index 000000000..d94ddc938 --- /dev/null +++ b/pkg/kamailio/deb/resolute/kamailio-python3-modules.cmake-components @@ -0,0 +1 @@ +KPYTHON3 diff --git a/pkg/kamailio/deb/resolute/kamailio-rabbitmq-modules.cmake-components b/pkg/kamailio/deb/resolute/kamailio-rabbitmq-modules.cmake-components new file mode 100644 index 000000000..68646fd95 --- /dev/null +++ b/pkg/kamailio/deb/resolute/kamailio-rabbitmq-modules.cmake-components @@ -0,0 +1 @@ +KRABBITMQ diff --git a/pkg/kamailio/deb/resolute/kamailio-radius-modules.cmake-components b/pkg/kamailio/deb/resolute/kamailio-radius-modules.cmake-components new file mode 100644 index 000000000..fe855721b --- /dev/null +++ b/pkg/kamailio/deb/resolute/kamailio-radius-modules.cmake-components @@ -0,0 +1 @@ +KRADIUS diff --git a/pkg/kamailio/deb/resolute/kamailio-redis-modules.cmake-components b/pkg/kamailio/deb/resolute/kamailio-redis-modules.cmake-components new file mode 100644 index 000000000..ab2ec6df3 --- /dev/null +++ b/pkg/kamailio/deb/resolute/kamailio-redis-modules.cmake-components @@ -0,0 +1 @@ +KREDIS diff --git a/pkg/kamailio/deb/resolute/kamailio-ruby-modules.cmake-components b/pkg/kamailio/deb/resolute/kamailio-ruby-modules.cmake-components new file mode 100644 index 000000000..207e68050 --- /dev/null +++ b/pkg/kamailio/deb/resolute/kamailio-ruby-modules.cmake-components @@ -0,0 +1 @@ +KRUBY diff --git a/pkg/kamailio/deb/resolute/kamailio-sctp-modules.cmake-components b/pkg/kamailio/deb/resolute/kamailio-sctp-modules.cmake-components new file mode 100644 index 000000000..4494adced --- /dev/null +++ b/pkg/kamailio/deb/resolute/kamailio-sctp-modules.cmake-components @@ -0,0 +1 @@ +KSCTP diff --git a/pkg/kamailio/deb/resolute/kamailio-secsipid-modules.cmake-components b/pkg/kamailio/deb/resolute/kamailio-secsipid-modules.cmake-components new file mode 100644 index 000000000..3eab0b35c --- /dev/null +++ b/pkg/kamailio/deb/resolute/kamailio-secsipid-modules.cmake-components @@ -0,0 +1 @@ +KSECSIPID diff --git a/pkg/kamailio/deb/resolute/kamailio-secsipid-modules.lintian-overrides b/pkg/kamailio/deb/resolute/kamailio-secsipid-modules.lintian-overrides new file mode 100644 index 000000000..e69de29bb diff --git a/pkg/kamailio/deb/resolute/kamailio-snmpstats-modules.cmake-components b/pkg/kamailio/deb/resolute/kamailio-snmpstats-modules.cmake-components new file mode 100644 index 000000000..53ea8deed --- /dev/null +++ b/pkg/kamailio/deb/resolute/kamailio-snmpstats-modules.cmake-components @@ -0,0 +1 @@ +KSNMPSTATS diff --git a/pkg/kamailio/deb/resolute/kamailio-sqlite-modules.cmake-components b/pkg/kamailio/deb/resolute/kamailio-sqlite-modules.cmake-components new file mode 100644 index 000000000..e1b548ecd --- /dev/null +++ b/pkg/kamailio/deb/resolute/kamailio-sqlite-modules.cmake-components @@ -0,0 +1 @@ +KSQLITE diff --git a/pkg/kamailio/deb/resolute/kamailio-systemd-modules.cmake-components b/pkg/kamailio/deb/resolute/kamailio-systemd-modules.cmake-components new file mode 100644 index 000000000..751d95a25 --- /dev/null +++ b/pkg/kamailio/deb/resolute/kamailio-systemd-modules.cmake-components @@ -0,0 +1 @@ +KSYSTEMD diff --git a/pkg/kamailio/deb/resolute/kamailio-systemd-modules.lintian-overrides b/pkg/kamailio/deb/resolute/kamailio-systemd-modules.lintian-overrides new file mode 100644 index 000000000..e69de29bb diff --git a/pkg/kamailio/deb/resolute/kamailio-tls-modules.cmake-components b/pkg/kamailio/deb/resolute/kamailio-tls-modules.cmake-components new file mode 100644 index 000000000..4541bb4f6 --- /dev/null +++ b/pkg/kamailio/deb/resolute/kamailio-tls-modules.cmake-components @@ -0,0 +1 @@ +KTLS diff --git a/pkg/kamailio/deb/resolute/kamailio-tls-modules.lintian-overrides b/pkg/kamailio/deb/resolute/kamailio-tls-modules.lintian-overrides new file mode 100644 index 000000000..57484aaf1 --- /dev/null +++ b/pkg/kamailio/deb/resolute/kamailio-tls-modules.lintian-overrides @@ -0,0 +1,3 @@ +kamailio-tls-modules binary: possible-gpl-code-linked-with-openssl +# error only on stretch +kamailio-tls-modules binary: embedded-library diff --git a/pkg/kamailio/deb/resolute/kamailio-tls-wolfssl-modules.cmake-components b/pkg/kamailio/deb/resolute/kamailio-tls-wolfssl-modules.cmake-components new file mode 100644 index 000000000..41c8970af --- /dev/null +++ b/pkg/kamailio/deb/resolute/kamailio-tls-wolfssl-modules.cmake-components @@ -0,0 +1 @@ +KTLS_WOLFSSL diff --git a/pkg/kamailio/deb/resolute/kamailio-unixodbc-modules.cmake-components b/pkg/kamailio/deb/resolute/kamailio-unixodbc-modules.cmake-components new file mode 100644 index 000000000..959cc8c23 --- /dev/null +++ b/pkg/kamailio/deb/resolute/kamailio-unixodbc-modules.cmake-components @@ -0,0 +1 @@ +KUNIXODBC diff --git a/pkg/kamailio/deb/resolute/kamailio-utils-modules.cmake-components b/pkg/kamailio/deb/resolute/kamailio-utils-modules.cmake-components new file mode 100644 index 000000000..f2ddeb7a2 --- /dev/null +++ b/pkg/kamailio/deb/resolute/kamailio-utils-modules.cmake-components @@ -0,0 +1 @@ +KUTILS diff --git a/pkg/kamailio/deb/resolute/kamailio-websocket-modules.cmake-components b/pkg/kamailio/deb/resolute/kamailio-websocket-modules.cmake-components new file mode 100644 index 000000000..084d891ae --- /dev/null +++ b/pkg/kamailio/deb/resolute/kamailio-websocket-modules.cmake-components @@ -0,0 +1 @@ +KWEBSOCKET diff --git a/pkg/kamailio/deb/resolute/kamailio-websocket-modules.lintian-overrides b/pkg/kamailio/deb/resolute/kamailio-websocket-modules.lintian-overrides new file mode 100644 index 000000000..8f384fbc3 --- /dev/null +++ b/pkg/kamailio/deb/resolute/kamailio-websocket-modules.lintian-overrides @@ -0,0 +1 @@ +kamailio-websocket-modules binary: possible-gpl-code-linked-with-openssl diff --git a/pkg/kamailio/deb/resolute/kamailio-xml-modules.cmake-components b/pkg/kamailio/deb/resolute/kamailio-xml-modules.cmake-components new file mode 100644 index 000000000..96f3954f7 --- /dev/null +++ b/pkg/kamailio/deb/resolute/kamailio-xml-modules.cmake-components @@ -0,0 +1 @@ +KXML diff --git a/pkg/kamailio/deb/resolute/kamailio-xmpp-modules.cmake-components b/pkg/kamailio/deb/resolute/kamailio-xmpp-modules.cmake-components new file mode 100644 index 000000000..fa254f95d --- /dev/null +++ b/pkg/kamailio/deb/resolute/kamailio-xmpp-modules.cmake-components @@ -0,0 +1 @@ +KXMPP diff --git a/pkg/kamailio/deb/resolute/kamailio.README.Debian b/pkg/kamailio/deb/resolute/kamailio.README.Debian new file mode 100644 index 000000000..bf6c0219d --- /dev/null +++ b/pkg/kamailio/deb/resolute/kamailio.README.Debian @@ -0,0 +1,39 @@ +Kamailio for Debian +------------------- + +* init script check for fork=no +------------------------------- + +The Kamailio init script will not start Kamailio on boot if fork=no is +specified in the config file. The check in the initscript will match +any occurrence of fork=no in the file, even inside C-style comments. + +You can disable this check in the init script if you wish; just comment +out the calls to the check_fork function in the script. Your changes to +the init script will be preserved upon upgrade, as the file is tagged +as a conffile. + + +* Kamailio setup +---------------- + +To set Kamailio up, you need to: + - configure Kamailio properly to suit your needs + - edit /etc/default/kamailio, adjust the MEMORY parameter and set + RUN_KAMAILIO to "yes" + +If you are building an HA cluster using heartbeat or similar, you'll want +to disable the init script by running: + + update-rc.d kamailio remove + +so that Kamailio will not be launched at system startup. You still need +to set RUN_KAMAILIO to "yes" if you want to use the /etc/init.d/kamailio init +script. + +Set the DUMP_CORE parameter in /etc/default/kamailio to "yes" if you want to +get a core dump in case Kamailio crashes. The debug symbols for Kamailio are +provided by the kamailio-dbg package. + + + -- Victor Seva Wed, 11 Dec 2013 16:07:11 +0100 diff --git a/pkg/kamailio/deb/resolute/kamailio.cmake-components b/pkg/kamailio/deb/resolute/kamailio.cmake-components new file mode 100644 index 000000000..5aa8cab31 --- /dev/null +++ b/pkg/kamailio/deb/resolute/kamailio.cmake-components @@ -0,0 +1,2 @@ +KSTANDARD +kamailio-core diff --git a/pkg/kamailio/deb/resolute/kamailio.default b/pkg/kamailio/deb/resolute/kamailio.default new file mode 100644 index 000000000..81c89258d --- /dev/null +++ b/pkg/kamailio/deb/resolute/kamailio.default @@ -0,0 +1,36 @@ +# +# Kamailio startup options +# + +# Set to yes to enable kamailio, once configured properly. +#RUN_KAMAILIO=yes + +# User to run as +#USER=kamailio + +# Group to run as +#GROUP=kamailio + +# On systemd, to change username or group please create drop-in +# /etc/systemd/system/kamailio.service.d/10-user_group.conf file, like +# ``` +# [Service] +# User=kamuser +# Group=kamgroup +# ``` + +# Amount of shared and private memory to allocate +# for the running Kamailio server (in Mb) +#SHM_MEMORY=64 +#PKG_MEMORY=8 + +# Config file +#CFGFILE=/etc/kamailio/kamailio.cfg + +# Enable the server to leave a core file when it crashes. +# Set this to 'yes' to enable Kamailio to leave a core file when it crashes +# or 'no' to disable this feature. This option is case sensitive and only +# accepts 'yes' and 'no' and only in lowercase letters. +# On some systems it is necessary to specify a directory for the core files +# to get a dump. Look into the kamailio init file for an example configuration. +#DUMP_CORE=yes diff --git a/pkg/kamailio/deb/resolute/kamailio.init b/pkg/kamailio/deb/resolute/kamailio.init new file mode 100644 index 000000000..aa250df1d --- /dev/null +++ b/pkg/kamailio/deb/resolute/kamailio.init @@ -0,0 +1,162 @@ +#! /bin/sh +# +### BEGIN INIT INFO +# Provides: kamailio +# Required-Start: $syslog $network $local_fs $remote_fs $time +# Should-Start: $named slapd mysql postgresql snmpd radiusd +# Should-Stop: $named slapd mysql postgresql snmpd radiusd +# Required-Stop: $syslog $network $local_fs $remote_fs +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: Start the Kamailio SIP proxy server +# Description: Start the Kamailio SIP proxy server +### END INIT INFO + +. /lib/lsb/init-functions + +PATH=/sbin:/bin:/usr/sbin:/usr/bin +DAEMON=/usr/sbin/kamailio +NAME=`basename "$0"` +DESC="Kamailio SIP Server" +HOMEDIR=/run/$NAME +PIDFILE=$HOMEDIR/$NAME.pid +DEFAULTS=/etc/default/$NAME +CFGFILE=/etc/$NAME/kamailio.cfg +RUN_KAMAILIO=no +USER=kamailio +GROUP=kamailio +# Amount of shared and private memory to allocate +# for the running Kamailio server (in Mb) +SHM_MEMORY=64 +PKG_MEMORY=8 +DUMP_CORE=no + +# Do not start kamailio if fork=no is set in the config file +# otherwise the boot process will just stop +check_fork () +{ + if grep -q "^[[:space:]]*fork[[:space:]]*=[[:space:]]*no.*" $CFGFILE; then + log_failure_msg "Not starting $DESC: fork=no specified in config file; run /etc/init.d/kamailio debug instead" + exit 0 + fi +} + +check_kamailio_config () +{ + # Check if kamailio configuration is valid before starting the server + set +e + out=$($DAEMON -f $CFGFILE -M $PKG_MEMORY -c 2>&1 > /dev/null) + retcode=$? + set -e + if [ "$retcode" != '0' ]; then + log_failure_msg "Not starting $DESC: invalid configuration file!" + log_failure_msg + log_failure_msg "$out" + log_failure_msg + exit 1 + fi +} + +create_radius_seqfile () +{ + # Create a radius sequence file to be used by the radius client if + # radius accounting is enabled. This is needed to avoid any issue + # with the file not being writable if kamailio first starts as user + # root because DUMP_CORE is enabled and creates this file as user + # root and then later it switches back to user kamailio and cannot + # write to the file. If the file exists before kamailio starts, it + # won't change its ownership and will be writable for both root + # and kamailio, no matter what options are chosen at install time + RADIUS_SEQ_FILE="$HOMEDIR/kamailio_radius.seq" + if [ -d $HOMEDIR ]; then + chown ${USER}:${GROUP} $HOMEDIR + + if [ ! -f $RADIUS_SEQ_FILE ]; then + touch $RADIUS_SEQ_FILE + fi + + chown ${USER}:${GROUP} $RADIUS_SEQ_FILE + chmod 660 $RADIUS_SEQ_FILE + fi +} + +test -f $DAEMON || exit 0 + +# Load startup options if available +if [ -f $DEFAULTS ]; then + . $DEFAULTS || true +fi + +if [ "$RUN_KAMAILIO" != "yes" ]; then + log_failure_msg "Kamailio not yet configured. Edit /etc/default/$NAME first." + exit 0 +fi + +set -e + +SHM_MEMORY=$((`echo $SHM_MEMORY | sed -e 's/[^0-9]//g'`)) +PKG_MEMORY=$((`echo $PKG_MEMORY | sed -e 's/[^0-9]//g'`)) +[ -z "$USER" ] && USER=kamailio +[ -z "$GROUP" ] && GROUP=kamailio +[ $SHM_MEMORY -le 0 ] && SHM_MEMORY=64 +[ $PKG_MEMORY -le 0 ] && PKG_MEMORY=4 + +if test "$DUMP_CORE" = "yes" ; then + # set proper ulimit + ulimit -c unlimited + + # directory for the core dump files + # COREDIR=/home/corefiles + # [ -d $COREDIR ] || mkdir $COREDIR + # chmod 777 $COREDIR + # echo "$COREDIR/core.%e.sig%s.%p" > /proc/sys/kernel/core_pattern +fi + +# $HOMEDIR can be a tmpfs +if [ ! -d $HOMEDIR ]; then + mkdir -p $HOMEDIR + chown ${USER}:${GROUP} $HOMEDIR +fi + +OPTIONS="-f $CFGFILE -P $PIDFILE -m $SHM_MEMORY -M $PKG_MEMORY -u $USER -g $GROUP --atexit=no" + +case "$1" in + start|debug) + check_kamailio_config + create_radius_seqfile + + if [ "$1" != "debug" ]; then + check_fork + fi + + log_daemon_msg "Starting $DESC: $NAME" + start-stop-daemon --start --quiet --pidfile $PIDFILE \ + --exec $DAEMON -- $OPTIONS || log_failure_msg " already running" + log_end_msg 0 + ;; + stop) + log_daemon_msg "Stopping $DESC: $NAME" + start-stop-daemon --oknodo --stop --quiet --pidfile $PIDFILE \ + --exec $DAEMON --retry 5 + log_end_msg 0 + ;; + restart|force-reload) + check_kamailio_config + create_radius_seqfile + + $0 stop + $0 start + ;; + status) + log_daemon_msg "Status of $DESC: " + + status_of_proc -p"$PIDFILE" $NAME $NAME + ;; + *) + N=/etc/init.d/$NAME + echo "Usage: $N {start|stop|restart|force-reload|status|debug}" >&2 + exit 1 + ;; +esac + +exit 0 diff --git a/pkg/kamailio/deb/resolute/kamailio.lintian-overrides b/pkg/kamailio/deb/resolute/kamailio.lintian-overrides new file mode 100644 index 000000000..c313bcf54 --- /dev/null +++ b/pkg/kamailio/deb/resolute/kamailio.lintian-overrides @@ -0,0 +1 @@ +kamailio binary: example-interpreter-not-absolute * diff --git a/pkg/kamailio/deb/resolute/kamailio.postinst b/pkg/kamailio/deb/resolute/kamailio.postinst new file mode 100644 index 000000000..78fe0c65a --- /dev/null +++ b/pkg/kamailio/deb/resolute/kamailio.postinst @@ -0,0 +1,23 @@ +#! /bin/sh + +set -e + +case "$1" in + configure) + adduser --quiet --system --group --disabled-password \ + --shell /bin/false --gecos "Kamailio SIP Server" \ + --home /run/kamailio kamailio || true + + ;; + + abort-upgrade|abort-remove|abort-deconfigure) + + ;; + + *) + echo "postinst called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +#DEBHELPER# diff --git a/pkg/kamailio/deb/resolute/kamailio.service b/pkg/kamailio/deb/resolute/kamailio.service new file mode 100644 index 000000000..8f9c93dd9 --- /dev/null +++ b/pkg/kamailio/deb/resolute/kamailio.service @@ -0,0 +1,27 @@ +[Unit] +Description=Kamailio - the Open Source SIP Server +Wants=network-online.target +After=network-online.target + +[Service] +Type=forking +User=kamailio +Group=kamailio +Environment='CFGFILE=/etc/kamailio/kamailio.cfg' +Environment='SHM_MEMORY=64' +Environment='PKG_MEMORY=8' +EnvironmentFile=-/etc/default/kamailio +EnvironmentFile=-/etc/default/kamailio.d/* +# PIDFile requires a full absolute path +PIDFile=/run/kamailio/kamailio.pid +# ExecStart requires a full absolute path +ExecStart=/usr/sbin/kamailio -P /run/kamailio/kamailio.pid -f $CFGFILE -m $SHM_MEMORY -M $PKG_MEMORY --atexit=no +Restart=on-failure +# /run/kamailio in tmpfs +RuntimeDirectory=kamailio +RuntimeDirectoryMode=0770 +# necessary for chown of control files e.g. for jsonrpcs and ctl modules +AmbientCapabilities=CAP_CHOWN + +[Install] +WantedBy=multi-user.target diff --git a/pkg/kamailio/deb/resolute/kamailio@.service b/pkg/kamailio/deb/resolute/kamailio@.service new file mode 100644 index 000000000..81c06394d --- /dev/null +++ b/pkg/kamailio/deb/resolute/kamailio@.service @@ -0,0 +1,26 @@ +[Unit] +Description=Kamailio - the Open Source SIP Server (instance %i) +Documentation=man:kamailio(8) +Wants=network-online.target +After=network-online.target + +[Service] +Type=forking +User=kamailio +Group=kamailio +Environment='CFGFILE=/etc/kamailio/kamailio-%i.cfg' +Environment='SHM_MEMORY=64' +Environment='PKG_MEMORY=8' +EnvironmentFile=-/etc/default/kamailio-%i +EnvironmentFile=-/etc/default/kamailio-%i.d/* +# PIDFile requires a full absolute path +PIDFile=/run/kamailio-%i/kamailio.pid +# ExecStart requires a full absolute path +ExecStart=/usr/sbin/kamailio -P /run/kamailio-%i/kamailio.pid -Y /run/kamailio-%i -f $CFGFILE -m $SHM_MEMORY -M $PKG_MEMORY +Restart=on-failure +# /run/kamailio in tmpfs +RuntimeDirectory=kamailio-%i +RuntimeDirectoryMode=0770 + +[Install] +WantedBy=multi-user.target diff --git a/pkg/kamailio/deb/resolute/rules b/pkg/kamailio/deb/resolute/rules new file mode 100755 index 000000000..a6f405109 --- /dev/null +++ b/pkg/kamailio/deb/resolute/rules @@ -0,0 +1,123 @@ +#!/usr/bin/make -f + +# Uncomment this to turn on verbose mode. +#export DH_VERBOSE=1 + +export DEB_BUILD_MAINT_OPTIONS = hardening=+all +DPKG_EXPORT_BUILDFLAGS = 1 + +include /usr/share/dpkg/architecture.mk +include /usr/share/dpkg/buildflags.mk +include /usr/share/dpkg/pkg-info.mk + +# Enable parallel builds. +NUMJOBS = 1 +ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS))) + NUMJOBS = $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS))) + MAKEFLAGS += -j$(NUMJOBS) +endif + +export RADCLI=1 +export WOLFSSL_INTERNAL=no +# tlsa +export KTLS_INCLUDE_TLSA=yes +export LIBSSL_STATIC_SRCLIB=yes +export LIBSSL_STATIC_SRCPATH=/usr/$(LIBDIR) + +# Modules not in the "main" kamailio package: +EXCLUDED_MODULES = +EXCLUDED_MODULES += mono +EXCLUDED_MODULES += geoip +EXCLUDED_MODULES += dnssec +EXCLUDED_MODULES += java +EXCLUDED_MODULES += berkeley + +# Extra modules to skip, because they are not compilable now: +# - regardless if they go to the main kamailio package or to some module +# package, they will be excluded from compile and install of all. +EXTRA_EXCLUDED_MODULES += bdb +EXTRA_EXCLUDED_MODULES += oracle +EXTRA_EXCLUDED_MODULES += pa +EXTRA_EXCLUDED_MODULES += iptrtpproxy +EXTRA_EXCLUDED_MODULES += python +## --EXCLUDED-- + + +# Module groups that are packaged in separate packages (with the name +# kamailio-$(group_name)-modules). +# Note: the order is important (should be in dependency order, the one +# on which other depend first) +PACKAGE_GROUPS += mysql +PACKAGE_GROUPS += postgres +PACKAGE_GROUPS += unixodbc +PACKAGE_GROUPS += radius +PACKAGE_GROUPS += presence +PACKAGE_GROUPS += ldap +PACKAGE_GROUPS += xml +PACKAGE_GROUPS += perl +PACKAGE_GROUPS += utils +PACKAGE_GROUPS += lua +PACKAGE_GROUPS += memcached +PACKAGE_GROUPS += snmpstats +PACKAGE_GROUPS += xmpp +PACKAGE_GROUPS += cpl +PACKAGE_GROUPS += redis +PACKAGE_GROUPS += geoip2 +PACKAGE_GROUPS += sqlite +PACKAGE_GROUPS += json +PACKAGE_GROUPS += ruby +PACKAGE_GROUPS += ims +PACKAGE_GROUPS += sctp +PACKAGE_GROUPS += tls +PACKAGE_GROUPS += outbound +PACKAGE_GROUPS += websocket +PACKAGE_GROUPS += autheph +PACKAGE_GROUPS += kazoo +PACKAGE_GROUPS += cnxcc +PACKAGE_GROUPS += erlang +PACKAGE_GROUPS += systemd +PACKAGE_GROUPS += phonenum +PACKAGE_GROUPS += mongodb +PACKAGE_GROUPS += rabbitmq +PACKAGE_GROUPS += python3 +PACKAGE_GROUPS += mqtt +PACKAGE_GROUPS += secsipid +PACKAGE_GROUPS += lwsc +PACKAGE_GROUPS += nats +PACKAGE_GROUPS += tls_wolfssl +PACKAGE_GROUPS += microhttpd +PACKAGE_GROUPS += kafka +PACKAGE_GROUPS += auth_blockchain + +# Module groups to be packaged onto kamailio-extra-modules. +EXTRA_GROUPS += ev +EXTRA_GROUPS += gzcompress +EXTRA_GROUPS += jansson +EXTRA_GROUPS += uuid +EXTRA_GROUPS += http_async +EXTRA_GROUPS += jwt +EXTRA_GROUPS += nghttp2 + +INSTALL_MODULES := $(addprefix install_, $(PACKAGE_GROUPS)) + +# https://wiki.debian.org/ReproducibleBuilds/ +export DEB_CFLAGS_MAINT_APPEND=-DVERSION_NODATE + +.PHONY: skip-modules $(INSTALL_MODULES) +skip-modules: + @echo "$(EXCLUDED_MODULES) $(EXTRA_EXCLUDED_MODULES)" + +%: + dh $@ --buildsystem=cmake + +override_dh_auto_configure: + dh_auto_configure -- \ + -DBUILD_DOC=ON \ + -DUSE_GIT=OFF \ + -DEXCLUDE_MODULES="$(EXCLUDED_MODULES) $(EXTRA_EXCLUDED_MODULES)" \ + -DMODULE_GROUP_NAME="KSTANDARD $(shell echo "$(addprefix K, $(PACKAGE_GROUPS) $(EXTRA_GROUPS))"| tr '[:lower:]' '[:upper:]')" + +execute_after_dh_auto_build: + cmake --build "obj-${DEB_HOST_GNU_TYPE}" -t dbschema + +override_dh_auto_test: diff --git a/pkg/kamailio/deb/resolute/source/format b/pkg/kamailio/deb/resolute/source/format new file mode 100644 index 000000000..89ae9db8f --- /dev/null +++ b/pkg/kamailio/deb/resolute/source/format @@ -0,0 +1 @@ +3.0 (native) diff --git a/pkg/kamailio/deb/sid/changelog b/pkg/kamailio/deb/sid/changelog index 9069c16c6..cd4511ca0 100644 --- a/pkg/kamailio/deb/sid/changelog +++ b/pkg/kamailio/deb/sid/changelog @@ -1,3 +1,15 @@ +kamailio (6.1.3) unstable; urgency=medium + + * version set 6.1.3 + + -- Victor Seva Wed, 27 May 2026 13:23:19 +0200 + +kamailio (6.1.2) unstable; urgency=medium + + * version set 6.1.2 + + -- Victor Seva Wed, 22 Apr 2026 08:41:27 +0200 + kamailio (6.1.1) unstable; urgency=medium * version set 6.1.1 diff --git a/pkg/kamailio/deb/sid/control b/pkg/kamailio/deb/sid/control index 0292632a4..420b07ec5 100644 --- a/pkg/kamailio/deb/sid/control +++ b/pkg/kamailio/deb/sid/control @@ -24,8 +24,9 @@ Build-Depends: libhiredis-dev (>= 0.10.0), libjansson-dev, libjson-c-dev, + libjwt-dev, libldap2-dev, - liblua5.1-0-dev, + liblua5.5-dev, libmaxminddb-dev, libmemcached-dev, libmicrohttpd-dev, @@ -34,6 +35,7 @@ Build-Depends: libmosquitto-dev, libnats-dev, libncurses-dev, + libnghttp2-dev, libpcre2-dev, libperl-dev, libphonenumber-dev (>= 7), @@ -84,7 +86,6 @@ Replaces: kamailio-carrierroute-modules, Suggests: kamailio-cpl-modules, - kamailio-dbg, kamailio-ldap-modules, kamailio-lua-modules, kamailio-mysql-modules, @@ -125,24 +126,6 @@ Description: very fast, dynamic and configurable SIP server This package contains the main Kamailio binary along with the principal modules and support binaries. -Package: kamailio-dbg -Priority: extra -Section: debug -Architecture: any -Multi-Arch: same -Pre-Depends: - ${misc:Pre-Depends}, -Depends: - kamailio (= ${binary:Version}), - ${misc:Depends}, -Description: very fast and configurable SIP server [debug symbols] - Kamailio is a very fast and flexible SIP (RFC3261) - server. Written entirely in C, Kamailio can handle thousands calls - per second even on low-budget hardware. - . - This package contains the debugging symbols for the Kamailio binaries and - modules. You only need to install it if you need to debug Kamailio. - Package: kamailio-geoip2-modules Architecture: any Multi-Arch: same @@ -878,7 +861,9 @@ Description: Extra modules for the Kamailio SIP Server . This package provides a set of modules for compression of SIP attachments, UUID usage, JSON data structure support, HTTP restful API asynchronous - access and a few more functions: gzcompress uuid evapi jansson janssonrpcc http_async_client + access, JWT (JSON Web Token) and a few more functions: + . + gzcompress uuid evapi jansson janssonrpcc http_async_client jwt nghttp2 Package: kamailio-nth Architecture: any diff --git a/pkg/kamailio/deb/sid/kamailio-extra-modules.cmake-components b/pkg/kamailio/deb/sid/kamailio-extra-modules.cmake-components index eaa7ad8fb..44063d1a2 100644 --- a/pkg/kamailio/deb/sid/kamailio-extra-modules.cmake-components +++ b/pkg/kamailio/deb/sid/kamailio-extra-modules.cmake-components @@ -4,3 +4,4 @@ KJANSSON KUUID KHTTP_ASYNC KJWT +KNGHTTP2 diff --git a/pkg/kamailio/deb/sid/rules b/pkg/kamailio/deb/sid/rules index 5b7a9cf53..a6f405109 100755 --- a/pkg/kamailio/deb/sid/rules +++ b/pkg/kamailio/deb/sid/rules @@ -95,6 +95,8 @@ EXTRA_GROUPS += gzcompress EXTRA_GROUPS += jansson EXTRA_GROUPS += uuid EXTRA_GROUPS += http_async +EXTRA_GROUPS += jwt +EXTRA_GROUPS += nghttp2 INSTALL_MODULES := $(addprefix install_, $(PACKAGE_GROUPS)) diff --git a/pkg/kamailio/deb/sid/source.lintian-overrides b/pkg/kamailio/deb/sid/source.lintian-overrides deleted file mode 100644 index 620d9ffdd..000000000 --- a/pkg/kamailio/deb/sid/source.lintian-overrides +++ /dev/null @@ -1 +0,0 @@ -kamailio source: debian-watch-file-in-native-package diff --git a/pkg/kamailio/deb/sid/watch b/pkg/kamailio/deb/sid/watch deleted file mode 100644 index 202b656a4..000000000 --- a/pkg/kamailio/deb/sid/watch +++ /dev/null @@ -1,3 +0,0 @@ -version=3 -opts=dversionmangle=s/\~svn([\d]+)//; \ -https://www.kamailio.org/pub/kamailio/([\d.]+)/src/kamailio-([\d.]+)_src\.tar\.gz diff --git a/pkg/kamailio/deb/trixie/changelog b/pkg/kamailio/deb/trixie/changelog index 9069c16c6..cd4511ca0 100644 --- a/pkg/kamailio/deb/trixie/changelog +++ b/pkg/kamailio/deb/trixie/changelog @@ -1,3 +1,15 @@ +kamailio (6.1.3) unstable; urgency=medium + + * version set 6.1.3 + + -- Victor Seva Wed, 27 May 2026 13:23:19 +0200 + +kamailio (6.1.2) unstable; urgency=medium + + * version set 6.1.2 + + -- Victor Seva Wed, 22 Apr 2026 08:41:27 +0200 + kamailio (6.1.1) unstable; urgency=medium * version set 6.1.1 diff --git a/pkg/kamailio/deb/trixie/control b/pkg/kamailio/deb/trixie/control index 0292632a4..d2396551a 100644 --- a/pkg/kamailio/deb/trixie/control +++ b/pkg/kamailio/deb/trixie/control @@ -24,8 +24,9 @@ Build-Depends: libhiredis-dev (>= 0.10.0), libjansson-dev, libjson-c-dev, + libjwt-dev, libldap2-dev, - liblua5.1-0-dev, + liblua5.4-dev, libmaxminddb-dev, libmemcached-dev, libmicrohttpd-dev, @@ -34,6 +35,7 @@ Build-Depends: libmosquitto-dev, libnats-dev, libncurses-dev, + libnghttp2-dev, libpcre2-dev, libperl-dev, libphonenumber-dev (>= 7), @@ -84,7 +86,6 @@ Replaces: kamailio-carrierroute-modules, Suggests: kamailio-cpl-modules, - kamailio-dbg, kamailio-ldap-modules, kamailio-lua-modules, kamailio-mysql-modules, @@ -125,24 +126,6 @@ Description: very fast, dynamic and configurable SIP server This package contains the main Kamailio binary along with the principal modules and support binaries. -Package: kamailio-dbg -Priority: extra -Section: debug -Architecture: any -Multi-Arch: same -Pre-Depends: - ${misc:Pre-Depends}, -Depends: - kamailio (= ${binary:Version}), - ${misc:Depends}, -Description: very fast and configurable SIP server [debug symbols] - Kamailio is a very fast and flexible SIP (RFC3261) - server. Written entirely in C, Kamailio can handle thousands calls - per second even on low-budget hardware. - . - This package contains the debugging symbols for the Kamailio binaries and - modules. You only need to install it if you need to debug Kamailio. - Package: kamailio-geoip2-modules Architecture: any Multi-Arch: same @@ -878,7 +861,9 @@ Description: Extra modules for the Kamailio SIP Server . This package provides a set of modules for compression of SIP attachments, UUID usage, JSON data structure support, HTTP restful API asynchronous - access and a few more functions: gzcompress uuid evapi jansson janssonrpcc http_async_client + access, JWT (JSON Web Token) and a few more functions: + . + gzcompress uuid evapi jansson janssonrpcc http_async_client jwt nghttp2 Package: kamailio-nth Architecture: any diff --git a/pkg/kamailio/deb/trixie/kamailio-extra-modules.cmake-components b/pkg/kamailio/deb/trixie/kamailio-extra-modules.cmake-components index eaa7ad8fb..44063d1a2 100644 --- a/pkg/kamailio/deb/trixie/kamailio-extra-modules.cmake-components +++ b/pkg/kamailio/deb/trixie/kamailio-extra-modules.cmake-components @@ -4,3 +4,4 @@ KJANSSON KUUID KHTTP_ASYNC KJWT +KNGHTTP2 diff --git a/pkg/kamailio/deb/trixie/rules b/pkg/kamailio/deb/trixie/rules index 5b7a9cf53..a6f405109 100755 --- a/pkg/kamailio/deb/trixie/rules +++ b/pkg/kamailio/deb/trixie/rules @@ -95,6 +95,8 @@ EXTRA_GROUPS += gzcompress EXTRA_GROUPS += jansson EXTRA_GROUPS += uuid EXTRA_GROUPS += http_async +EXTRA_GROUPS += jwt +EXTRA_GROUPS += nghttp2 INSTALL_MODULES := $(addprefix install_, $(PACKAGE_GROUPS)) diff --git a/pkg/kamailio/deb/trixie/source.lintian-overrides b/pkg/kamailio/deb/trixie/source.lintian-overrides deleted file mode 100644 index 620d9ffdd..000000000 --- a/pkg/kamailio/deb/trixie/source.lintian-overrides +++ /dev/null @@ -1 +0,0 @@ -kamailio source: debian-watch-file-in-native-package diff --git a/pkg/kamailio/deb/trixie/watch b/pkg/kamailio/deb/trixie/watch deleted file mode 100644 index 202b656a4..000000000 --- a/pkg/kamailio/deb/trixie/watch +++ /dev/null @@ -1,3 +0,0 @@ -version=3 -opts=dversionmangle=s/\~svn([\d]+)//; \ -https://www.kamailio.org/pub/kamailio/([\d.]+)/src/kamailio-([\d.]+)_src\.tar\.gz diff --git a/pkg/kamailio/obs/kamailio.spec b/pkg/kamailio/obs/kamailio.spec index c8b2c9eba..fe3970e5f 100644 --- a/pkg/kamailio/obs/kamailio.spec +++ b/pkg/kamailio/obs/kamailio.spec @@ -1,5 +1,5 @@ %define name kamailio -%define ver 6.1.1 +%define ver 6.1.3 %define rel dev1.0%{dist} %if 0%{?fedora} @@ -1219,6 +1219,7 @@ ndb_redis \ nghttp2 \ outbound \ peering \ +peerstate \ %if %{with phonenum} phonenum \ %endif @@ -1230,6 +1231,7 @@ presence_mwi \ presence_profile \ presence_reginfo \ presence_xml \ +ptimer \ pua \ pua_bla \ pua_dialoginfo \ @@ -1403,11 +1405,13 @@ rm -rf %{buildroot} %doc %{_docdir}/kamailio/modules/README.path %doc %{_docdir}/kamailio/modules/README.pdb %doc %{_docdir}/kamailio/modules/README.pdt +%doc %{_docdir}/kamailio/modules/README.peerstate %doc %{_docdir}/kamailio/modules/README.permissions %doc %{_docdir}/kamailio/modules/README.pike %doc %{_docdir}/kamailio/modules/README.pipelimit %doc %{_docdir}/kamailio/modules/README.posops %doc %{_docdir}/kamailio/modules/README.prefix_route +%doc %{_docdir}/kamailio/modules/README.ptimer %doc %{_docdir}/kamailio/modules/README.pv %doc %{_docdir}/kamailio/modules/README.pv_headers %doc %{_docdir}/kamailio/modules/README.pvtpl @@ -1556,11 +1560,13 @@ rm -rf %{buildroot} %{_libdir}/kamailio/modules/path.so %{_libdir}/kamailio/modules/pdb.so %{_libdir}/kamailio/modules/pdt.so +%{_libdir}/kamailio/modules/peerstate.so %{_libdir}/kamailio/modules/permissions.so %{_libdir}/kamailio/modules/pike.so %{_libdir}/kamailio/modules/pipelimit.so %{_libdir}/kamailio/modules/posops.so %{_libdir}/kamailio/modules/prefix_route.so +%{_libdir}/kamailio/modules/ptimer.so %{_libdir}/kamailio/modules/pua_rpc.so %{_libdir}/kamailio/modules/pv.so %{_libdir}/kamailio/modules/pv_headers.so diff --git a/src/Makefile.defs b/src/Makefile.defs index 0ed3b7d73..6ec68e29b 100644 --- a/src/Makefile.defs +++ b/src/Makefile.defs @@ -106,7 +106,7 @@ INSTALL_FLAVOUR=$(FLAVOUR) # version number VERSION = 6 PATCHLEVEL = 1 -SUBLEVEL = 1 +SUBLEVEL = 3 EXTRAVERSION = # memory manager switcher diff --git a/src/core/atomic/atomic_stdatomic.h b/src/core/atomic/atomic_stdatomic.h index 39e04b253..e35dd9ed7 100644 --- a/src/core/atomic/atomic_stdatomic.h +++ b/src/core/atomic/atomic_stdatomic.h @@ -84,14 +84,14 @@ inline static int atomic_inc_and_test_int(volatile int *var) { return atomic_fetch_add_explicit( (_Atomic int *)var, 1, memory_order_relaxed) - == 1; + == -1; } inline static int atomic_dec_and_test_int(volatile int *var) { return atomic_fetch_sub_explicit( (_Atomic int *)var, 1, memory_order_relaxed) - == -1; + == 1; } inline static int atomic_get_and_set_int(volatile int *var, int v) @@ -143,14 +143,14 @@ inline static long atomic_inc_and_test_long(volatile long *var) { return atomic_fetch_add_explicit( (_Atomic long *)var, 1, memory_order_relaxed) - == 1; + == -1; } inline static long atomic_dec_and_test_long(volatile long *var) { return atomic_fetch_sub_explicit( (_Atomic long *)var, 1, memory_order_relaxed) - == -1; + == 1; } inline static long atomic_get_and_set_long(volatile long *var, long v) @@ -216,14 +216,14 @@ inline static int mb_atomic_inc_and_test_int(volatile int *var) { return atomic_fetch_add_explicit( (_Atomic int *)var, 1, memory_order_seq_cst) - == 1; + == -1; } inline static int mb_atomic_dec_and_test_int(volatile int *var) { return atomic_fetch_sub_explicit( (_Atomic int *)var, 1, memory_order_seq_cst) - == -1; + == 1; } inline static int mb_atomic_get_and_set_int(volatile int *var, int v) @@ -285,14 +285,14 @@ inline static long mb_atomic_inc_and_test_long(volatile long *var) { return atomic_fetch_add_explicit( (_Atomic long *)var, 1, memory_order_seq_cst) - == 1; + == -1; } inline static long mb_atomic_dec_and_test_long(volatile long *var) { return atomic_fetch_sub_explicit( (_Atomic long *)var, 1, memory_order_seq_cst) - == -1; + == 1; } inline static long mb_atomic_get_and_set_long(volatile long *var, long v) diff --git a/src/core/autover.h b/src/core/autover.h index ec9026e99..e3c548934 100644 --- a/src/core/autover.h +++ b/src/core/autover.h @@ -2,6 +2,6 @@ * DO NOT EDIT IT */ -#define REPO_VER "01f496" -#define REPO_HASH "01f496" +#define REPO_VER "dc4570" +#define REPO_HASH "dc4570" #define REPO_STATE "" diff --git a/src/core/basex.c b/src/core/basex.c index d30353f5e..256b62f1a 100644 --- a/src/core/basex.c +++ b/src/core/basex.c @@ -338,22 +338,32 @@ static const char _sr_b58digits[] = */ char *b58_decode(char *outb, int *outbszp, char *b58, int b58sz) { - size_t outbsz = *outbszp - 1 /* save space for ending 0 */; + size_t outbsz; const unsigned char *b58u = (void *)b58; unsigned char *outu = (void *)outb; - size_t outisz = (outbsz + 3) / 4; - uint32_t outi[outisz]; + size_t outisz; uint64_t t; uint32_t c; size_t i, j; - uint8_t bytesleft = outbsz % 4; - uint32_t zeromask = bytesleft ? (0xffffffff << (bytesleft * 8)) : 0; + uint8_t bytesleft; + uint32_t zeromask; unsigned zerocount = 0; + if(outb == NULL || outbszp == NULL || b58 == NULL || *outbszp <= 1) { + LM_ERR("invalid output buffer for base58 decode\n"); + return NULL; + } + + outbsz = *outbszp - 1 /* save space for ending 0 */; + outisz = (outbsz + 3) / 4; + uint32_t outi[outisz]; + bytesleft = outbsz % 4; + zeromask = bytesleft ? (0xffffffff << (bytesleft * 8)) : 0; + if(!b58sz) b58sz = strlen(b58); - outb[outbsz - 1] = '\0'; + outb[outbsz] = '\0'; memset(outi, 0, outisz * sizeof(*outi)); /* leading zeros, just count */ @@ -410,9 +420,8 @@ char *b58_decode(char *outb, int *outbszp, char *b58, int b58sz) for(i = 0; i < outbsz; ++i) { if(outu[i]) break; - --*outbszp; } - *outbszp = strlen(outb + i); + *outbszp = (int)(outbsz - i); return outb + i; } @@ -431,6 +440,10 @@ char *b58_encode(char *b58, int *b58sz, char *data, int binsz) ssize_t i, j, high, zcount = 0; size_t size; + if(binsz > 16 * 1024 * 1024) { + return NULL; + } + while(zcount < binsz && !bin[zcount]) ++zcount; diff --git a/src/core/dns_cache.c b/src/core/dns_cache.c index b84c628cb..fb9e01548 100644 --- a/src/core/dns_cache.c +++ b/src/core/dns_cache.c @@ -4361,6 +4361,14 @@ int dns_cache_add_record(unsigned short type, str *name, int ttl, str *value, LM_ERR("dns cache support disabled (see use_dns_cache)\n"); return -1; } + if(name == NULL || name->s == NULL || name->len <= 0) { + LM_ERR("invalid dns record name\n"); + return -1; + } + if(name->len >= MAX_DNS_NAME) { + LM_ERR("dns record name too long (%d chars)\n", name->len); + return -1; + } if((type != T_A) && (type != T_AAAA) && (type != T_SRV)) { LM_ERR("rr type %d is not implemented\n", type); @@ -4368,6 +4376,10 @@ int dns_cache_add_record(unsigned short type, str *name, int ttl, str *value, } if((flags & DNS_FLAG_BAD_NAME) == 0) { + if(value == NULL || value->s == NULL || value->len <= 0) { + LM_ERR("invalid dns record value for type %d\n", type); + return -1; + } /* fix-up the values */ switch(type) { case T_A: @@ -4387,6 +4399,11 @@ int dns_cache_add_record(unsigned short type, str *name, int ttl, str *value, } break; case T_SRV: + if(value->len >= MAX_DNS_NAME) { + LM_ERR("dns SRV target name too long (%d chars)\n", + value->len); + return -1; + } rr_name = *value; break; } diff --git a/src/core/events.c b/src/core/events.c index b985bccc6..4470a218a 100644 --- a/src/core/events.c +++ b/src/core/events.c @@ -48,7 +48,7 @@ void sr_core_ert_init(void) /* 0 - is not a valid index in event_route blocks list */ _sr_core_ert_list.init_parse_error = route_get(&event_rt, "core:receive-parse-error"); - if(_sr_core_ert_list.init_parse_error <= 0 + if(_sr_core_ert_list.init_parse_error < 0 || event_rt.rlist[_sr_core_ert_list.init_parse_error] == NULL) { _sr_core_ert_list.init_parse_error = -1; } else { @@ -59,23 +59,29 @@ void sr_core_ert_init(void) /** * */ -void sr_core_ert_run(sip_msg_t *msg, int e) +int sr_core_ert_run(sip_msg_t *msg, int e) { struct run_act_ctx ctx; int rtb; switch(e) { case SR_CORE_ERT_RECEIVE_PARSE_ERROR: - if(likely(_sr_core_ert_list.init_parse_error <= 0)) - return; + if(likely(_sr_core_ert_list.init_parse_error < 0)) { + /* no event route defined */ + return 0; + } rtb = get_route_type(); set_route_type(REQUEST_ROUTE); init_run_actions_ctx(&ctx); run_top_route(event_rt.rlist[_sr_core_ert_list.init_parse_error], msg, &ctx); set_route_type(rtb); + if(ctx.run_flags & DROP_R_F) { + return -1; + } break; } + return 0; } /** diff --git a/src/core/events.h b/src/core/events.h index 297abba79..010ce6b6d 100644 --- a/src/core/events.h +++ b/src/core/events.h @@ -88,7 +88,7 @@ int sr_event_enabled(int type); #define SR_CORE_ERT_RECEIVE_PARSE_ERROR 1 void sr_core_ert_init(void); -void sr_core_ert_run(sip_msg_t *msg, int e); +int sr_core_ert_run(sip_msg_t *msg, int e); int sr_core_ert_run_xname(char *evname); typedef void (*sr_corecb_void_f)(void); diff --git a/src/core/hashes.h b/src/core/hashes.h index f4d25de85..99bf1937e 100644 --- a/src/core/hashes.h +++ b/src/core/hashes.h @@ -35,27 +35,33 @@ * char* p, and unsigned v temporary vars (used) * unsigned h - result * h should be initialized (e.g. set it to 0), the result in h */ -#define hash_update_str(s, end, p, v, h) \ - do { \ - for((p) = (s); (p) <= ((end)-4); (p) += 4) { \ - (v) = (*(p) << 24) + ((p)[1] << 16) + ((p)[2] << 8) + (p)[3]; \ - (h) += (v) ^ ((v) >> 3); \ - } \ - switch((end) - (p)) { \ - case 3: \ - (v) = (*(p) << 16) + ((p)[1] << 8) + (p)[2]; \ - break; \ - case 2: \ - (v) = (*(p) << 8) + p[1]; \ - break; \ - case 1: \ - (v) = *p; \ - break; \ - default: \ - (v) = 0; \ - break; \ - } \ - (h) += (v) ^ ((v) >> 3); \ +#define hash_update_str(s, end, p, v, h) \ + do { \ + for((p) = (s); (p) <= ((end) - 4); (p) += 4) { \ + (v) = (((unsigned int)(unsigned char)(p)[0]) << 24) \ + + (((unsigned int)(unsigned char)(p)[1]) << 16) \ + + (((unsigned int)(unsigned char)(p)[2]) << 8) \ + + (unsigned int)(unsigned char)(p)[3]; \ + (h) += (v) ^ ((v) >> 3); \ + } \ + switch((end) - (p)) { \ + case 3: \ + (v) = (((unsigned int)(unsigned char)(p)[0]) << 16) \ + + (((unsigned int)(unsigned char)(p)[1]) << 8) \ + + (unsigned int)(unsigned char)(p)[2]; \ + break; \ + case 2: \ + (v) = (((unsigned int)(unsigned char)(p)[0]) << 8) \ + + (unsigned int)(unsigned char)p[1]; \ + break; \ + case 1: \ + (v) = (unsigned int)(unsigned char)*p; \ + break; \ + default: \ + (v) = 0; \ + break; \ + } \ + (h) += (v) ^ ((v) >> 3); \ } while(0) /** like hash_update_str, but case insensitive @@ -64,19 +70,22 @@ * char* p, and unsigned v temporary vars (used) * unsigned h - result * h should be initialized (e.g. set it to 0), the result in h */ -#define hash_update_case_str(s, end, p, v, h) \ - do { \ - for((p) = (s); (p) <= ((end)-4); (p) += 4) { \ - (v) = ((*(p) << 24) + ((p)[1] << 16) + ((p)[2] << 8) + (p)[3]) \ - | 0x20202020; \ - (h) += (v) ^ ((v) >> 3); \ - } \ - (v) = 0; \ - for(; (p) < (end); (p)++) { \ - (v) <<= 8; \ - (v) += *(p) | 0x20; \ - } \ - (h) += (v) ^ ((v) >> 3); \ +#define hash_update_case_str(s, end, p, v, h) \ + do { \ + for((p) = (s); (p) <= ((end) - 4); (p) += 4) { \ + (v) = ((((unsigned int)(unsigned char)(p)[0]) << 24) \ + + (((unsigned int)(unsigned char)(p)[1]) << 16) \ + + (((unsigned int)(unsigned char)(p)[2]) << 8) \ + + (unsigned int)(unsigned char)(p)[3]) \ + | 0x20202020; \ + (h) += (v) ^ ((v) >> 3); \ + } \ + (v) = 0; \ + for(; (p) < (end); (p)++) { \ + (v) <<= 8; \ + (v) += ((unsigned int)(unsigned char)*(p)) | 0x20; \ + } \ + (h) += (v) ^ ((v) >> 3); \ } while(0) @@ -119,35 +128,39 @@ inline static unsigned int get_hash1_raw(const char *s, int len) /** a little slower than hash_* , but better distribution for * numbers and about the same for strings */ -#define hash_update_str2(s, end, p, v, h) \ - do { \ - for((p) = (s); (p) <= ((end)-4); (p) += 4) { \ - (v) = (*(p)*16777213) + ((p)[1] * 65537) + ((p)[2] * 257) \ - + (p)[3]; \ - (h) = 16777259 * (h) + ((v) ^ ((v) << 17)); \ - } \ - (v) = 0; \ - for(; (p) < (end); (p)++) { \ - (v) *= 251; \ - (v) += *(p); \ - } \ - (h) = 16777259 * (h) + ((v) ^ ((v) << 17)); \ +#define hash_update_str2(s, end, p, v, h) \ + do { \ + for((p) = (s); (p) <= ((end) - 4); (p) += 4) { \ + (v) = (((unsigned int)(unsigned char)(p)[0]) * 16777213) \ + + (((unsigned int)(unsigned char)(p)[1]) * 65537) \ + + (((unsigned int)(unsigned char)(p)[2]) * 257) \ + + (unsigned int)(unsigned char)(p)[3]; \ + (h) = 16777259 * (h) + ((v) ^ ((v) << 17)); \ + } \ + (v) = 0; \ + for(; (p) < (end); (p)++) { \ + (v) *= 251; \ + (v) += (unsigned int)(unsigned char)*(p); \ + } \ + (h) = 16777259 * (h) + ((v) ^ ((v) << 17)); \ } while(0) /** like hash_update_str2 but case insensitive */ -#define hash_update_case_str2(s, end, p, v, h) \ - do { \ - for((p) = (s); (p) <= ((end)-4); (p) += 4) { \ - (v) = ((*(p) | 0x20) * 16777213) + (((p)[1] | 0x20) * 65537) \ - + (((p)[2] | 0x20) * 257) + ((p)[3] | 0x20); \ - (h) = 16777259 * (h) + ((v) ^ ((v) << 17)); \ - } \ - (v) = 0; \ - for(; (p) < (end); (p)++) { \ - (v) *= 251; \ - (v) += *(p) | 0x20; \ - } \ - (h) = 16777259 * (h) + ((v) ^ ((v) << 17)); \ +#define hash_update_case_str2(s, end, p, v, h) \ + do { \ + for((p) = (s); (p) <= ((end) - 4); (p) += 4) { \ + (v) = ((((unsigned int)(unsigned char)(p)[0]) | 0x20) * 16777213) \ + + ((((unsigned int)(unsigned char)(p)[1]) | 0x20) * 65537) \ + + ((((unsigned int)(unsigned char)(p)[2]) | 0x20) * 257) \ + + (((unsigned int)(unsigned char)(p)[3]) | 0x20); \ + (h) = 16777259 * (h) + ((v) ^ ((v) << 17)); \ + } \ + (v) = 0; \ + for(; (p) < (end); (p)++) { \ + (v) *= 251; \ + (v) += ((unsigned int)(unsigned char)(p)[0]) | 0x20; \ + } \ + (h) = 16777259 * (h) + ((v) ^ ((v) << 17)); \ } while(0) /** internal use: call it to adjust the h from hash_update_str */ @@ -279,26 +292,32 @@ static inline unsigned int core_hash( end = s1->s + s1->len; for(p = s1->s; p <= (end - 4); p += 4) { - v = ((unsigned int)p[0] << 24) + (p[1] << 16) + (p[2] << 8) + p[3]; + v = ((unsigned int)(unsigned char)p[0] << 24) + + ((unsigned int)(unsigned char)p[1] << 16) + + ((unsigned int)(unsigned char)p[2] << 8) + + (unsigned int)(unsigned char)p[3]; ch_h_inc; } v = 0; for(; p < end; p++) { v <<= 8; - v += *p; + v += (unsigned int)(unsigned char)*p; } ch_h_inc; if(s2) { end = s2->s + s2->len; for(p = s2->s; p <= (end - 4); p += 4) { - v = ((unsigned int)p[0] << 24) + (p[1] << 16) + (p[2] << 8) + p[3]; + v = ((unsigned int)(unsigned char)p[0] << 24) + + ((unsigned int)(unsigned char)p[1] << 16) + + ((unsigned int)(unsigned char)p[2] << 8) + + (unsigned int)(unsigned char)p[3]; ch_h_inc; } v = 0; for(; p < end; p++) { v <<= 8; - v += p[0]; + v += (unsigned int)(unsigned char)p[0]; } ch_h_inc; } diff --git a/src/core/lock_ops.h b/src/core/lock_ops.h index 1d3af914f..f4ad602ca 100644 --- a/src/core/lock_ops.h +++ b/src/core/lock_ops.h @@ -136,6 +136,8 @@ inline static gen_lock_t *lock_init(gen_lock_t *lock) #elif defined USE_POSIX_SEM #include +#include +#include "dprint.h" typedef sem_t gen_lock_t; @@ -148,8 +150,30 @@ inline static gen_lock_t *lock_init(gen_lock_t *lock) return lock; } -#define lock_try(lock) sem_trywait(lock) -#define lock_get(lock) sem_wait(lock) +inline static int lock_try(gen_lock_t *lock) +{ + int ret; + + do { + ret = sem_trywait(lock); + if(ret == -1 && errno != EINTR && errno != EAGAIN) + LM_CRIT("posix: %s (%d)\n", strerror(errno), errno); + } while(ret == -1 && errno == EINTR); + + return ret; +} + +inline static void lock_get(gen_lock_t *lock) +{ + while(sem_wait(lock) == -1) { + if(errno == EINTR) { + continue; + } else { + LM_CRIT("posix: %s (%d)\n", strerror(errno), errno); + } + } +} + #define lock_release(lock) sem_post(lock) diff --git a/src/core/msg_translator.c b/src/core/msg_translator.c index be8f8ee8b..ef87caab5 100644 --- a/src/core/msg_translator.c +++ b/src/core/msg_translator.c @@ -1890,10 +1890,12 @@ int check_boundaries(struct sip_msg *msg, struct dest_info *send_info) str body = {0, 0}; str buf = {0, 0}; str tmp = {0, 0}; - struct str_list *lb = NULL; + struct str_list *lb_f = NULL; struct str_list *lb_t = NULL; + struct str_list *lb_l = NULL; int lb_found = 0; - int t, ret, lb_size; + int t, ret; + int lb_size = 0; char *pb; if(!(msg->msg_flags & FL_BODY_MULTIPART)) { @@ -1928,16 +1930,16 @@ int check_boundaries(struct sip_msg *msg, struct dest_info *send_info) if(find_line_start(b.s, ret, &tmp.s, (unsigned int *)&tmp.len)) { /*LM_DBG("found t[%d] tmp.len[%d]:[%.*s]\n", t, tmp.len, tmp.len, tmp.s);*/ - if(!lb) { - lb = pkg_malloc(sizeof(struct str_list)); - if(!lb) { + if(!lb_f) { + lb_f = pkg_malloc(sizeof(struct str_list)); + if(!lb_f) { PKG_MEM_ERROR; goto error; } - lb->s.s = tmp.s; - lb->s.len = tmp.len; - lb->next = 0; - lb_t = lb; + lb_f->s.s = tmp.s; + lb_f->s.len = tmp.len; + lb_f->next = 0; + lb_t = lb_f; } else { lb_t = append_str_list(tmp.s, tmp.len, &lb_t, &lb_size); } @@ -1949,6 +1951,7 @@ int check_boundaries(struct sip_msg *msg, struct dest_info *send_info) t = 0; } } + lb_l = lb_t; if(lb_found < 2) { LM_ERR("found[%d] wrong number of boundaries\n", lb_found); goto error; @@ -1962,7 +1965,7 @@ int check_boundaries(struct sip_msg *msg, struct dest_info *send_info) } pb = body.s; body.len = 0; - lb_t = lb; + lb_t = lb_f; while(lb_t) { tmp.s = lb_t->s.s; tmp.len = lb_t->s.len; @@ -1989,9 +1992,9 @@ int check_boundaries(struct sip_msg *msg, struct dest_info *send_info) lb_t = NULL; } /* last boundary */ - tmp.s = lb->s.s; - tmp.len = lb->s.len; - tmp.len = get_line(lb->s); + tmp.s = lb_l->s.s; + tmp.len = lb_l->s.len; + tmp.len = get_line(lb_l->s); if(tmp.len != fb.len || strncmp(fb.s, tmp.s, fb.len) != 0) { LM_DBG("last bondary without -- at the end\n"); memcpy(pb, fb.s, fb.len); @@ -1999,9 +2002,9 @@ int check_boundaries(struct sip_msg *msg, struct dest_info *send_info) pb = pb + fb.len; body.len = body.len + fb.len; } else { - memcpy(pb, lb->s.s, lb->s.len); - pb = pb + lb->s.len; - body.len = body.len + lb->s.len; + memcpy(pb, lb_l->s.s, lb_l->s.len); + pb = pb + lb_l->s.len; + body.len = body.len + lb_l->s.len; /*LM_DBG("copy[%d][%.*s]\n", lb->s.len, lb->s.len, pb - lb->s.len);*/ } /*LM_DBG("body[%d][%.*s] expected[%ld]\n", @@ -2028,10 +2031,10 @@ clean: pkg_free(body.s); if(buf.s) pkg_free(buf.s); - while(lb) { - lb_t = lb->next; - pkg_free(lb); - lb = lb_t; + while(lb_f) { + lb_t = lb_f->next; + pkg_free(lb_f); + lb_f = lb_t; } return ret; } @@ -3148,6 +3151,9 @@ char *via_builder(unsigned int *len, sip_msg_t *msg, if(likely(port)) { su2ip_addr(&ip, &send_info->to); con = tcpconn_get(send_info->id, &ip, port, from, 0); + if(con == NULL && from != NULL) { + con = tcpconn_get(send_info->id, &ip, port, NULL, 0); + } } else if(likely(send_info->id)) con = tcpconn_get(send_info->id, 0, 0, 0, 0); else { @@ -3158,8 +3164,9 @@ char *via_builder(unsigned int *len, sip_msg_t *msg, if(con == NULL) { LM_WARN("TCP/TLS connection (id: %d) for WebSocket could not be " - "found - likely it is gone (dst: [%s]:%d)\n", - send_info->id, (port) ? ip_addr2a(&ip) : "", port); + "found - likely it is gone (dst: [%s]:%d) (sock: [%s])\n", + send_info->id, (port) ? ip_addr2a(&ip) : "", port, + (from) ? send_info->send_sock->sock_str.s : "*"); pkg_free(line_buf); return 0; } diff --git a/src/core/parser/digest/param_parser.c b/src/core/parser/digest/param_parser.c index 91411f322..3dfc77f1e 100644 --- a/src/core/parser/digest/param_parser.c +++ b/src/core/parser/digest/param_parser.c @@ -30,8 +30,8 @@ #include "../../trim.h" #include "../../ut.h" -#define LOWER_BYTE(b) ((b) | 0x20) -#define LOWER_DWORD(d) ((d) | 0x20202020) +#define LOWER_BYTE(b) (((unsigned char)(b)) | 0x20) +#define LOWER_DWORD(d) ((d) | 0x20202020U) /* * Parse short (less than 4 bytes) parameter names @@ -74,8 +74,13 @@ * does not allow reading 4-bytes at once from unaligned memory position * (Sparc for example) */ -#define READ(val) \ - (*(val + 0) + (*(val + 1) << 8) + (*(val + 2) << 16) + (*(val + 3) << 24)) +#define READ(val) \ + (((unsigned int)(unsigned char)*((val) + 0)) \ + + (((unsigned int)(unsigned char)*((val) + 1)) << 8) \ + + (((unsigned int)(unsigned char)*((val) + 2)) << 16) \ + + (((unsigned int)(unsigned char)*((val) + 3)) << 24)) + +#define HAVE_CHARS(_p, _n) ((end - (_p)) >= (_n)) #define name_CASE \ @@ -87,15 +92,21 @@ } -#define user_CASE \ - p += 4; \ - val = READ(p); \ - name_CASE; \ +#define user_CASE \ + p += 4; \ + if(!HAVE_CHARS(p, 4)) { \ + goto other; \ + } \ + val = READ(p); \ + name_CASE; \ goto other; #define real_CASE \ p += 4; \ + if(!HAVE_CHARS(p, 1)) { \ + goto other; \ + } \ if(LOWER_BYTE(*p) == 'm') { \ *_type = PAR_REALM; \ p++; \ @@ -105,6 +116,9 @@ #define nonc_CASE \ p += 4; \ + if(!HAVE_CHARS(p, 1)) { \ + goto other; \ + } \ if(LOWER_BYTE(*p) == 'e') { \ *_type = PAR_NONCE; \ p++; \ @@ -121,15 +135,21 @@ } -#define resp_CASE \ - p += 4; \ - val = READ(p); \ - onse_CASE; \ +#define resp_CASE \ + p += 4; \ + if(!HAVE_CHARS(p, 4)) { \ + goto other; \ + } \ + val = READ(p); \ + onse_CASE; \ goto other; #define cnon_CASE \ p += 4; \ + if(!HAVE_CHARS(p, 2)) { \ + goto other; \ + } \ if(LOWER_BYTE(*p) == 'c') { \ p++; \ if(LOWER_BYTE(*p) == 'e') { \ @@ -143,6 +163,9 @@ #define opaq_CASE \ p += 4; \ + if(!HAVE_CHARS(p, 2)) { \ + goto other; \ + } \ if(LOWER_BYTE(*p) == 'u') { \ p++; \ if(LOWER_BYTE(*p) == 'e') { \ @@ -158,6 +181,9 @@ switch(LOWER_DWORD(val)) { \ case _rith_: \ p += 4; \ + if(!HAVE_CHARS(p, 1)) { \ + goto other; \ + } \ if(LOWER_BYTE(*p) == 'm') { \ *_type = PAR_ALGORITHM; \ p++; \ @@ -167,10 +193,13 @@ } -#define algo_CASE \ - p += 4; \ - val = READ(p); \ - rith_CASE; \ +#define algo_CASE \ + p += 4; \ + if(!HAVE_CHARS(p, 4)) { \ + goto other; \ + } \ + val = READ(p); \ + rith_CASE; \ goto other @@ -194,17 +223,16 @@ int parse_param_name(str *_s, dig_par_t *_type) { register char *p; - register int val; + register unsigned int val; char *end; end = _s->s + _s->len; p = _s->s; - val = READ(p); - if(_s->len < 4) { goto other; } + val = READ(p); switch(LOWER_DWORD(val)) { FIRST_QUATERNIONS; @@ -218,11 +246,14 @@ end: _s->s = p; trim_leading(_s); - if(_s->s[0] == '=') { + if(_s->len > 0 && _s->s[0] == '=') { return 0; } other: + if(unlikely(p > end)) { + return -1; /* Parse error */ + } p = q_memchr(p, '=', end - p); if(!p) { return -1; /* Parse error */ diff --git a/src/core/parser/parse_body.c b/src/core/parser/parse_body.c index e2ab0f887..f10e037fb 100644 --- a/src/core/parser/parse_body.c +++ b/src/core/parser/parse_body.c @@ -116,7 +116,7 @@ inline static char *get_multipart_body( goto error; beg = buf; - while((*beg != '\r') && (*beg != '\n')) { + while((beg < buf_end) && (*beg != '\r') && (*beg != '\n')) { while((beg < buf_end) && (*beg != '\n')) beg++; beg++; @@ -135,9 +135,9 @@ inline static char *get_multipart_body( /* CRLF preceding the boundary belongs to the boundary and not to the body */ - if(*(end - 1) == '\n') + if(end > beg && *(end - 1) == '\n') end--; - if(*(end - 1) == '\r') + if(end > beg && *(end - 1) == '\r') end--; if(end < beg) @@ -213,7 +213,7 @@ char *get_body_part(struct sip_msg *msg, unsigned short type, return NULL; /* try to find the content-type header */ - while((*c != '\r') && (*c != '\n')) { + while((c < buf_end) && (*c != '\r') && (*c != '\n')) { if(c + content_type_len >= buf_end) return NULL; diff --git a/src/core/parser/sdp/sdp_helpr_funcs.c b/src/core/parser/sdp/sdp_helpr_funcs.c index 60613ff82..2b8215738 100644 --- a/src/core/parser/sdp/sdp_helpr_funcs.c +++ b/src/core/parser/sdp/sdp_helpr_funcs.c @@ -87,7 +87,7 @@ int get_mixed_part_delimiter(str *body, str *mp_delimiter) /* LM_DBG("<%.*s>\n",body->len,body->s); */ p = str_type.s = body->s; str_type.len = body->len; - while(*p != ';' && p < (body->s + body->len)) + while((p < body->s + body->len) && (*p != ';')) advance(p, 1, str_type, error); p++; str_type.s = p; @@ -510,6 +510,10 @@ int extract_bwidth(str *body, str *bwtype, str *bwwitdth) cp = bwtype->s; len = bwtype->len; cp1 = (char *)ser_memmem(cp, ":", len, 1); + if(cp1 == NULL) { + LM_ERR("invalid encoding in `b=%.*s'\n", bwtype->len, bwtype->s); + return -1; + } len -= cp1 - cp; if(len <= 0) { LM_ERR("invalid encoding in `b=%.*s'\n", bwtype->len, bwtype->s); diff --git a/src/core/receive.c b/src/core/receive.c index 0da624238..d273880b7 100644 --- a/src/core/receive.c +++ b/src/core/receive.c @@ -397,6 +397,9 @@ int receive_msg(char *buf, unsigned int len, receive_info_t *rcv_info) < 0)) { LOG(cfg_get(core, core_cfg, sip_parser_log), "parsing relevant headers failed\n"); + if(sr_core_ert_run(msg, SR_CORE_ERT_RECEIVE_PARSE_ERROR) < 0) { + goto error02; + } } LM_DBG("--- received sip message - %s - call-id: [%.*s] - cseq: [%.*s]\n", (msg->first_line.type == SIP_REQUEST) ? "request" : "reply", diff --git a/src/core/resolve.c b/src/core/resolve.c index c92f19c34..5ad3aa97a 100644 --- a/src/core/resolve.c +++ b/src/core/resolve.c @@ -1061,7 +1061,7 @@ again: rd->name_len = name_len; /* alloc sizeof struct + space for the null terminated name */ rd->rdata = (void *)pkg_malloc( - sizeof(struct cname_rdata) - 1 + head->name_len + 1); + sizeof(struct cname_rdata) - 1 + fullname_rd->name_len + 1); if(unlikely(rd->rdata == 0)) { PKG_MEM_ERROR; goto error_rd; diff --git a/src/core/strutils.c b/src/core/strutils.c index e6d60f74b..ad5c81466 100644 --- a/src/core/strutils.c +++ b/src/core/strutils.c @@ -176,18 +176,24 @@ int unescape_crlf(str *sin, str *sout) /*! \brief Unscape all printable ASCII characters */ int unescape_user(str *sin, str *sout) { - char *at, *p, c; + char *at, c; + int i; + unsigned char h1; + unsigned char h2; if(sin == NULL || sout == NULL || sin->s == NULL || sout->s == NULL || sin->len < 0 || sout->len < sin->len + 1) return -1; at = sout->s; - p = sin->s; - while(p < sin->s + sin->len) { - if(*p == '%') { - p++; - switch(*p) { + for(i = 0; i < sin->len; i++) { + if(sin->s[i] == '%') { + if(i + 2 >= sin->len) { + LM_ERR("incomplete escaped sequence at end of string\n"); + return -1; + } + h1 = (unsigned char)sin->s[++i]; + switch(h1) { case '0': case '1': case '2': @@ -198,7 +204,7 @@ int unescape_user(str *sin, str *sout) case '7': case '8': case '9': - c = (*p - '0') << 4; + c = (h1 - '0') << 4; break; case 'a': case 'b': @@ -206,7 +212,7 @@ int unescape_user(str *sin, str *sout) case 'd': case 'e': case 'f': - c = (*p - 'a' + 10) << 4; + c = (h1 - 'a' + 10) << 4; break; case 'A': case 'B': @@ -214,14 +220,14 @@ int unescape_user(str *sin, str *sout) case 'D': case 'E': case 'F': - c = (*p - 'A' + 10) << 4; + c = (h1 - 'A' + 10) << 4; break; default: - LM_ERR("invalid hex digit <%u>\n", (unsigned int)*p); + LM_ERR("invalid hex digit <%u>\n", (unsigned int)h1); return -1; } - p++; - switch(*p) { + h2 = (unsigned char)sin->s[++i]; + switch(h2) { case '0': case '1': case '2': @@ -232,7 +238,7 @@ int unescape_user(str *sin, str *sout) case '7': case '8': case '9': - c = c + (*p - '0'); + c = c + (h2 - '0'); break; case 'a': case 'b': @@ -240,7 +246,7 @@ int unescape_user(str *sin, str *sout) case 'd': case 'e': case 'f': - c = c + (*p - 'a' + 10); + c = c + (h2 - 'a' + 10); break; case 'A': case 'B': @@ -248,10 +254,10 @@ int unescape_user(str *sin, str *sout) case 'D': case 'E': case 'F': - c = c + (*p - 'A' + 10); + c = c + (h2 - 'A' + 10); break; default: - LM_ERR("invalid hex digit <%u>\n", (unsigned int)*p); + LM_ERR("invalid hex digit <%u>\n", (unsigned int)h2); return -1; } if((c < 32) || (c > 126)) { @@ -260,9 +266,8 @@ int unescape_user(str *sin, str *sout) } *at++ = c; } else { - *at++ = *p; + *at++ = sin->s[i]; } - p++; } *at = 0; @@ -570,11 +575,14 @@ int cmp_str_params(str *s1, str *s2) param_t *pl2 = NULL; param_hooks_t phooks2; param_t *pit2 = NULL; + int ret = 0; if(parse_params(s1, CLASS_ANY, &phooks1, &pl1) < 0) return -1; - if(parse_params(s2, CLASS_ANY, &phooks2, &pl2) < 0) + if(parse_params(s2, CLASS_ANY, &phooks2, &pl2) < 0) { + free_params(pl1); return -1; + } for(pit1 = pl1; pit1; pit1 = pit1->next) { for(pit2 = pl2; pit2; pit2 = pit2->next) { if(pit1->name.len == pit2->name.len @@ -583,12 +591,17 @@ int cmp_str_params(str *s1, str *s2) if(pit1->body.len != pit2->body.len || strncasecmp( pit1->body.s, pit2->body.s, pit2->body.len) - != 0) - return 1; + != 0) { + ret = 1; + goto done; + } } } } - return 0; +done: + free_params(pl1); + free_params(pl2); + return ret; } /** @@ -894,23 +907,26 @@ int urlencode(str *sin, str *sout) */ int urldecode(str *sin, str *sout) { - char *at, *p; + char *at; + int i; - at = sout->s; - p = sin->s; + if(sin == NULL || sout == NULL || sin->s == NULL || sout->s == NULL + || sin->len < 0 || sout->len < sin->len + 1) + return -1; - while(p < sin->s + sin->len) { - if(*p == '%') { - if(p[1] && p[2]) { - *at++ = hex_to_char(p[1]) << 4 | hex_to_char(p[2]); - p += 2; + at = sout->s; + for(i = 0; i < sin->len; i++) { + if(sin->s[i] == '%') { + if(i + 2 < sin->len) { + *at++ = (((unsigned char)hex_to_char(sin->s[i + 1])) << 4) + | (unsigned char)hex_to_char(sin->s[i + 2]); + i += 2; } - } else if(*p == '+') { + } else if(sin->s[i] == '+') { *at++ = ' '; } else { - *at++ = *p; + *at++ = sin->s[i]; } - p++; } *at = 0; @@ -937,12 +953,22 @@ void ksr_str_json_escape(str *s_in, str *s_out, int *emode) return; } for(i = 0; i < s_in->len; i++) { - if(strchr("\"\\\b\f\n\r\t", s_in->s[i])) { - len += 2; - } else if(s_in->s[i] < 32) { - len += 6; - } else { - len++; + switch(s_in->s[i]) { + case '\"': + case '\\': + case '\b': + case '\f': + case '\n': + case '\r': + case '\t': + len += 2; + break; + default: + if((unsigned char)s_in->s[i] < 32) { + len += 6; + } else { + len++; + } } } if(len == s_in->len) { diff --git a/src/core/tcp_main.c b/src/core/tcp_main.c index 71d928303..a72163e9e 100644 --- a/src/core/tcp_main.c +++ b/src/core/tcp_main.c @@ -1781,7 +1781,7 @@ struct tcp_connection *_tcpconn_find(int id, struct ip_addr *ip, int port, a->parent->id); #ifdef USE_TLS - if(tls_connection_match_domain + if(tls_connection_match_domain && a->parent->type == PROTO_TLS && !tls_hook_call(match_domain, 1, a->parent, ip, port)) continue; #endif diff --git a/src/core/utils/srjson.c b/src/core/utils/srjson.c index 70a4d7511..22dab2da5 100644 --- a/src/core/utils/srjson.c +++ b/src/core/utils/srjson.c @@ -227,6 +227,24 @@ static char *print_number(srjson_doc_t *doc, srjson_t *item) /* Parse the input text into an unescaped cstring, and populate item. */ static const unsigned char firstByteMark[7] = { 0x00, 0x00, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC}; +static int srjson_is_hex4(const char *ptr) +{ + int i; + + if(ptr == NULL) { + return 0; + } + + for(i = 0; i < 4; i++) { + if(!((ptr[i] >= '0' && ptr[i] <= '9') + || (ptr[i] >= 'a' && ptr[i] <= 'f') + || (ptr[i] >= 'A' && ptr[i] <= 'F'))) { + return 0; + } + } + + return 1; +} static const char *parse_string( srjson_doc_t *doc, srjson_t *item, const char *str) { @@ -239,12 +257,30 @@ static const char *parse_string( ep = str; return 0; } /* not a string! */ - while(*ptr != '\"' && *ptr && ++len) - if(*ptr++ == '\\') - ptr++; /* Skip escaped quotes. */ + while(*ptr != '\"' && *ptr) { + if(*ptr++ == '\\') { + if(*ptr == 'u') { + if(!srjson_is_hex4(ptr + 1)) { + ep = ptr; + return 0; + } + len += 6; + ptr += 5; + continue; + } + if(*ptr == '\0') { + ep = ptr; + return 0; + } + len += 2; + ptr++; + continue; + } + len++; + } out = (char *)doc->malloc_fn(len + 1); /* This is how long we need - * for the string, roughly. */ + * for the string, roughly. */ if(!out) return 0; @@ -273,8 +309,11 @@ static const char *parse_string( break; case 'u': /* transcode utf16 to utf8. */ uc = 0; - if(sscanf(ptr + 1, "%4x", &uc) < 1) { - break; + if(!srjson_is_hex4(ptr + 1) + || sscanf(ptr + 1, "%4x", &uc) != 1) { + ep = ptr; + doc->free_fn(out); + return 0; } ptr += 4; /* get the unicode char. */ @@ -288,8 +327,11 @@ static const char *parse_string( break; uc2 = 0; //missing second - half of surrogate. - if(sscanf(ptr + 3, "%4x", &uc2) < 1) { - break; + if(!srjson_is_hex4(ptr + 3) + || sscanf(ptr + 3, "%4x", &uc2) != 1) { + ep = ptr; + doc->free_fn(out); + return 0; } ptr += 6; if(uc2 < 0xDC00 || uc2 > 0xDFFF) diff --git a/src/lib/srdb1/schema/version.xml b/src/lib/srdb1/schema/version.xml index 6607498f7..b2778e98e 100644 --- a/src/lib/srdb1/schema/version.xml +++ b/src/lib/srdb1/schema/version.xml @@ -7,7 +7,7 @@ ]> > + xmlns:db="http://docbook.org/ns/docbook"> version1&MYSQL_TABLE_TYPE; diff --git a/src/modules/acc_json/README b/src/modules/acc_json/README index ee657ade0..bc9087e71 100644 --- a/src/modules/acc_json/README +++ b/src/modules/acc_json/README @@ -34,7 +34,7 @@ Julien Chavanton 3.1. acc_flag (integer) 3.2. acc_missed_flag (integer) 3.3. acc_extra (string) - 3.4. acc_json_pre_encoded_prefix (string) + 3.4. acc_pre_encoded_prefix (string) 3.5. acc_time_mode (integer) 3.6. acc_time_format (str) 3.7. acc_output_mqueue (integer) @@ -56,7 +56,7 @@ Julien Chavanton 1.1. acc_flag example 1.2. acc_missed_flag example 1.3. acc_extra example - 1.4. acc_json_pre_encoded_prefix example + 1.4. acc_pre_encoded_prefix example 1.5. acc_time_mode example 1.6. acc_time_format example 1.7. acc_output_mqueue usage example @@ -87,7 +87,7 @@ Chapter 1. Admin Guide 3.1. acc_flag (integer) 3.2. acc_missed_flag (integer) 3.3. acc_extra (string) - 3.4. acc_json_pre_encoded_prefix (string) + 3.4. acc_pre_encoded_prefix (string) 3.5. acc_time_mode (integer) 3.6. acc_time_format (str) 3.7. acc_output_mqueue (integer) @@ -138,7 +138,7 @@ Chapter 1. Admin Guide 3.1. acc_flag (integer) 3.2. acc_missed_flag (integer) 3.3. acc_extra (string) - 3.4. acc_json_pre_encoded_prefix (string) + 3.4. acc_pre_encoded_prefix (string) 3.5. acc_time_mode (integer) 3.6. acc_time_format (str) 3.7. acc_output_mqueue (integer) @@ -190,17 +190,17 @@ modparam("acc_json", "acc_missed_flag", 3) modparam("acc_json", "acc_extra", "via=$hdr(Via[*]); email=$avp(s:email)") ... -3.4. acc_json_pre_encoded_prefix (string) +3.4. acc_pre_encoded_prefix (string) Prefix to identify values that will be considered to be already json encoded. Default value is NULL. - Example 1.4. acc_json_pre_encoded_prefix example + Example 1.4. acc_pre_encoded_prefix example ... modparam("acc_json", "acc_extra", "json_data=$avp(json_data);") -modparam("acc_json", "acc_json_pre_encoded_prefix", "json_") +modparam("acc_json", "acc_pre_encoded_prefix", "json_") ... $avp(json_data) = '{"b":2, "c":3}'; ... diff --git a/src/modules/acc_json/doc/acc_json_admin.xml b/src/modules/acc_json/doc/acc_json_admin.xml index 8d3ae12bf..1522cf68f 100644 --- a/src/modules/acc_json/doc/acc_json_admin.xml +++ b/src/modules/acc_json/doc/acc_json_admin.xml @@ -121,8 +121,8 @@ modparam("acc_json", "acc_extra", "via=$hdr(Via[*]); email=$avp(s:email)") -
- <varname>acc_json_pre_encoded_prefix</varname> (string) +
+ <varname>acc_pre_encoded_prefix</varname> (string) Prefix to identify values that will be considered to be already json encoded. @@ -130,11 +130,11 @@ modparam("acc_json", "acc_extra", "via=$hdr(Via[*]); email=$avp(s:email)") Default value is NULL. - acc_json_pre_encoded_prefix example + acc_pre_encoded_prefix example ... modparam("acc_json", "acc_extra", "json_data=$avp(json_data);") -modparam("acc_json", "acc_json_pre_encoded_prefix", "json_") +modparam("acc_json", "acc_pre_encoded_prefix", "json_") ... $avp(json_data) = '{"b":2, "c":3}'; ... diff --git a/src/modules/app_lua/CMakeLists.txt b/src/modules/app_lua/CMakeLists.txt index 30e3d652f..9eff659df 100644 --- a/src/modules/app_lua/CMakeLists.txt +++ b/src/modules/app_lua/CMakeLists.txt @@ -4,17 +4,63 @@ add_library(${module_name} SHARED ${MODULE_SOURCES}) option(LUAJIT "Enable LuaJIT (for app_lua modules)" OFF) +set(_ksr_lua_version_default "") +if(DEFINED ENV{KSR_LUA_VERSION} AND NOT "$ENV{KSR_LUA_VERSION}" STREQUAL "") + set(_ksr_lua_version_default "$ENV{KSR_LUA_VERSION}") +endif() +set(KSR_LUA_VERSION + "${_ksr_lua_version_default}" + CACHE STRING "Lua version to use for app_lua (for example: 5.1, 5.2, 5.3, 5.4)" +) + if(LUAJIT) find_package(PkgConfig REQUIRED) pkg_check_modules(LUA REQUIRED IMPORTED_TARGET luajit) + set(LUA_INCLUDE_DIR ${LUA_INCLUDE_DIRS}) else() - find_package(Lua REQUIRED) - # CMake FindLua defines include as LUA_INCLUDE_DIR and lib as LUA_LIBRARIES - set(LUA_INCLUDE_DIRS ${LUA_INCLUDE_DIR}) + if(KSR_LUA_VERSION) + find_package(Lua ${KSR_LUA_VERSION} QUIET) + if(Lua_FOUND) + message(STATUS "app_lua using Lua ${KSR_LUA_VERSION} via find_package(Lua)") + else() + find_package(PkgConfig REQUIRED) + string(REPLACE "." "" _ksr_lua_version_nodot "${KSR_LUA_VERSION}") + set(_ksr_lua_pkg_found FALSE) + foreach(_ksr_lua_pkg lua${KSR_LUA_VERSION} lua-${KSR_LUA_VERSION} + lua${_ksr_lua_version_nodot} + ) + if(NOT _ksr_lua_pkg_found) + pkg_check_modules(LUA QUIET ${_ksr_lua_pkg}) + if(LUA_FOUND) + set(_ksr_lua_pkg_found TRUE) + message( + STATUS "app_lua using pkg-config module '${_ksr_lua_pkg}' for Lua ${KSR_LUA_VERSION}" + ) + endif() + endif() + endforeach() + if(NOT _ksr_lua_pkg_found) + message( + FATAL_ERROR + "Could not find Lua version '${KSR_LUA_VERSION}' for app_lua. " + "Set KSR_LUA_VERSION (or environment KSR_LUA_VERSION/LUA_VERSION) " + "to an installed version such as 5.1, 5.2, 5.3 or 5.4." + ) + endif() + set(LUA_INCLUDE_DIR ${LUA_INCLUDE_DIRS}) + endif() + else() + find_package(Lua) + endif() + if(NOT Lua_FOUND AND NOT LUA_FOUND) + find_package(PkgConfig REQUIRED) + pkg_check_modules(LUA REQUIRED IMPORTED_TARGET lua) + set(LUA_INCLUDE_DIR ${LUA_INCLUDE_DIRS}) + endif() endif() # the LUA_COMPAT_MODULE fixes this error: - implicit declaration of function # luaL_openlib target_compile_definitions(${module_name} PRIVATE LUA_COMPAT_MODULE) -target_include_directories(${module_name} PRIVATE ${LUA_INCLUDE_DIRS}) +target_include_directories(${module_name} PRIVATE ${LUA_INCLUDE_DIR}) target_link_libraries(${module_name} PRIVATE ${LUA_LIBRARIES}) diff --git a/src/modules/app_perl/Makefile b/src/modules/app_perl/Makefile index 36820a3c8..cbbd5e0be 100644 --- a/src/modules/app_perl/Makefile +++ b/src/modules/app_perl/Makefile @@ -11,7 +11,7 @@ LIBS= PERLBIN ?= perl ifeq ($(PERLLDOPTS),) - LIBS+=`$(PERLBIN) -MExtUtils::Embed -e ldopts` + LIBS+=$(shell $(PERLBIN) -MExtUtils::Embed -e ldopts) else LIBS+=$(PERLLDOPTS) endif @@ -23,11 +23,11 @@ DEFS+=$(PERLCCOPTS) SERLIBPATH=../../lib -PODFILES=kamailioxs.xs `find lib/perl -name *.pm` +PODFILES=kamailioxs.xs $(shell find lib/perl -name *.pm) ifeq ($(TYPEMAP),) ifeq ($(PERLLIBPATH),) - PERLLIBPATH=`$(PERLBIN) -MConfig -e 'print $$Config{installprivlib}'` + PERLLIBPATH=$(shell $(PERLBIN) -MConfig -e 'print $$Config{installprivlib}') endif TYPEMAP=$(PERLLIBPATH)/ExtUtils/typemap endif @@ -69,4 +69,3 @@ install-perl-scripts: $(modules_prefix)/$(lib_dir)/perl/Kamailio/VDB/Adapter install-scripts: install-perl-scripts - diff --git a/src/modules/auth/auth_mod.c b/src/modules/auth/auth_mod.c index 58496ce05..33fde8cf4 100644 --- a/src/modules/auth/auth_mod.c +++ b/src/modules/auth/auth_mod.c @@ -522,22 +522,39 @@ static int ki_auth_algorithm(sip_msg_t *msg, str *alg) { auth_algorithm = *alg; - if(strcmp(auth_algorithm.s, "MD5") == 0) { + if(auth_algorithm.len == auth_algorithm_list[AUTH_ALG_MD5_IDX].len + && strncmp(auth_algorithm.s, + auth_algorithm_list[AUTH_ALG_MD5_IDX].s, + auth_algorithm.len) + == 0) { auth_algorithm = auth_algorithm_list[AUTH_ALG_MD5_IDX]; hash_hex_len = HASHHEXLEN; calc_HA1 = calc_HA1_md5; calc_response = calc_response_md5; - } else if(strcmp(auth_algorithm.s, "SHA-256") == 0) { + } else if(auth_algorithm.len == auth_algorithm_list[AUTH_ALG_SHA256_IDX].len + && strncmp(auth_algorithm.s, + auth_algorithm_list[AUTH_ALG_SHA256_IDX].s, + auth_algorithm.len) + == 0) { auth_algorithm = auth_algorithm_list[AUTH_ALG_SHA256_IDX]; hash_hex_len = HASHHEXLEN_SHA256; calc_HA1 = calc_HA1_sha256; calc_response = calc_response_sha256; - } else if(strcmp(auth_algorithm.s, "SHA-512-256") == 0) { + } else if(auth_algorithm.len + == auth_algorithm_list[AUTH_ALG_SHA512_256_IDX].len + && strncmp(auth_algorithm.s, + auth_algorithm_list[AUTH_ALG_SHA512_256_IDX].s, + auth_algorithm.len) + == 0) { auth_algorithm = auth_algorithm_list[AUTH_ALG_SHA512_256_IDX]; hash_hex_len = HASHHEXLEN_SHA512_256; calc_HA1 = calc_HA1_sha512_256; calc_response = calc_response_sha512_256; - } else if(strcmp(auth_algorithm.s, "SHA-512") == 0) { + } else if(auth_algorithm.len == auth_algorithm_list[AUTH_ALG_SHA512_IDX].len + && strncmp(auth_algorithm.s, + auth_algorithm_list[AUTH_ALG_SHA512_IDX].s, + auth_algorithm.len) + == 0) { auth_algorithm = auth_algorithm_list[AUTH_ALG_SHA512_IDX]; hash_hex_len = HASHHEXLEN_SHA512; calc_HA1 = calc_HA1_sha512; @@ -648,6 +665,12 @@ int pv_authenticate(struct sip_msg *msg, str *realm, str *passwd, int flags, HA_MD5, &cred->digest.username.whole, realm, passwd, 0, 0, ha1); LM_DBG("HA1 string calculated: %s\n", ha1); } else { + if(passwd->len >= (int)sizeof(ha1)) { + LM_ERR("HA1 value too long: %d (max %lu)\n", passwd->len, + (unsigned long)(sizeof(ha1) - 1)); + ret = AUTH_ERROR; + goto end; + } memcpy(ha1, passwd->s, passwd->len); ha1[passwd->len] = '\0'; } @@ -1353,6 +1376,12 @@ static int w_auth_get_www_authenticate( val.rs.s = pv_get_buffer(); val.rs.len = 0; if(hf.s != NULL) { + if(hf.len + 1 >= pv_get_buffer_size()) { + LM_ERR("challenge header is too large for pv buffer: %d > %d\n", + hf.len + 1, pv_get_buffer_size()); + pkg_free(hf.s); + return -1; + } memcpy(val.rs.s, hf.s, hf.len); val.rs.len = hf.len; val.rs.s[val.rs.len] = '\0'; @@ -1419,6 +1448,12 @@ static int ki_auth_get_www_authenticate( val.rs.s = pv_get_buffer(); val.rs.len = 0; if(hf.s != NULL) { + if(hf.len + 1 >= pv_get_buffer_size()) { + LM_ERR("challenge header is too large for pv buffer: %d > %d\n", + hf.len + 1, pv_get_buffer_size()); + pkg_free(hf.s); + return -1; + } memcpy(val.rs.s, hf.s, hf.len); val.rs.len = hf.len; val.rs.s[val.rs.len] = '\0'; diff --git a/src/modules/auth_db/auth_db_mod.c b/src/modules/auth_db/auth_db_mod.c index 070d24ff0..1b153c1d8 100644 --- a/src/modules/auth_db/auth_db_mod.c +++ b/src/modules/auth_db/auth_db_mod.c @@ -337,10 +337,11 @@ static int auth_check_fixup(void **param, int param_no) int parse_aaa_pvs(char *definition, pv_elem_t **pv_def, int *cnt) { pv_elem_t *pve; - str pv; + str pv = STR_NULL; char *p; char *end; char *sep; + int pv_alloc = 0; p = definition; if(p == 0 || *p == 0) @@ -392,6 +393,7 @@ int parse_aaa_pvs(char *definition, pv_elem_t **pv_def, int *cnt) PKG_MEM_ERROR; goto error; } + pv_alloc = 1; pv.len = snprintf(pv.s, pve->text.len + 7, "$avp(%.*s)", pve->text.len, pve->text.s); } @@ -404,6 +406,11 @@ int parse_aaa_pvs(char *definition, pv_elem_t **pv_def, int *cnt) LM_ERR("PV is not writeable: %.*s\n", pv.len, pv.s); goto parse_error; } + if(pv_alloc) { + pkg_free(pv.s); + pv.s = NULL; + pv_alloc = 0; + } /* link the element */ pve->next = *pv_def; @@ -425,6 +432,8 @@ parse_error: LM_ERR("parse failed in \"%s\" at pos %d(%s)\n", definition, (int)(long)(p - definition), p); error: + if(pv_alloc && pv.s != NULL) + pkg_free(pv.s); pkg_free(pve); pv_elem_free_all(*pv_def); *pv_def = 0; diff --git a/src/modules/auth_db/authorize.c b/src/modules/auth_db/authorize.c index f1c4b6d62..e36e67b05 100644 --- a/src/modules/auth_db/authorize.c +++ b/src/modules/auth_db/authorize.c @@ -43,6 +43,7 @@ #include "auth_db_mod.h" #include "authorize.h" +#define AUTHDB_HA1BUF_SIZE 256 int fetch_credentials( sip_msg_t *msg, str *user, str *domain, str *table, int flags) @@ -133,6 +134,7 @@ static inline int get_ha1(struct username *_username, str *_domain, const str *_table, char *_ha1, db1_res_t **res) { pv_elem_t *cred; + db_val_t *dbv; db_key_t keys[2]; db_val_t vals[2]; db_key_t *col; @@ -190,8 +192,39 @@ static inline int get_ha1(struct username *_username, str *_domain, return 1; } - result.s = (char *)ROW_VALUES(RES_ROWS(*res))[0].val.string_val; - result.len = strlen(result.s); + dbv = &ROW_VALUES(RES_ROWS(*res))[0]; + if(VAL_NULL(dbv)) { + LM_ERR("password/ha1 value is NULL for user '%.*s@%.*s'\n", + _username->user.len, ZSW(_username->user.s), + (use_domain ? (_domain->len) : 0), ZSW(_domain->s)); + return -1; + } + + switch(VAL_TYPE(dbv)) { + case DB1_STRING: + result.s = (char *)VAL_STRING(dbv); + if(result.s == NULL) { + LM_ERR("password/ha1 string value is NULL for user " + "'%.*s@%.*s'\n", + _username->user.len, ZSW(_username->user.s), + (use_domain ? (_domain->len) : 0), ZSW(_domain->s)); + return -1; + } + result.len = strlen(result.s); + break; + case DB1_STR: + result = VAL_STR(dbv); + if(result.s == NULL) { + LM_ERR("password/ha1 str value is NULL for user '%.*s@%.*s'\n", + _username->user.len, ZSW(_username->user.s), + (use_domain ? (_domain->len) : 0), ZSW(_domain->s)); + return -1; + } + break; + default: + LM_ERR("invalid password/ha1 column type: %d\n", VAL_TYPE(dbv)); + return -1; + } if(calc_ha1) { /* Only plaintext passwords are stored in database, @@ -200,6 +233,11 @@ static inline int get_ha1(struct username *_username, str *_domain, HA_MD5, &_username->whole, _domain, &result, 0, 0, _ha1); LM_DBG("HA1 string calculated: %s\n", _ha1); } else { + if(result.len >= AUTHDB_HA1BUF_SIZE) { + LM_ERR("HA1 value too long: %d (max %d)\n", result.len, + AUTHDB_HA1BUF_SIZE - 1); + return -1; + } memcpy(_ha1, result.s, result.len); _ha1[result.len] = '\0'; } @@ -234,7 +272,7 @@ static int generate_avps(struct sip_msg *msg, db1_res_t *db_res) static int digest_authenticate_hdr(sip_msg_t *msg, str *realm, str *table, hdr_types_t hftype, str *method, hdr_field_t **ahdr) { - char ha1[256]; + char ha1[AUTHDB_HA1BUF_SIZE]; auth_cfg_result_t ret; auth_result_t rauth; struct hdr_field *h = NULL; diff --git a/src/modules/auth_diameter/authorize.c b/src/modules/auth_diameter/authorize.c index bdfc2091b..8ffa3ecd2 100644 --- a/src/modules/auth_diameter/authorize.c +++ b/src/modules/auth_diameter/authorize.c @@ -338,22 +338,21 @@ int diameter_authorize(struct hdr_field *hdr, str *p_method, sip_uri_t *uri, goto error1; } } else { - user_name.s = 0; - user_name.len = cred->username.user.len + cred->realm.len; - if(user_name.len > 0) { - user_name.s = ad_malloc(user_name.len); - if(!user_name.s) { - PKG_MEM_ERROR; - goto error; - } - memcpy(user_name.s, cred->username.whole.s, - cred->username.whole.len); - if(cred->username.whole.len > 0) { - user_name.s[cred->username.whole.len] = '@'; - memcpy(user_name.s + cred->username.whole.len + 1, - cred->realm.s, cred->realm.len); - } else - memcpy(user_name.s, cred->realm.s, cred->realm.len); + user_name.len = cred->username.user.len + cred->realm.len + 1; + user_name.s = ad_malloc(user_name.len + 1); + if(!user_name.s) { + PKG_MEM_ERROR; + goto error; + } + if(cred->username.user.len > 0) { + memcpy(user_name.s, cred->username.user.s, + cred->username.user.len); + user_name.s[cred->username.user.len] = '@'; + memcpy(user_name.s + cred->username.user.len + 1, cred->realm.s, + cred->realm.len); + } else { + memcpy(user_name.s, cred->realm.s, cred->realm.len); + user_name.len -= 1; } if((avp = AAACreateAVP(AVP_User_Name, 0, 0, user_name.s, diff --git a/src/modules/auth_radius/sterman.c b/src/modules/auth_radius/sterman.c index e8c5700fe..75a881df1 100644 --- a/src/modules/auth_radius/sterman.c +++ b/src/modules/auth_radius/sterman.c @@ -229,6 +229,9 @@ int radius_authorize_sterman( str method, user, user_name; str *ruri; int extra_cnt, offset, i; + size_t uname_len; + size_t realm_len; + size_t user_name_len; send = received = 0; @@ -240,6 +243,13 @@ int radius_authorize_sterman( method = *_method; user = *_user; + if(_cred->username.whole.len < 0 || _cred->username.user.len < 0 + || _cred->username.domain.len < 0 || _cred->realm.len < 0 + || _cred->nonce.len < 0 || _cred->uri.len < 0) { + LM_ERR("invalid negative digest field length\n"); + return -1; + } + /* * Add all the user digest parameters according to the qop defined. * Most devices tested only offer support for the simplest digest. @@ -251,16 +261,27 @@ int radius_authorize_sterman( goto err; } } else { - user_name.len = _cred->username.user.len + _cred->realm.len + 1; - user_name.s = pkg_malloc(user_name.len); + if(_cred->username.user.s == NULL || _cred->realm.s == NULL) { + LM_ERR("invalid digest username or realm value\n"); + return -1; + } + uname_len = (size_t)_cred->username.user.len; + realm_len = (size_t)_cred->realm.len; + if(uname_len > (size_t)MAX_URI_SIZE + || realm_len > (size_t)MAX_URI_SIZE) { + LM_ERR("digest username/realm too large\n"); + return -1; + } + user_name_len = uname_len + realm_len + 1; + user_name.len = (int)user_name_len; + user_name.s = pkg_mallocxz(user_name_len + 1); if(!user_name.s) { LM_ERR("no pkg memory left\n"); return -3; } - memcpy(user_name.s, _cred->username.whole.s, _cred->username.whole.len); - user_name.s[_cred->username.whole.len] = '@'; - memcpy(user_name.s + _cred->username.whole.len + 1, _cred->realm.s, - _cred->realm.len); + memcpy(user_name.s, _cred->username.user.s, uname_len); + user_name.s[uname_len] = '@'; + memcpy(user_name.s + uname_len + 1, _cred->realm.s, realm_len); if(!rc_avpair_add(rh, &send, attrs[A_USER_NAME].v, user_name.s, user_name.len, 0)) { LM_ERR("unable to add User-Name attribute\n"); diff --git a/src/modules/cdp/peerstatemachine.c b/src/modules/cdp/peerstatemachine.c index 9a57bab00..b7b299370 100644 --- a/src/modules/cdp/peerstatemachine.c +++ b/src/modules/cdp/peerstatemachine.c @@ -869,13 +869,16 @@ void save_peer_applications(peer *p, AAAMessage *msg) int Process_CEA(peer *p, AAAMessage *cea) { AAA_AVP *avp; + int result_code = AAA_UNABLE_TO_COMPLY; + avp = AAAFindMatchingAVP(cea, cea->avpList.head, AVP_Result_Code, 0, 0); save_peer_applications(p, cea); + if(avp && avp->data.len >= 4) { + result_code = get_4bytes(avp->data.s); + } AAAFreeMessage(&cea); - if(!avp) - return AAA_UNABLE_TO_COMPLY; - else - return get_4bytes(avp->data.s); + + return result_code; } /** diff --git a/src/modules/db_cluster/dbcl_api.c b/src/modules/db_cluster/dbcl_api.c index 06c71195f..9b26ae3ea 100644 --- a/src/modules/db_cluster/dbcl_api.c +++ b/src/modules/db_cluster/dbcl_api.c @@ -178,8 +178,8 @@ extern int dbcl_max_query_length; "cluster" \ " [%.*s] (%d/%d) [%.*s]\n", \ cls->name.len, cls->name.s, i, j, \ - cls->rlist[i].clist[j]->name.len, \ - cls->rlist[i].clist[j]->name.s); \ + cls->wlist[i].clist[j]->name.len, \ + cls->wlist[i].clist[j]->name.s); \ sec = get_ticks() - sec; \ if(sec >= dbcl_max_query_length) { \ dbcl_inactive_con(cls->wlist[i].clist[j]); \ @@ -215,8 +215,8 @@ extern int dbcl_max_query_length; "cluster" \ " [%.*s] (%d/%d) [%.*s]\n", \ cls->name.len, cls->name.s, i, j, \ - cls->rlist[i].clist[j]->name.len, \ - cls->rlist[i].clist[j]->name.s); \ + cls->wlist[i].clist[j]->name.len, \ + cls->wlist[i].clist[j]->name.s); \ sec = get_ticks() - sec; \ if(sec >= dbcl_max_query_length) { \ dbcl_inactive_con(cls->wlist[i].clist[j]); \ @@ -248,8 +248,8 @@ extern int dbcl_max_query_length; "cluster" \ " [%.*s] (%d/%d) [%.*s]\n", \ cls->name.len, cls->name.s, i, j, \ - cls->rlist[i].clist[j]->name.len, \ - cls->rlist[i].clist[j]->name.s); \ + cls->wlist[i].clist[j]->name.len, \ + cls->wlist[i].clist[j]->name.s); \ sec = get_ticks() - sec; \ if(sec >= dbcl_max_query_length) { \ dbcl_inactive_con(cls->wlist[i].clist[j]); \ @@ -262,8 +262,8 @@ extern int dbcl_max_query_length; return 0; \ break; \ default: \ - LM_ERR("invalid mode %c (%d)\n", cls->rlist[i].mode, \ - cls->rlist[i].mode); \ + LM_ERR("invalid mode %c (%d)\n", cls->wlist[i].mode, \ + cls->wlist[i].mode); \ return -1; \ } \ } \ @@ -321,8 +321,8 @@ extern int dbcl_max_query_length; "cluster" \ " [%.*s] (%d/%d) [%.*s]\n", \ cls->name.len, cls->name.s, i, j, \ - cls->rlist[i].clist[j]->name.len, \ - cls->rlist[i].clist[j]->name.s); \ + cls->wlist[i].clist[j]->name.len, \ + cls->wlist[i].clist[j]->name.s); \ sec = get_ticks() - sec; \ if(sec >= dbcl_max_query_length) { \ dbcl_inactive_con(cls->wlist[i].clist[j]); \ @@ -364,8 +364,8 @@ extern int dbcl_max_query_length; "cluster" \ " [%.*s] (%d/%d) [%.*s]\n", \ cls->name.len, cls->name.s, i, j, \ - cls->rlist[i].clist[j]->name.len, \ - cls->rlist[i].clist[j]->name.s); \ + cls->wlist[i].clist[j]->name.len, \ + cls->wlist[i].clist[j]->name.s); \ sec = get_ticks() - sec; \ if(sec >= dbcl_max_query_length) { \ dbcl_inactive_con(cls->wlist[i].clist[j]); \ @@ -403,8 +403,8 @@ extern int dbcl_max_query_length; "cluster" \ " [%.*s] (%d/%d) [%.*s]\n", \ cls->name.len, cls->name.s, i, j, \ - cls->rlist[i].clist[j]->name.len, \ - cls->rlist[i].clist[j]->name.s); \ + cls->wlist[i].clist[j]->name.len, \ + cls->wlist[i].clist[j]->name.s); \ sec = get_ticks() - sec; \ if(sec >= dbcl_max_query_length) { \ dbcl_inactive_con(cls->wlist[i].clist[j]); \ @@ -417,8 +417,8 @@ extern int dbcl_max_query_length; return 0; \ break; \ default: \ - LM_ERR("invalid mode %c (%d)\n", cls->rlist[i].mode, \ - cls->rlist[i].mode); \ + LM_ERR("invalid mode %c (%d)\n", cls->wlist[i].mode, \ + cls->wlist[i].mode); \ return -1; \ } \ } \ diff --git a/src/modules/db_mysql/km_my_con.c b/src/modules/db_mysql/km_my_con.c index aad692206..32d6c33a4 100644 --- a/src/modules/db_mysql/km_my_con.c +++ b/src/modules/db_mysql/km_my_con.c @@ -138,11 +138,16 @@ struct my_con *db_mysql_new_connection(const struct db_id *id) switch(db_mysql_opt_ssl_mode) { case 0: /* opt_ssl_mode = 0(off) */ case 1: /* SSL_MODE_DISABLED */ +#if MARIADB_PACKAGE_VERSION_ID >= 30000 + mysql_options(ptr->con, MYSQL_OPT_SSL_ENFORCE, (void *)&(int){0}); + mysql_options(ptr->con, MYSQL_OPT_SSL_VERIFY_SERVER_CERT, + (void *)&(int){0}); +#endif break; case 2: /* SSL_MODE_PREFERRED */ case 3: /* SSL_MODE_REQUIRED */ case 4: /* SSL_MODE_VERIFY_CA */ -#if MYSQL_VERSION_ID >= 100339 +#if MARIADB_PACKAGE_VERSION_ID >= 30000 mysql_options(ptr->con, MYSQL_OPT_SSL_ENFORCE, (void *)&(int){1}); #else LM_DBG("ssl mode not supported by %s\n", MARIADB_BASE_VERSION); @@ -181,7 +186,7 @@ struct my_con *db_mysql_new_connection(const struct db_id *id) #endif /* MYSQL_VERSION_ID */ #endif /* MARIADB_BASE_VERSION */ -#if(MYSQL_VERSION_ID >= 50600) +#if (MYSQL_VERSION_ID >= 50600) if(db_mysql_opt_ssl_ca) mysql_options( ptr->con, MYSQL_OPT_SSL_CA, (const void *)db_mysql_opt_ssl_ca); @@ -208,7 +213,7 @@ struct my_con *db_mysql_new_connection(const struct db_id *id) connection_flag |= CLIENT_FOUND_ROWS; } -#if(MYSQL_VERSION_ID >= 40100) +#if (MYSQL_VERSION_ID >= 40100) if(!mysql_real_connect(ptr->con, host, id->username, id->password, id->database, id->port, 0, connection_flag | CLIENT_MULTI_STATEMENTS)) { diff --git a/src/modules/db_redis/redis_dbase.c b/src/modules/db_redis/redis_dbase.c index 3d0c87be3..055cc699b 100644 --- a/src/modules/db_redis/redis_dbase.c +++ b/src/modules/db_redis/redis_dbase.c @@ -1662,11 +1662,11 @@ static int db_redis_perform_query(const db1_con_t *_h, km_redis_con_t *con, if(!(*keys_count) && do_table_scan) { if(_n > 0) { - LM_WARN("performing full table scan on table '%.*s' while doing " - "the query\n", + LM_DBG("performing full table scan on table '%.*s' while doing " + "the query\n", CON_TABLE(_h)->len, CON_TABLE(_h)->s); for(i = 0; i < _n; ++i) { - LM_WARN(" scan key %d is '%.*s'\n", i, _k[i]->len, _k[i]->s); + LM_DBG(" scan key %d is '%.*s'\n", i, _k[i]->len, _k[i]->s); } } else { LM_DBG("loading full table: '%.*s\n", CON_TABLE(_h)->len, @@ -1854,8 +1854,8 @@ static int db_redis_perform_delete(const db1_con_t *_h, km_redis_con_t *con, if(!*keys_count && do_table_scan) { if(!ts_scan_start) - LM_WARN("performing full table scan on table '%.*s' while " - "performing delete\n", + LM_DBG("performing full table scan on table '%.*s' while " + "performing delete\n", CON_TABLE(_h)->len, CON_TABLE(_h)->s); else LM_DBG("performing table scan on table '%.*s' while performing " @@ -2191,11 +2191,11 @@ static int db_redis_perform_update(const db1_con_t *_h, km_redis_con_t *con, #endif if(!(*keys_count) && do_table_scan) { - LM_WARN("performing full table scan on table '%.*s' while performing " - "update\n", + LM_DBG("performing full table scan on table '%.*s' while performing " + "update\n", CON_TABLE(_h)->len, CON_TABLE(_h)->s); for(i = 0; i < _n; ++i) { - LM_WARN(" scan key %d is '%.*s'\n", i, _k[i]->len, _k[i]->s); + LM_DBG(" scan key %d is '%.*s'\n", i, _k[i]->len, _k[i]->s); } if(db_redis_scan_query_keys(con, CON_TABLE(_h), _n, keys, keys_count, manual_keys, manual_keys_count, ts_scan_start, ts_scan_key, diff --git a/src/modules/dialog/dlg_cseq.c b/src/modules/dialog/dlg_cseq.c index 0ed7ca77d..0c0e062ab 100644 --- a/src/modules/dialog/dlg_cseq.c +++ b/src/modules/dialog/dlg_cseq.c @@ -281,6 +281,10 @@ int dlg_cseq_msg_received(sr_event_param_t *evp) goto done; } + if(!msg.h_via1) { + goto done; + } + via = (struct via_body *)msg.h_via1->parsed; if(via->branch == NULL || via->branch->value.len <= 0) { diff --git a/src/modules/dialog/dlg_handlers.c b/src/modules/dialog/dlg_handlers.c index 822175eb8..56c36143a 100644 --- a/src/modules/dialog/dlg_handlers.c +++ b/src/modules/dialog/dlg_handlers.c @@ -1614,6 +1614,7 @@ void dlg_ontimeout(struct dlg_tl *tl) } } + unref = 0; /* mark dialog as expired */ dlg->dflags |= DLG_FLAG_EXPIRED; @@ -1687,12 +1688,11 @@ void dlg_ontimeout(struct dlg_tl *tl) run_dlg_callbacks( DLGCB_EXPIRED, dlg, NULL, NULL, DLG_DIR_NONE, timeout_cb); - dlg_unref(dlg, unref + 1); - + unref++; if_update_stat(dlg_enable_stats, expired_dlgs, 1); if_update_stat(dlg_enable_stats, active_dlgs, -1); } else { - dlg_unref(dlg, 1); + unref = 1; } if(dlg_enable_dmq && (dlg->iflags & DLG_IFLAG_DMQ_SYNC) @@ -1700,6 +1700,8 @@ void dlg_ontimeout(struct dlg_tl *tl) dlg_dmq_replicate_action(DLG_DMQ_STATE, dlg, 0, 0); } + dlg_unref(dlg, unref); + return; } diff --git a/src/modules/dialog/dlg_hash.c b/src/modules/dialog/dlg_hash.c index 492cad98f..549efbb72 100644 --- a/src/modules/dialog/dlg_hash.c +++ b/src/modules/dialog/dlg_hash.c @@ -239,6 +239,7 @@ int dlg_clean_run(ticks_t ti) tdlg, tdlg->ref); unlink_unsafe_dlg(&d_table->entries[i], tdlg); destroy_dlg(tdlg); + continue; } if(tdlg->state == DLG_STATE_CONFIRMED_NA && tdlg->start_ts > 0 && tdlg->start_ts < tm - dlg_noack_timeout) { @@ -248,6 +249,7 @@ int dlg_clean_run(ticks_t ti) } tdlg->lifetime = 10; tdlg->dflags |= DLG_FLAG_CHANGED; + continue; } if(tdlg->state == DLG_STATE_DELETED && tdlg->end_ts > 0 && tdlg->end_ts < tm - dlg_end_timeout) { @@ -256,6 +258,7 @@ int dlg_clean_run(ticks_t ti) tdlg, tdlg->ref); unlink_unsafe_dlg(&d_table->entries[i], tdlg); destroy_dlg(tdlg); + continue; } } dlg_unlock(d_table, &d_table->entries[i]); diff --git a/src/modules/dispatcher/dispatch.c b/src/modules/dispatcher/dispatch.c index 7580ecf88..86f0d922a 100644 --- a/src/modules/dispatcher/dispatch.c +++ b/src/modules/dispatcher/dispatch.c @@ -4171,6 +4171,12 @@ int ds_is_addr_from_set(sip_msg_t *_m, struct ip_addr *pipaddr, } } } else { + if(node->dlist[j].host.len >= DS_HN_SIZE) { + LM_WARN("hostname too long to resolve (skipping) [%.*s]\n", + node->dlist[j].host.len, node->dlist[j].host.s); + dns_set_local_ttl(0); + continue; + } memcpy(hn, node->dlist[j].host.s, node->dlist[j].host.len); hn[node->dlist[j].host.len] = '\0'; he = resolvehost(hn); @@ -4800,6 +4806,12 @@ void ds_dns_update_set(ds_set_t *node) } else { /* The Hostname needs to be \0 terminated for resolvehost, so we * make a copy here. */ + if(node->dlist[j].host.len >= DS_HN_SIZE) { + LM_ERR("hostname too long to resolve [%.*s]\n", + node->dlist[j].host.len, node->dlist[j].host.s); + dns_set_local_ttl(0); + continue; + } memcpy(hn, node->dlist[j].host.s, node->dlist[j].host.len); hn[node->dlist[j].host.len] = '\0'; he = resolvehost(hn); diff --git a/src/modules/dispatcher/dispatcher.c b/src/modules/dispatcher/dispatcher.c index 5ee3b0eda..08d7611fc 100644 --- a/src/modules/dispatcher/dispatcher.c +++ b/src/modules/dispatcher/dispatcher.c @@ -309,6 +309,7 @@ static param_export_t params[]={ {"ds_ping_from", PARAM_STR, &ds_ping_from}, {"ds_ping_interval", PARAM_INT, &ds_ping_interval}, {"ds_ping_fr_timeout", PARAM_INT, &ds_ping_fr_timeout}, + {"ds_ping_fr_timer", PARAM_INT, &ds_ping_fr_timeout}, {"ds_ping_latency_stats", PARAM_INT, &ds_ping_latency_stats}, {"ds_retain_latency_stats", PARAM_INT, &ds_retain_latency_stats}, {"ds_latency_estimator_alpha", PARAM_INT, &ds_latency_estimator_alpha_i}, @@ -387,7 +388,7 @@ static int mod_init(void) if(cfg_declare("dispatcher", dispatcher_cfg_def, &default_dispatcher_cfg, cfg_sizeof(dispatcher), &dispatcher_cfg)) { - LM_ERR("Fail to declare the configuration\n"); + LM_ERR("fail to declare the configuration\n"); return -1; } /* if the ping-keepalive-timer is enabled the tm-api needs to be loaded */ @@ -864,7 +865,7 @@ static int ki_ds_mark_dst_state(sip_msg_t *msg, str *sval) state = ds_parse_flags(sval->s, sval->len); if(state < 0) { - LM_WARN("Failed to parse state flags: %.*s", sval->len, sval->s); + LM_WARN("failed to parse state flags: %.*s", sval->len, sval->s); return -1; } @@ -895,7 +896,7 @@ static int ki_ds_mark_addr(sip_msg_t *msg, str *vstate, int vgroup, str *vuri) state = ds_parse_flags(vstate->s, vstate->len); if(state < 0) { - LM_WARN("Failed to parse state flags: %.*s", vstate->len, vstate->s); + LM_WARN("failed to parse state flags: %.*s", vstate->len, vstate->s); return -1; } @@ -976,12 +977,12 @@ static int ds_reload(sip_msg_t *msg) if(!ds_db_url.s) { if(ds_load_list(dslistfile) != 0) { - LM_ERR("Error reloading from list\n"); + LM_ERR("failed reloading the list file\n"); return -1; } } else { if(ds_reload_db() < 0) { - LM_ERR("Error reloading from db\n"); + LM_ERR("failed reloading records from db\n"); return -1; } } @@ -1501,9 +1502,13 @@ static int pv_get_dsg(sip_msg_t *msg, pv_param_t *param, pv_value_t *res) case 2: /* inactive */ return pv_get_sintval(msg, param, res, inactive); case 3: /* pactive */ + if(count == 0) + return pv_get_sintval(msg, param, res, 0); return pv_get_sintval( msg, param, res, (int)((active * 100) / count)); case 4: /* pinactive */ + if(count == 0) + return pv_get_sintval(msg, param, res, 0); return pv_get_sintval( msg, param, res, (int)((inactive * 100) / count)); case 5: /* octime_sec */ diff --git a/src/modules/evapi/evapi_dispatch.c b/src/modules/evapi/evapi_dispatch.c index 60060f225..6c32eba5b 100644 --- a/src/modules/evapi/evapi_dispatch.c +++ b/src/modules/evapi/evapi_dispatch.c @@ -64,7 +64,7 @@ typedef struct _evapi_client unsigned short af; unsigned short src_port; char src_addr[EVAPI_IPADDR_SIZE]; - char tag[EVAPI_IPADDR_SIZE]; + char tag[EVAPI_TAG_SIZE]; str stag; char rbuffer[CLIENT_BUFFER_SIZE]; unsigned int rpos; @@ -544,6 +544,14 @@ void evapi_recv_client(struct ev_loop *loop, struct ev_io *watcher, int revents) while(k < _evapi_clients[i].rpos + rlen) { if(_evapi_clients[i].rbuffer[k] >= '0' && _evapi_clients[i].rbuffer[k] <= '9') { + if(frame.len > INT_MAX / 10 + || (_evapi_clients[i].rbuffer[k] - '0') + > (INT_MAX - frame.len * 10)) { + /* overflow - invalid frame */ + LM_ERR("frame length overflow. 10+ digits \n"); + _evapi_clients[i].rpos = 0; + return; + } frame.len = frame.len * 10 + _evapi_clients[i].rbuffer[k] - '0'; } else { diff --git a/src/modules/htable/ht_api.c b/src/modules/htable/ht_api.c index 47b4b9751..48958aa8c 100644 --- a/src/modules/htable/ht_api.c +++ b/src/modules/htable/ht_api.c @@ -116,6 +116,10 @@ int keyvalue_parse_str(str *data, int type, keyvalue_t *res) res->value.len = s.len; res->type = type; if(type == KEYVALUE_TYPE_PARAMS) { + if(s.len <= 0) { + LM_ERR("empty params value\n"); + goto error; + } if(s.s[s.len - 1] == ';') s.len--; if(parse_params(&s, CLASS_ANY, &phooks, &res->u.params) < 0) { @@ -514,7 +518,7 @@ int ht_set_cell_ex( if(exv <= 0) { HT_COPY_EXPIRE(ht, cell, now, it); } else { - it->expire = now + exv; + cell->expire = now + exv; } if(it->prev) it->prev->next = cell; @@ -550,7 +554,7 @@ int ht_set_cell_ex( if(exv <= 0) { HT_COPY_EXPIRE(ht, cell, now, it); } else { - it->expire = now + exv; + cell->expire = now + exv; } cell->next = it->next; @@ -1148,14 +1152,16 @@ void ht_timer(unsigned int ticks, void *param) if(it->expire != 0 && it->expire < now) { /* expired */ ht_handle_expired_record(ht, it); - if(it->prev == NULL) - ht->entries[i].first = it->next; - else - it->prev->next = it->next; - if(it->next) - it->next->prev = it->prev; - ht->entries[i].esize--; - ht_cell_free(it); + if(it->expire < now) { + if(it->prev == NULL) + ht->entries[i].first = it->next; + else + it->prev->next = it->next; + if(it->next) + it->next->prev = it->prev; + ht->entries[i].esize--; + ht_cell_free(it); + } } it = it0; } diff --git a/src/modules/htable/ht_dmq.c b/src/modules/htable/ht_dmq.c index a5fd41f3e..02c107b1a 100644 --- a/src/modules/htable/ht_dmq.c +++ b/src/modules/htable/ht_dmq.c @@ -61,6 +61,21 @@ int ht_dmq_send(str *body, dmq_node_t *node); int ht_dmq_send_sync(dmq_node_t *node, str *htname); int ht_dmq_handle_sync(srjson_doc_t *jdoc); +static inline int ht_dmq_json_get_str(srjson_t *it, str *out, const char *fname) +{ + if(it == NULL || out == NULL) { + LM_ERR("invalid parameters for json string extraction\n"); + return -1; + } + if(it->valuestring == NULL) { + LM_ERR("missing string value for json field [%s]\n", fname); + return -1; + } + out->s = it->valuestring; + out->len = strlen(out->s); + return 0; +} + static int ht_dmq_cell_group_init(void) { @@ -305,6 +320,10 @@ int ht_dmq_handle_msg( goto invalid; } } + if(jdoc.root->child == NULL || jdoc.root->child->string == NULL) { + LM_ERR("invalid json doc: missing root child\n"); + goto invalid; + } if(unlikely(strcmp(jdoc.root->child->string, "cells") == 0)) { ht_dmq_handle_sync(&jdoc); @@ -314,16 +333,16 @@ int ht_dmq_handle_msg( if(strcmp(it->string, "action") == 0) { action = SRJSON_GET_INT(it); } else if(strcmp(it->string, "htname") == 0) { - htname.s = it->valuestring; - htname.len = strlen(htname.s); + if(ht_dmq_json_get_str(it, &htname, "htname") < 0) + goto invalid; } else if(strcmp(it->string, "cname") == 0) { - cname.s = it->valuestring; - cname.len = strlen(cname.s); + if(ht_dmq_json_get_str(it, &cname, "cname") < 0) + goto invalid; } else if(strcmp(it->string, "type") == 0) { type = SRJSON_GET_INT(it); } else if(strcmp(it->string, "strval") == 0) { - val.s.s = it->valuestring; - val.s.len = strlen(val.s.s); + if(ht_dmq_json_get_str(it, &val.s, "strval") < 0) + goto invalid; } else if(strcmp(it->string, "intval") == 0) { val.n = SRJSON_GET_INT(it); } else if(strcmp(it->string, "mode") == 0) { @@ -605,16 +624,16 @@ int ht_dmq_handle_sync(srjson_doc_t *jdoc) while(cell) { for(it = cell->child; it; it = it->next) { if(strcmp(it->string, "htname") == 0) { - htname.s = it->valuestring; - htname.len = strlen(htname.s); + if(ht_dmq_json_get_str(it, &htname, "htname") < 0) + goto invalid; } else if(strcmp(it->string, "cname") == 0) { - cname.s = it->valuestring; - cname.len = strlen(cname.s); + if(ht_dmq_json_get_str(it, &cname, "cname") < 0) + goto invalid; } else if(strcmp(it->string, "type") == 0) { type = SRJSON_GET_INT(it); } else if(strcmp(it->string, "strval") == 0) { - val.s.s = it->valuestring; - val.s.len = strlen(val.s.s); + if(ht_dmq_json_get_str(it, &val.s, "strval") < 0) + goto invalid; } else if(strcmp(it->string, "intval") == 0) { val.n = SRJSON_GET_INT(it); } else if(strcmp(it->string, "expire") == 0) { @@ -642,4 +661,6 @@ int ht_dmq_handle_sync(srjson_doc_t *jdoc) cell = cell->next; } return 0; +invalid: + return -1; } diff --git a/src/modules/http_async_client/README b/src/modules/http_async_client/README index 0caa3d463..3d21b85e4 100644 --- a/src/modules/http_async_client/README +++ b/src/modules/http_async_client/README @@ -497,7 +497,7 @@ http_async_query("https://example.com/test.php", "HTTP_REPLY"); * $http_mb and $http_ml: HTTP response buffer (including headers) and length * $http_rb and $http_bs: HTTP response body and body length - * $http_time: provides access to broken-down transfer time in + * $http_time(name): provides access to broken-down transfer time in microseconds calculated by cURL (https://curl.se/libcurl/c/curl_easy_getinfo.html). 'name' can be: diff --git a/src/modules/http_async_client/async_http.c b/src/modules/http_async_client/async_http.c index 2ece3a9dd..b617c4092 100644 --- a/src/modules/http_async_client/async_http.c +++ b/src/modules/http_async_client/async_http.c @@ -71,11 +71,16 @@ int async_http_init_worker(int prank, async_http_worker_t *worker) { LM_DBG("initializing worker process: %d\n", prank); worker->evbase = event_base_new(); + if(worker->evbase == NULL) { + LM_ERR("failed to create event base\n"); + return -1; + } LM_DBG("base event %p created\n", worker->evbase); worker->g = shm_malloc(sizeof(struct http_m_global)); if(worker->g == NULL) { LM_ERR("out of shared memory\n"); + event_base_free(worker->evbase); return -1; } memset(worker->g, 0, sizeof(http_m_global_t)); @@ -238,6 +243,7 @@ void async_http_cb(struct http_m_reply *reply, void *param) if(tmb.t_lookup_ident(&t, tindex, tlabel) < 0) { LM_ERR("transaction not found %d:%d\n", tindex, tlabel); LM_DBG("freeing query %p\n", aq); + free_sip_msg(ah_reply); free_async_query(aq); return; } @@ -291,6 +297,7 @@ void notification_socket_cb(int fd, short event, void *arg) int received; int i, len; async_query_t *aq; + int dispatched = 0; http_m_params_t query_params; @@ -404,36 +411,42 @@ void notification_socket_cb(int fd, short event, void *arg) if(new_request(&query, &query_params, async_http_cb, aq) < 0) { LM_ERR("Cannot create request for %.*s\n", query.len, query.s); - free_async_query(aq); + } else { + dispatched = 1; } done: - if(query_params.tls_client_cert) { - shm_free(query_params.tls_client_cert); - query_params.tls_client_cert = NULL; - } - if(query_params.tls_client_key) { - shm_free(query_params.tls_client_key); - query_params.tls_client_key = NULL; - } - if(query_params.tls_ca_path) { - shm_free(query_params.tls_ca_path); - query_params.tls_ca_path = NULL; - } - if(query_params.body.s && query_params.body.len > 0) { - shm_free(query_params.body.s); - query_params.body.s = NULL; - query_params.body.len = 0; - } - - if(query_params.username) { - shm_free(query_params.username); - query_params.username = NULL; - } - - if(query_params.password) { - shm_free(query_params.password); - query_params.password = NULL; + if(!dispatched) { + free_async_query(aq); + if(query_params.headers) { + curl_slist_free_all(query_params.headers); + query_params.headers = NULL; + } + if(query_params.tls_client_cert) { + shm_free(query_params.tls_client_cert); + query_params.tls_client_cert = NULL; + } + if(query_params.tls_client_key) { + shm_free(query_params.tls_client_key); + query_params.tls_client_key = NULL; + } + if(query_params.tls_ca_path) { + shm_free(query_params.tls_ca_path); + query_params.tls_ca_path = NULL; + } + if(query_params.body.s && query_params.body.len > 0) { + shm_free(query_params.body.s); + query_params.body.s = NULL; + query_params.body.len = 0; + } + if(query_params.username) { + shm_free(query_params.username); + query_params.username = NULL; + } + if(query_params.password) { + shm_free(query_params.password); + query_params.password = NULL; + } } return; @@ -517,6 +530,8 @@ int async_send_query(sip_msg_t *msg, str *query, str *cbname) aq->query_params.tcp_ka_idle = ah_params.tcp_ka_idle; aq->query_params.tcp_ka_interval = ah_params.tcp_ka_interval; aq->query_params.headers = ah_params.headers; + ah_params.headers.t = NULL; + ah_params.headers.len = 0; aq->query_params.method = ah_params.method; aq->query_params.authmethod = ah_params.authmethod; @@ -659,6 +674,14 @@ void init_query_params(struct query_params *p) void set_query_params(struct query_params *p) { int len; + int i; + if(p->headers.t) { + for(i = 0; i < p->headers.len; i++) { + if(p->headers.t[i]) + shm_free(p->headers.t[i]); + } + shm_free(p->headers.t); + } p->headers.len = 0; p->headers.t = NULL; p->tls_verify_host = tls_verify_host; @@ -744,20 +767,20 @@ int header_list_add(struct header_list *hl, str *hdr) { char *tmp; - hl->len++; - hl->t = shm_reallocxf(hl->t, hl->len * sizeof(char *)); + hl->t = shm_reallocxf(hl->t, (hl->len + 1) * sizeof(char *)); if(!hl->t) { LM_ERR("shm memory allocation failure\n"); return -1; } - hl->t[hl->len - 1] = shm_malloc(hdr->len + 1); - tmp = hl->t[hl->len - 1]; + hl->t[hl->len] = shm_malloc(hdr->len + 1); + tmp = hl->t[hl->len]; if(!tmp) { LM_ERR("shm memory allocation failure\n"); return -1; } memcpy(tmp, hdr->s, hdr->len); *(tmp + hdr->len) = '\0'; + hl->len++; LM_DBG("stored new http header: [%s]\n", tmp); return 1; diff --git a/src/modules/http_async_client/doc/http_async_client_admin.xml b/src/modules/http_async_client/doc/http_async_client_admin.xml index ad34d958d..587d4d628 100644 --- a/src/modules/http_async_client/doc/http_async_client_admin.xml +++ b/src/modules/http_async_client/doc/http_async_client_admin.xml @@ -527,7 +527,7 @@ http_async_query("https://example.com/test.php", "HTTP_REPLY"); $http_rb and $http_bs: HTTP response body and body length - $http_time: provides access to broken-down transfer time in microseconds calculated by cURL (https://curl.se/libcurl/c/curl_easy_getinfo.html). + $http_time(name): provides access to broken-down transfer time in microseconds calculated by cURL (https://curl.se/libcurl/c/curl_easy_getinfo.html). 'name' can be: diff --git a/src/modules/http_async_client/hm_hash.c b/src/modules/http_async_client/hm_hash.c index 0e50d116f..b225ef963 100644 --- a/src/modules/http_async_client/hm_hash.c +++ b/src/modules/http_async_client/hm_hash.c @@ -174,5 +174,18 @@ void free_http_m_cell(struct http_m_cell *cell) if(cell->url) shm_free(cell->url); + if(cell->params.tls_client_cert) + shm_free(cell->params.tls_client_cert); + if(cell->params.tls_client_key) + shm_free(cell->params.tls_client_key); + if(cell->params.tls_ca_path) + shm_free(cell->params.tls_ca_path); + if(cell->params.body.s && cell->params.body.len > 0) + shm_free(cell->params.body.s); + if(cell->params.username) + shm_free(cell->params.username); + if(cell->params.password) + shm_free(cell->params.password); + shm_free(cell); } diff --git a/src/modules/http_async_client/http_multi.c b/src/modules/http_async_client/http_multi.c index a88430b26..71b5e761e 100644 --- a/src/modules/http_async_client/http_multi.c +++ b/src/modules/http_async_client/http_multi.c @@ -142,6 +142,16 @@ void event_cb(int fd, short kind, void *userp) reply_error(cell); curl_multi_remove_handle(g->multi, easy); curl_easy_cleanup(easy); + /* sock_cb with CURL_POLL_REMOVE (triggered by remove_handle above) + * may have already freed cell->ev; guard before freeing here */ + if(cell->evset && cell->ev) { + event_del(cell->ev); + event_free(cell->ev); + cell->ev = NULL; + cell->evset = 0; + } + unlink_http_m_cell(cell); + free_http_m_cell(cell); } } @@ -186,8 +196,11 @@ int sock_cb(CURL *e, curl_socket_t s, int what, void *cbp, void *sockp) whatstr[what]); if(cell->action == CURL_POLL_IN && what == CURL_POLL_OUT) { if(cell->reply) { - if(cell->reply->result) + if(cell->reply->result) { + if(cell->reply->result->s) + shm_free(cell->reply->result->s); shm_free(cell->reply->result); + } shm_free(cell->reply); cell->reply = NULL; } @@ -474,6 +487,16 @@ int new_request(str *query, http_m_params_t *query_params, http_multi_cbe_t cb, cell->easy = easy; cell->error[0] = '\0'; cell->params = *query_params; + /* Transfer ownership of dynamically allocated fields to the cell. + * The caller must not free these after new_request() returns. */ + query_params->headers = NULL; + query_params->tls_client_cert = NULL; + query_params->tls_client_key = NULL; + query_params->tls_ca_path = NULL; + query_params->body.s = NULL; + query_params->body.len = 0; + query_params->username = NULL; + query_params->password = NULL; cell->param = param; cell->cb = cb; cell->url = (char *)shm_malloc(query->len + 1); @@ -599,6 +622,7 @@ error: LM_DBG("cleaning up curl handler %p\n", easy); curl_easy_cleanup(easy); } + unlink_http_m_cell(cell); free_http_m_cell(cell); return -1; } @@ -639,49 +663,70 @@ void check_multi_info(struct http_m_global *g) update_stat(errors, 1); reply_error(cell); } else { + if(cell->reply == NULL) { + LM_ERR("successful transfer but reply is NULL for handle " + "%p\n", + easy); + reply_error(cell); + } else { + if(curl_easy_getinfo(cell->easy, CURLINFO_TOTAL_TIME, + &tmp_time) + == CURLE_OK) + cell->reply->time.total = + (uint32_t)(tmp_time * 1000000); + if(curl_easy_getinfo( + cell->easy, CURLINFO_NAMELOOKUP_TIME, &tmp_time) + == CURLE_OK) + cell->reply->time.lookup = + (uint32_t)(tmp_time * 1000000); + if(curl_easy_getinfo( + cell->easy, CURLINFO_CONNECT_TIME, &tmp_time) + == CURLE_OK) + cell->reply->time.connect = + (uint32_t)(tmp_time * 1000000); + if(curl_easy_getinfo( + cell->easy, CURLINFO_REDIRECT_TIME, &tmp_time) + == CURLE_OK) + cell->reply->time.redirect = + (uint32_t)(tmp_time * 1000000); + if(curl_easy_getinfo( + cell->easy, CURLINFO_APPCONNECT_TIME, &tmp_time) + == CURLE_OK) + cell->reply->time.appconnect = + (uint32_t)(tmp_time * 1000000); + if(curl_easy_getinfo(cell->easy, + CURLINFO_PRETRANSFER_TIME, &tmp_time) + == CURLE_OK) + cell->reply->time.pretransfer = + (uint32_t)(tmp_time * 1000000); + if(curl_easy_getinfo(cell->easy, + CURLINFO_STARTTRANSFER_TIME, &tmp_time) + == CURLE_OK) + cell->reply->time.starttransfer = + (uint32_t)(tmp_time * 1000000); + + cell->reply->error[0] = '\0'; + cell->cb(cell->reply, cell->param); - if(curl_easy_getinfo(cell->easy, CURLINFO_TOTAL_TIME, &tmp_time) - == CURLE_OK) - cell->reply->time.total = (uint32_t)(tmp_time * 1000000); - if(curl_easy_getinfo( - cell->easy, CURLINFO_NAMELOOKUP_TIME, &tmp_time) - == CURLE_OK) - cell->reply->time.lookup = (uint32_t)(tmp_time * 1000000); - if(curl_easy_getinfo( - cell->easy, CURLINFO_CONNECT_TIME, &tmp_time) - == CURLE_OK) - cell->reply->time.connect = (uint32_t)(tmp_time * 1000000); - if(curl_easy_getinfo( - cell->easy, CURLINFO_REDIRECT_TIME, &tmp_time) - == CURLE_OK) - cell->reply->time.redirect = (uint32_t)(tmp_time * 1000000); - if(curl_easy_getinfo( - cell->easy, CURLINFO_APPCONNECT_TIME, &tmp_time) - == CURLE_OK) - cell->reply->time.appconnect = - (uint32_t)(tmp_time * 1000000); - if(curl_easy_getinfo( - cell->easy, CURLINFO_PRETRANSFER_TIME, &tmp_time) - == CURLE_OK) - cell->reply->time.pretransfer = - (uint32_t)(tmp_time * 1000000); - if(curl_easy_getinfo( - cell->easy, CURLINFO_STARTTRANSFER_TIME, &tmp_time) - == CURLE_OK) - cell->reply->time.starttransfer = - (uint32_t)(tmp_time * 1000000); - - cell->reply->error[0] = '\0'; - cell->cb(cell->reply, cell->param); - - LM_DBG("reply: [%d] %.*s [%d]\n", (int)cell->reply->retcode, - cell->reply->result->len, cell->reply->result->s, - cell->reply->result->len); - update_stat(replies, 1); + if(cell->reply->result) + LM_DBG("reply: [%d] %.*s [%d]\n", + (int)cell->reply->retcode, + cell->reply->result->len, + cell->reply->result->s, + cell->reply->result->len); + update_stat(replies, 1); + } } if(cell != 0) { LM_DBG("cleaning up cell %p\n", cell); + if(cell->evset && cell->ev) { + LM_DBG("freeing event %p\n", cell->ev); + event_del(cell->ev); + event_free(cell->ev); + cell->ev = NULL; + cell->evset = 0; + } unlink_http_m_cell(cell); free_http_m_cell(cell); } diff --git a/src/modules/imc/imc.c b/src/modules/imc/imc.c index 620339800..471b18fd6 100644 --- a/src/modules/imc/imc.c +++ b/src/modules/imc/imc.c @@ -59,7 +59,7 @@ MODULE_VERSION /** header variables */ str imc_hdrs = str_init("Supported: kamailio/imc\r\n"); char hdr_buf[1024]; -str all_hdrs; +str all_hdrs = str_init(""); /** parameters */ db1_con_t *imc_db = NULL; @@ -185,7 +185,7 @@ static int mod_init(void) } if(extra_hdrs.s) { - if(extra_hdrs.len + imc_hdrs.len > 1024) { + if(extra_hdrs.len + imc_hdrs.len >= 1024) { LM_ERR("extra_hdrs too long\n"); return -1; } diff --git a/src/modules/imc/imc_cmd.c b/src/modules/imc/imc_cmd.c index f0085359c..b3f000c20 100644 --- a/src/modules/imc/imc_cmd.c +++ b/src/modules/imc/imc_cmd.c @@ -108,35 +108,49 @@ static str *build_headers(struct sip_msg *msg) static str name = STR_STATIC_INIT("In-Reply-To: "); static str nl = STR_STATIC_INIT("\r\n"); static char buf[1024]; - static str rv; + static str rv = {NULL, 0}; str *callid; + str ctbody = STR_NULL; + buf[0] = '\0'; rv.s = buf; - rv.len = all_hdrs.len + ctname.len + msg->content_type->body.len; - + rv.len = all_hdrs.len; + if(rv.len > sizeof(buf) - 1) { + LM_ERR("headers too long\n"); + rv.len = 0; + return &rv; + } memcpy(buf, all_hdrs.s, all_hdrs.len); - memcpy(buf + all_hdrs.len, ctname.s, ctname.len); - memcpy(buf + all_hdrs.len + ctname.len, msg->content_type->body.s, - msg->content_type->body.len); + + if(msg->content_type != NULL) { + ctbody = msg->content_type->body; + rv.len += ctname.len + ctbody.len; + if(rv.len > sizeof(buf) - 1) { + LM_ERR("buffer too small for Content-Type header\n"); + rv.len -= ctname.len + ctbody.len; + return &rv; + } + if(ctbody.len > 0) { + memcpy(buf + all_hdrs.len, ctname.s, ctname.len); + memcpy(buf + all_hdrs.len + ctname.len, ctbody.s, ctbody.len); + } + } if((callid = get_callid(msg)) == NULL) { return &rv; } rv.len += nl.len + name.len + callid->len; - - if(rv.len > sizeof(buf)) { - LM_ERR("Header buffer too small for In-Reply-To header\n"); + if(rv.len > sizeof(buf) - 1) { + LM_ERR("buffer too small for In-Reply-To header\n"); + rv.len -= nl.len + name.len + callid->len; return &rv; } - memcpy(buf + all_hdrs.len + ctname.len + msg->content_type->body.len, nl.s, - nl.len); - memcpy(buf + all_hdrs.len + ctname.len + msg->content_type->body.len - + nl.len, - name.s, name.len); - memcpy(buf + all_hdrs.len + ctname.len + msg->content_type->body.len - + nl.len + name.len, + memcpy(buf + all_hdrs.len + ctname.len + ctbody.len, nl.s, nl.len); + memcpy(buf + all_hdrs.len + ctname.len + ctbody.len + nl.len, name.s, + name.len); + memcpy(buf + all_hdrs.len + ctname.len + ctbody.len + nl.len + name.len, callid->s, callid->len); return &rv; } @@ -1727,6 +1741,9 @@ void imc_inv_callback(struct cell *t, int type, struct tmcb_params *ps) build_inform: body_final.s = body_buf; body_final.len = member->uri.len - 4 /* sip: part of URI */ + 20; + if(member->uri.len - 4 > sizeof(body_buf)) { + goto error; + } memcpy(body_final.s, member->uri.s + 4, member->uri.len - 4); memcpy(body_final.s + member->uri.len - 4, " is not registered. ", 21); diff --git a/src/modules/ims_charging/ccr.c b/src/modules/ims_charging/ccr.c index 79dce8732..319266049 100644 --- a/src/modules/ims_charging/ccr.c +++ b/src/modules/ims_charging/ccr.c @@ -464,8 +464,8 @@ Ro_CCA_t *Ro_parse_CCA_avps(AAAMessage *cca) zz->code); } zz = zz->next; - cdp_avp->cdp->AAAFreeAVPList(&yy); } + cdp_avp->cdp->AAAFreeAVPList(&yy); break; default: LM_ERR("Unsupported Final Unit " diff --git a/src/modules/ims_ipsec_pcscf/sec_agree.c b/src/modules/ims_ipsec_pcscf/sec_agree.c index 4ad62a69d..2df9d60bb 100644 --- a/src/modules/ims_ipsec_pcscf/sec_agree.c +++ b/src/modules/ims_ipsec_pcscf/sec_agree.c @@ -290,17 +290,28 @@ cleanup: // Function - free_security() // Keep them in sync! if(params) { - shm_free(params->sec_header.s); + if(params->sec_header.s) + shm_free(params->sec_header.s); if(params->type == SECURITY_IPSEC && params->data.ipsec) { - shm_free(params->data.ipsec->ealg.s); - shm_free(params->data.ipsec->r_ealg.s); - shm_free(params->data.ipsec->ck.s); - shm_free(params->data.ipsec->alg.s); - shm_free(params->data.ipsec->r_alg.s); - shm_free(params->data.ipsec->ik.s); - shm_free(params->data.ipsec->prot.s); - shm_free(params->data.ipsec->mod.s); + if(params->data.ipsec->ealg.s) + shm_free(params->data.ipsec->ealg.s); + if(params->data.ipsec->r_ealg.s) + shm_free(params->data.ipsec->r_ealg.s); + if(params->data.ipsec->ck.s) + shm_free(params->data.ipsec->ck.s); + if(params->data.ipsec->alg.s) + shm_free(params->data.ipsec->alg.s); + if(params->data.ipsec->r_alg.s) + shm_free(params->data.ipsec->r_alg.s); + if(params->data.ipsec->ik.s) + shm_free(params->data.ipsec->ik.s); + if(params->data.ipsec->prot.s) + shm_free(params->data.ipsec->prot.s); + if(params->data.ipsec->mod.s) + shm_free(params->data.ipsec->mod.s); + shm_free(params->data.ipsec); + } else { shm_free(params->data.ipsec); } diff --git a/src/modules/ims_ocs/ims_ocs_mod.c b/src/modules/ims_ocs/ims_ocs_mod.c index d8aed1347..44aa77ea5 100644 --- a/src/modules/ims_ocs/ims_ocs_mod.c +++ b/src/modules/ims_ocs/ims_ocs_mod.c @@ -96,6 +96,10 @@ static int mod_init(void) callback_singleton = shm_malloc(sizeof(int)); + if(callback_singleton == 0) { + LM_ERR("No shared memory left\n"); + goto error; + } *callback_singleton = 0; cdp_avp = 0; @@ -113,6 +117,10 @@ static int mod_init(void) return 0; error: + /* clean up */ + if(callback_singleton) { + shm_free(callback_singleton); + } LM_ERR("Failed to initialise ims_ocs module\n"); return -1; } diff --git a/src/modules/ims_ocs/ocs_avp_helper.c b/src/modules/ims_ocs/ocs_avp_helper.c index f350a79a1..18b143a60 100644 --- a/src/modules/ims_ocs/ocs_avp_helper.c +++ b/src/modules/ims_ocs/ocs_avp_helper.c @@ -29,9 +29,9 @@ /** * Returns the value of a certain AVP from a Diameter message. - * @param m - Diameter message to look into + * @param msg - Diameter message to look into * @param avp_code - the code to search for - * @param vendorid - the value of the vendor id to look for or 0 if none + * @param vendor_id - the value of the vendor id to look for or 0 if none * @param func - the name of the calling function, for debugging purposes * @returns the str with the payload on success or an empty string on failure */ @@ -208,8 +208,7 @@ int getUnits(AAAMessage *msg, int *used, int *service, int *group) list2 = cdp_avp->cdp->AAAUngroupAVPS(req_units->data); value = cdpb.AAAFindMatchingAVPList( list2, list2.head, AVP_CC_Time, 0, 0); - cdpb.AAAFreeAVPList(&list2); - if(value) + if(value && value->data.len >= 4) units = get_4bytes(value->data.s); cdpb.AAAFreeAVPList(&list2); } diff --git a/src/modules/ims_qos/ims_qos_mod.c b/src/modules/ims_qos/ims_qos_mod.c index ef99c3f90..13162faaa 100644 --- a/src/modules/ims_qos/ims_qos_mod.c +++ b/src/modules/ims_qos/ims_qos_mod.c @@ -1520,6 +1520,10 @@ static int w_rx_aar_register( recv_proto = msg->rcv.proto; } else { memset(&recv_ip, 0, sizeof(str)); + if(vb->host.len >= sizeof(buff)) { + LM_ERR("Via host too long for buffer (%d)\n", vb->host.len); + goto error; + } memcpy(&buff, vb->host.s, vb->host.len); buff[vb->host.len] = 0; recv_ip.s = buff; diff --git a/src/modules/ims_registrar_pcscf/sec_agree.c b/src/modules/ims_registrar_pcscf/sec_agree.c index c65f45cf3..f7894ddc6 100644 --- a/src/modules/ims_registrar_pcscf/sec_agree.c +++ b/src/modules/ims_registrar_pcscf/sec_agree.c @@ -214,17 +214,27 @@ cleanup: // Function - free_security() // Keep them in sync! if(params) { - shm_free(params->sec_header.s); - shm_free(params->data.ipsec); + if(params->sec_header.s) + shm_free(params->sec_header.s); if(params->type == SECURITY_IPSEC && params->data.ipsec) { - shm_free(params->data.ipsec->ealg.s); - shm_free(params->data.ipsec->r_ealg.s); - shm_free(params->data.ipsec->ck.s); - shm_free(params->data.ipsec->alg.s); - shm_free(params->data.ipsec->r_alg.s); - shm_free(params->data.ipsec->ik.s); - shm_free(params->data.ipsec->prot.s); - shm_free(params->data.ipsec->mod.s); + if(params->data.ipsec->ealg.s) + shm_free(params->data.ipsec->ealg.s); + if(params->data.ipsec->r_ealg.s) + shm_free(params->data.ipsec->r_ealg.s); + if(params->data.ipsec->ck.s) + shm_free(params->data.ipsec->ck.s); + if(params->data.ipsec->alg.s) + shm_free(params->data.ipsec->alg.s); + if(params->data.ipsec->r_alg.s) + shm_free(params->data.ipsec->r_alg.s); + if(params->data.ipsec->ik.s) + shm_free(params->data.ipsec->ik.s); + if(params->data.ipsec->prot.s) + shm_free(params->data.ipsec->prot.s); + if(params->data.ipsec->mod.s) + shm_free(params->data.ipsec->mod.s); + shm_free(params->data.ipsec); + } else { shm_free(params->data.ipsec); } diff --git a/src/modules/ims_usrloc_pcscf/pcontact.c b/src/modules/ims_usrloc_pcscf/pcontact.c index c0b3d1bb9..d04d03725 100644 --- a/src/modules/ims_usrloc_pcscf/pcontact.c +++ b/src/modules/ims_usrloc_pcscf/pcontact.c @@ -199,7 +199,6 @@ int new_pcontact(struct udomain *_d, str *_contact, struct pcontact_info *_ci, if(parse_uri((*_c)->aor.s, (*_c)->aor.len, &sip_uri) != 0) { LM_ERR("unable to determine contact host from uri [%.*s\n", (*_c)->aor.len, (*_c)->aor.s); - shm_free((*_c)->aor.s); shm_free(*_c); *_c = 0; return -2; diff --git a/src/modules/jsonrpcs/README b/src/modules/jsonrpcs/README index cd69eea36..f77dc368c 100644 --- a/src/modules/jsonrpcs/README +++ b/src/modules/jsonrpcs/README @@ -475,8 +475,15 @@ jsonrpc_exec('{"jsonrpc": "2.0", "method": "corex.debug", "params": [ 2 ], "id": JSONRPC specifications do not enforce a specific transport to carry the JSON documents. Very common is JSONRPC over HTTP or HTTPS, and they are - supported by Kamailio. In addition, Kamailio supports receiving JSON - documents via a local FIFO file. + supported by Kamailio. In addition, Kamailio JSONRPC over a local FIFO + file and over UDP/datagram using unix socket files or IPv4/IPv6 + sockets. + + An extenssion to the JSONRPC protocol is available: when "store_path" + field is provided in the command, instead of returning it, the result + is stored in a file on server at the path provided as the value of the + field. It can be useful for troubleshooting or when the result is very + large. 7.1. JSONRPC Over HTTP diff --git a/src/modules/jsonrpcs/doc/jsonrpcs_admin.xml b/src/modules/jsonrpcs/doc/jsonrpcs_admin.xml index 3632400df..5554e473b 100644 --- a/src/modules/jsonrpcs/doc/jsonrpcs_admin.xml +++ b/src/modules/jsonrpcs/doc/jsonrpcs_admin.xml @@ -556,8 +556,14 @@ jsonrpc_exec('{"jsonrpc": "2.0", "method": "corex.debug", "params": [ 2 ], "id": JSONRPC specifications do not enforce a specific transport to carry the JSON documents. Very common is JSONRPC over HTTP or HTTPS, and they are - supported by &kamailio;. In addition, &kamailio; supports receiving JSON - documents via a local FIFO file. + supported by &kamailio;. In addition, &kamailio; JSONRPC over a local FIFO + file and over UDP/datagram using unix socket files or IPv4/IPv6 sockets. + + + An extenssion to the JSONRPC protocol is available: when "store_path" field + is provided in the command, instead of returning it, the result is stored in + a file on server at the path provided as the value of the field. It can + be useful for troubleshooting or when the result is very large.
JSONRPC Over HTTP diff --git a/src/modules/kazoo/README b/src/modules/kazoo/README index 01fe05f1a..4a0cb3b31 100644 --- a/src/modules/kazoo/README +++ b/src/modules/kazoo/README @@ -108,7 +108,7 @@ Luis Azedo 1.15. Set amqp_interprocess_timeout parameter 1.16. Set amqp_waitframe_timeout parameter 1.17. Set amqp_query_timeout parameter - 1.18. >Set amqp_query_timeout_avp parameter + 1.18. Set amqp_query_timeout_avp parameter 1.19. Set db_url parameter 1.20. Set presentity_table parameter 1.21. Set pua_mode parameter @@ -570,7 +570,7 @@ modparam("kazoo", "amqp_query_timeout_micro", 200000) Default value is NULL (no value). - Example 1.18. >Set amqp_query_timeout_avp parameter + Example 1.18. Set amqp_query_timeout_avp parameter ... modparam("kazoo", "amqp_query_timeout_avp", "$var(kz_timeout)") diff --git a/src/modules/kazoo/doc/kazoo_admin.xml b/src/modules/kazoo/doc/kazoo_admin.xml index 04d95fde0..6748dcaa0 100644 --- a/src/modules/kazoo/doc/kazoo_admin.xml +++ b/src/modules/kazoo/doc/kazoo_admin.xml @@ -470,7 +470,7 @@ modparam("kazoo", "amqp_query_timeout_micro", 200000) Default value is NULL (no value). - >Set <varname>amqp_query_timeout_avp</varname> parameter + Set <varname>amqp_query_timeout_avp</varname> parameter ... modparam("kazoo", "amqp_query_timeout_avp", "$var(kz_timeout)") diff --git a/src/modules/kemix/kemix_mod.c b/src/modules/kemix/kemix_mod.c index 37639c8fe..71ef0453f 100644 --- a/src/modules/kemix/kemix_mod.c +++ b/src/modules/kemix/kemix_mod.c @@ -82,13 +82,6 @@ static sr_kemi_xval_t *ki_kx_get_ruri(sip_msg_t *msg) return &_sr_kemi_kx_xval; } - if(msg->parsed_uri_ok == 0 /* R-URI not parsed*/ - && parse_sip_msg_uri(msg) < 0) { - LM_ERR("failed to parse the R-URI\n"); - sr_kemi_xval_null(&_sr_kemi_kx_xval, 0); - return &_sr_kemi_kx_xval; - } - _sr_kemi_kx_xval.vtype = SR_KEMIP_STR; if(msg->new_uri.s != NULL) { _sr_kemi_kx_xval.v.s = msg->new_uri; @@ -116,13 +109,6 @@ static sr_kemi_xval_t *ki_kx_get_ouri(sip_msg_t *msg) return &_sr_kemi_kx_xval; } - if(msg->parsed_uri_ok == 0 /* R-URI not parsed*/ - && parse_sip_msg_uri(msg) < 0) { - LM_ERR("failed to parse the R-URI\n"); - sr_kemi_xval_null(&_sr_kemi_kx_xval, 0); - return &_sr_kemi_kx_xval; - } - _sr_kemi_kx_xval.vtype = SR_KEMIP_STR; _sr_kemi_kx_xval.v.s = msg->first_line.u.request.uri; return &_sr_kemi_kx_xval; diff --git a/src/modules/lcr/lcr_mod.c b/src/modules/lcr/lcr_mod.c index 703b5a299..c2a6f0514 100644 --- a/src/modules/lcr/lcr_mod.c +++ b/src/modules/lcr/lcr_mod.c @@ -2218,6 +2218,11 @@ int load_gws_dummy(int lcr_id, str *ruri_user, str *from_uri, str *request_uri, if(rule->from_uri_len != 0) { pcre_md = pcre2_match_data_create_from_pattern( rule->from_uri_re, NULL); + if(pcre_md == NULL) { + LM_ERR("failed to allocate pcre2 match data for " + "from_uri\n"); + return -1; + } rc = pcre2_match(rule->from_uri_re, (PCRE2_SPTR)from_uri->s, (PCRE2_SIZE)from_uri->len, 0, 0, pcre_md, NULL); if(pcre_md) { @@ -2261,6 +2266,11 @@ int load_gws_dummy(int lcr_id, str *ruri_user, str *from_uri, str *request_uri, } pcre_md = pcre2_match_data_create_from_pattern( rule->request_uri_re, NULL); + if(pcre_md == NULL) { + LM_ERR("failed to allocate pcre2 match data for " + "request_uri\n"); + return -1; + } rc = pcre2_match(rule->request_uri_re, (PCRE2_SPTR)request_uri->s, (PCRE2_SIZE)request_uri->len, 0, 0, pcre_md, NULL); @@ -2397,6 +2407,11 @@ static int ki_load_gws_furi( if(rule->from_uri_len != 0) { pcre_md = pcre2_match_data_create_from_pattern( rule->from_uri_re, NULL); + if(pcre_md == NULL) { + LM_ERR("failed to allocate pcre2 match data for " + "from_uri\n"); + return -1; + } rc = pcre2_match(rule->from_uri_re, (PCRE2_SPTR)from_uri->s, (PCRE2_SIZE)from_uri->len, 0, 0, pcre_md, NULL); if(pcre_md) { @@ -2441,6 +2456,11 @@ static int ki_load_gws_furi( if(rule->request_uri_len != 0) { pcre_md = pcre2_match_data_create_from_pattern( rule->request_uri_re, NULL); + if(pcre_md == NULL) { + LM_ERR("failed to allocate pcre2 match data for " + "request_uri\n"); + return -1; + } rc = pcre2_match(rule->request_uri_re, (PCRE2_SPTR)request_uri->s, (PCRE2_SIZE)request_uri->len, 0, 0, pcre_md, NULL); diff --git a/src/modules/lost/utilities.c b/src/modules/lost/utilities.c index 2e88a3474..f3af76dce 100644 --- a/src/modules/lost/utilities.c +++ b/src/modules/lost/utilities.c @@ -1026,13 +1026,21 @@ int lost_parse_geo(xmlNodePtr node, p_lost_loc_t loc) return -1; } - scan = sscanf(content, "%s %s %s", bufLat, bufLon, bufAlt); + scan = sscanf(content, "%127s %127s %127s", bufLat, bufLon, bufAlt); xmlFree(content); if(scan < 2) { LM_WARN("invalid pos element\n"); return -1; } + + /* Check for truncation: if any field reached max width (127), it was likely truncated */ + if((strlen(bufLat) >= 127) || (strlen(bufLon) >= 127) + || (strlen(bufAlt) >= 127)) { + LM_WARN("pos element contains oversized coordinates (truncation " + "detected)\n"); + } + /* latitude */ len = strlen((char *)bufLat); loc->latitude = (char *)pkg_malloc(len + 1); diff --git a/src/modules/maxfwd/mf_funcs.c b/src/modules/maxfwd/mf_funcs.c index d5b9b0671..aec19da6d 100644 --- a/src/modules/maxfwd/mf_funcs.c +++ b/src/modules/maxfwd/mf_funcs.c @@ -115,7 +115,7 @@ int add_maxfwd_header(struct sip_msg *msg, unsigned int val) buf = (char *)pkg_malloc(len); if(!buf) { - LM_ERR("add_maxfwd_header: no more pkg memory\n"); + LM_ERR("no more pkg memory\n"); goto error; } memcpy(buf, MF_HDR, MF_HDR_LEN); @@ -125,14 +125,18 @@ int add_maxfwd_header(struct sip_msg *msg, unsigned int val) len += CRLF_LEN; /*inserts the header at the beginning of the message*/ + if(msg->headers == NULL || msg->headers->name.s == NULL) { + LM_ERR("message has no header anchor\n"); + goto error1; + } anchor = anchor_lump(msg, msg->headers->name.s - msg->buf, 0, 0); if(anchor == 0) { - LM_ERR("add_maxfwd_header: failed to get anchor\n"); + LM_ERR("failed to get anchor\n"); goto error1; } if(insert_new_lump_before(anchor, buf, len, 0) == 0) { - LM_ERR("add_maxfwd_header: failed to insert MAX-FORWARDS lump\n"); + LM_ERR("failed to insert MAX-FORWARDS lump\n"); goto error1; } diff --git a/src/modules/msrp/msrp_netio.c b/src/modules/msrp/msrp_netio.c index fe2020aa8..a18fb2054 100644 --- a/src/modules/msrp/msrp_netio.c +++ b/src/modules/msrp/msrp_netio.c @@ -34,6 +34,19 @@ #include "msrp_env.h" #include "msrp_netio.h" + +#define msrp_buffer_append(buf, val, len, csize, msize) \ + do { \ + if(csize + len >= msize - 1) { \ + LM_ERR("result is too large\n"); \ + goto error; \ + } \ + memcpy(buf, val, len); \ + p += len; \ + csize += len; \ + } while(0) + + /** * */ @@ -46,20 +59,15 @@ int msrp_forward(msrp_frame_t *mf, str *tpath, str *fpath) if(tpath) { msrp_hdr_t *hdr; - int maxlen; + int csize = 0; char *p; - maxlen = mf->buf.len; - if(fpath) { hdr = msrp_get_hdr_by_id(mf, MSRP_HDR_FROM_PATH); if(!hdr) { LM_ERR("From-Path header not found\n"); return -1; } - - maxlen -= hdr->body.len; - maxlen += fpath->len; } /* hdr must hold To-Path until we copy it bellow */ @@ -68,36 +76,24 @@ int msrp_forward(msrp_frame_t *mf, str *tpath, str *fpath) LM_ERR("To-Path header not found\n"); return -1; } - maxlen -= hdr->body.len; - maxlen += tpath->len; - - if(maxlen >= MSRP_MAX_FRAME_SIZE - 1) - return -1; p = fwdbuff; - memcpy(p, mf->fline.buf.s, mf->fline.buf.len); - p += mf->fline.buf.len; - - memcpy(p, "To-Path: ", 9); - p += 9; - memcpy(p, tpath->s, tpath->len); - p += tpath->len; - memcpy(p, "\r\n", 2); - p += 2; - - memcpy(p, "From-Path: ", 11); - p += 11; + msrp_buffer_append(p, mf->fline.buf.s, mf->fline.buf.len, csize, + MSRP_MAX_FRAME_SIZE); + msrp_buffer_append(p, "To-Path: ", 9, csize, MSRP_MAX_FRAME_SIZE); + msrp_buffer_append(p, tpath->s, tpath->len, csize, MSRP_MAX_FRAME_SIZE); + msrp_buffer_append(p, "\r\n", 2, csize, MSRP_MAX_FRAME_SIZE); + msrp_buffer_append(p, "From-Path: ", 11, csize, MSRP_MAX_FRAME_SIZE); if(fpath) { - memcpy(p, fpath->s, fpath->len); - p += fpath->len; - memcpy(p, "\r\n", 2); - p += 2; + msrp_buffer_append( + p, fpath->s, fpath->len, csize, MSRP_MAX_FRAME_SIZE); + msrp_buffer_append(p, "\r\n", 2, csize, MSRP_MAX_FRAME_SIZE); } else { /* hdr must hold To-Path from above */ - memcpy(p, hdr->buf.s, hdr->buf.len); - p += hdr->buf.len; + msrp_buffer_append( + p, hdr->buf.s, hdr->buf.len, csize, MSRP_MAX_FRAME_SIZE); } for(hdr = mf->headers; hdr; hdr = hdr->next) { @@ -106,20 +102,19 @@ int msrp_forward(msrp_frame_t *mf, str *tpath, str *fpath) continue; } - memcpy(p, hdr->buf.s, hdr->buf.len); - p += hdr->buf.len; + msrp_buffer_append( + p, hdr->buf.s, hdr->buf.len, csize, MSRP_MAX_FRAME_SIZE); } if(mf->mbody.len > 0) { - memcpy(p, "\r\n", 2); - p += 2; + msrp_buffer_append(p, "\r\n", 2, csize, MSRP_MAX_FRAME_SIZE); - memcpy(p, mf->mbody.s, mf->mbody.len); - p += mf->mbody.len; + msrp_buffer_append( + p, mf->mbody.s, mf->mbody.len, csize, MSRP_MAX_FRAME_SIZE); } - memcpy(p, mf->endline.s, mf->endline.len); - p += mf->endline.len; + msrp_buffer_append( + p, mf->endline.s, mf->endline.len, csize, MSRP_MAX_FRAME_SIZE); buf = fwdbuff; len = p - fwdbuff; @@ -163,6 +158,9 @@ int msrp_forward(msrp_frame_t *mf, str *tpath, str *fpath) } return 0; + +error: + return -1; } /** @@ -301,6 +299,7 @@ int msrp_reply(msrp_frame_t *mf, str *code, str *text, str *xhdrs) msrp_env_t *env; char *p; char *l; + int csize = 0; sr_event_param_t evp = {0}; int ret; @@ -314,24 +313,17 @@ int msrp_reply(msrp_frame_t *mf, str *code, str *text, str *xhdrs) } p = rplbuf; - memcpy(p, mf->fline.protocol.s, mf->fline.protocol.len); - p += mf->fline.protocol.len; - *p = ' '; - p++; - memcpy(p, mf->fline.transaction.s, mf->fline.transaction.len); - p += mf->fline.transaction.len; - *p = ' '; - p++; - memcpy(p, code->s, code->len); - p += code->len; - *p = ' '; - p++; - memcpy(p, text->s, text->len); - p += text->len; - memcpy(p, "\r\n", 2); - p += 2; - memcpy(p, "To-Path: ", 9); - p += 9; + msrp_buffer_append(p, mf->fline.protocol.s, mf->fline.protocol.len, csize, + MSRP_MAX_FRAME_SIZE); + msrp_buffer_append(p, " ", 1, csize, MSRP_MAX_FRAME_SIZE); + msrp_buffer_append(p, mf->fline.transaction.s, mf->fline.transaction.len, + csize, MSRP_MAX_FRAME_SIZE); + msrp_buffer_append(p, " ", 1, csize, MSRP_MAX_FRAME_SIZE); + msrp_buffer_append(p, code->s, code->len, csize, MSRP_MAX_FRAME_SIZE); + msrp_buffer_append(p, " ", 1, csize, MSRP_MAX_FRAME_SIZE); + msrp_buffer_append(p, text->s, text->len, csize, MSRP_MAX_FRAME_SIZE); + msrp_buffer_append(p, "\r\n", 2, csize, MSRP_MAX_FRAME_SIZE); + msrp_buffer_append(p, "To-Path: ", 9, csize, MSRP_MAX_FRAME_SIZE); hdr = msrp_get_hdr_by_id(mf, MSRP_HDR_FROM_PATH); if(hdr == NULL) { LM_ERR("From-Path header not found\n"); @@ -340,48 +332,44 @@ int msrp_reply(msrp_frame_t *mf, str *code, str *text, str *xhdrs) if(mf->fline.msgtypeid == MSRP_REQ_SEND) { l = q_memchr(hdr->body.s, ' ', hdr->body.len); if(l == NULL) { - memcpy(p, hdr->body.s, hdr->body.len + 2); - p += hdr->body.len + 2; + msrp_buffer_append(p, hdr->body.s, hdr->body.len + 2, csize, + MSRP_MAX_FRAME_SIZE); } else { - memcpy(p, hdr->body.s, l - hdr->body.s); - p += l - hdr->body.s; - memcpy(p, "\r\n", 2); - p += 2; + msrp_buffer_append(p, hdr->body.s, l - hdr->body.s, csize, + MSRP_MAX_FRAME_SIZE); + msrp_buffer_append(p, "\r\n", 2, csize, MSRP_MAX_FRAME_SIZE); } } else { - memcpy(p, hdr->body.s, hdr->body.len + 2); - p += hdr->body.len + 2; + msrp_buffer_append( + p, hdr->body.s, hdr->body.len + 2, csize, MSRP_MAX_FRAME_SIZE); } hdr = msrp_get_hdr_by_id(mf, MSRP_HDR_TO_PATH); if(hdr == NULL) { LM_ERR("To-Path header not found\n"); return -1; } - memcpy(p, "From-Path: ", 11); - p += 11; + msrp_buffer_append(p, "From-Path: ", 11, csize, MSRP_MAX_FRAME_SIZE); l = q_memchr(hdr->body.s, ' ', hdr->body.len); if(l == NULL) { - memcpy(p, hdr->body.s, hdr->body.len + 2); - p += hdr->body.len + 2; + msrp_buffer_append( + p, hdr->body.s, hdr->body.len + 2, csize, MSRP_MAX_FRAME_SIZE); } else { - memcpy(p, hdr->body.s, l - hdr->body.s); - p += l - hdr->body.s; - memcpy(p, "\r\n", 2); - p += 2; + msrp_buffer_append( + p, hdr->body.s, l - hdr->body.s, csize, MSRP_MAX_FRAME_SIZE); + msrp_buffer_append(p, "\r\n", 2, csize, MSRP_MAX_FRAME_SIZE); } hdr = msrp_get_hdr_by_id(mf, MSRP_HDR_MESSAGE_ID); if(hdr != NULL) { - memcpy(p, hdr->buf.s, hdr->buf.len); - p += hdr->buf.len; + msrp_buffer_append( + p, hdr->buf.s, hdr->buf.len, csize, MSRP_MAX_FRAME_SIZE); } if(xhdrs != NULL && xhdrs->s != NULL) { - memcpy(p, xhdrs->s, xhdrs->len); - p += xhdrs->len; + msrp_buffer_append(p, xhdrs->s, xhdrs->len, csize, MSRP_MAX_FRAME_SIZE); } - memcpy(p, mf->endline.s, mf->endline.len); - p += mf->endline.len; + msrp_buffer_append( + p, mf->endline.s, mf->endline.len, csize, MSRP_MAX_FRAME_SIZE); *(p - 3) = '$'; env = msrp_get_env(); @@ -413,6 +401,9 @@ int msrp_reply(msrp_frame_t *mf, str *code, str *text, str *xhdrs) } return 0; + +error: + return -1; } diff --git a/src/modules/msrp/msrp_parser.c b/src/modules/msrp/msrp_parser.c index 4bf864fd1..de1fcf79f 100644 --- a/src/modules/msrp/msrp_parser.c +++ b/src/modules/msrp/msrp_parser.c @@ -39,25 +39,32 @@ typedef struct msrp_str_id } msrp_str_id_t; -static msrp_str_id_t _msrp_rtypes[] = {{str_init("SEND"), MSRP_REQ_SEND}, - {str_init("AUTH"), MSRP_REQ_AUTH}, - {str_init("REPORT"), MSRP_REQ_REPORT}, {{0, 0}, 0}}; +/* clang-format off */ +static msrp_str_id_t _msrp_rtypes[] = { + {str_init("SEND"), MSRP_REQ_SEND}, + {str_init("AUTH"), MSRP_REQ_AUTH}, + {str_init("REPORT"), MSRP_REQ_REPORT}, + {{0, 0}, 0} +}; static msrp_str_id_t _msrp_htypes[] = { - {str_init("From-Path"), MSRP_HDR_FROM_PATH}, - {str_init("To-Path"), MSRP_HDR_TO_PATH}, - {str_init("Use-Path"), MSRP_HDR_USE_PATH}, - {str_init("Message-ID"), MSRP_HDR_MESSAGE_ID}, - {str_init("Byte-Range"), MSRP_HDR_BYTE_RANGE}, - {str_init("Status"), MSRP_HDR_STATUS}, - {str_init("Success-Report"), MSRP_HDR_SUCCESS_REPORT}, - {str_init("Content-Type"), MSRP_HDR_CONTENT_TYPE}, - {str_init("Authorization"), MSRP_HDR_AUTH}, - {str_init("WWW-Authenticate"), MSRP_HDR_WWWAUTH}, - {str_init("Authentication-Info"), MSRP_HDR_AUTHINFO}, - {str_init("Expires"), MSRP_HDR_EXPIRES}, {{0, 0}, 0}}; - + {str_init("From-Path"), MSRP_HDR_FROM_PATH}, + {str_init("To-Path"), MSRP_HDR_TO_PATH}, + {str_init("Use-Path"), MSRP_HDR_USE_PATH}, + {str_init("Message-ID"), MSRP_HDR_MESSAGE_ID}, + {str_init("Byte-Range"), MSRP_HDR_BYTE_RANGE}, + {str_init("Status"), MSRP_HDR_STATUS}, + {str_init("Success-Report"), MSRP_HDR_SUCCESS_REPORT}, + {str_init("Content-Type"), MSRP_HDR_CONTENT_TYPE}, + {str_init("Authorization"), MSRP_HDR_AUTH}, + {str_init("WWW-Authenticate"), MSRP_HDR_WWWAUTH}, + {str_init("Authentication-Info"), MSRP_HDR_AUTHINFO}, + {str_init("Expires"), MSRP_HDR_EXPIRES}, + {{0, 0}, 0} +}; + +/* clang-format on */ /* */ int msrp_fline_set_rtypeid(msrp_frame_t *mf); diff --git a/src/modules/nathelper/nathelper.c b/src/modules/nathelper/nathelper.c index b3335960f..59809f0e9 100644 --- a/src/modules/nathelper/nathelper.c +++ b/src/modules/nathelper/nathelper.c @@ -670,7 +670,7 @@ static int fix_nated_contact(struct sip_msg *msg) str params1 = {0}; str params2 = {0}; - if(get_contact_uri(msg, &uri, &c) == -1) + if(get_contact_uri(msg, &uri, &c) < 0) return -1; if((c->uri.s < msg->buf) || (c->uri.s > (msg->buf + msg->len))) { LM_ERR("you can't call fix_nated_contact twice, " @@ -771,7 +771,7 @@ static int set_contact_alias(struct sip_msg *msg, int trim) nuri.len = MAX_URI_SIZE; curi.s = cbuf; curi.len = MAX_URI_SIZE; - if(get_contact_uri(msg, &uri, &c) == -1) + if(get_contact_uri(msg, &uri, &c) < 0) return -1; if((c->uri.s < msg->buf) || (c->uri.s > (msg->buf + msg->len))) { LM_ERR("you can't update contact twice, check your config!\n"); @@ -866,19 +866,14 @@ static int add_contact_alias_0(struct sip_msg *msg) struct sip_uri uri; struct ip_addr *ip; char *bracket, *lt, *param, *at, *port, *start; + int rc = 0; - /* Do nothing if Contact header does not exist */ - if(!msg->contact) { - if(parse_headers(msg, HDR_CONTACT_F, 0) == -1) { - LM_ERR("while parsing headers\n"); - return -1; - } - if(!msg->contact) { - LM_DBG("no contact header\n"); + if((rc = get_contact_uri(msg, &uri, &c)) < 0) { + if(rc < -1) { + /* do nothing if Contact header or URI does not exist */ + LM_DBG("star or no contact header\n"); return 2; } - } - if(get_contact_uri(msg, &uri, &c) == -1) { LM_ERR("failed to get contact uri\n"); return -1; } @@ -1029,19 +1024,14 @@ static int add_contact_alias_3( char *bracket, *lt, *param, *at, *start; int is_ipv6 = 0; int i; + int rc = 0; - /* Do nothing if Contact header does not exist */ - if(!msg->contact) { - if(parse_headers(msg, HDR_CONTACT_F, 0) == -1) { - LM_ERR("while parsing headers\n"); - return -1; - } - if(!msg->contact) { - LM_DBG("no contact header\n"); + if((rc = get_contact_uri(msg, &uri, &c)) < 0) { + if(rc < -1) { + /* do nothing if Contact header or URI does not exist */ + LM_DBG("star or no contact header\n"); return 2; } - } - if(get_contact_uri(msg, &uri, &c) == -1) { LM_ERR("failed to get contact uri\n"); return -1; } @@ -1185,6 +1175,11 @@ static int ki_handle_ruri_alias_mode(struct sip_msg *msg, int mode) ip_len, ip_port_len, port_len, i; int is_ipv6 = 0; + if(msg->first_line.u.request.uri.len > MAX_URI_SIZE - 1 + || msg->new_uri.len > MAX_URI_SIZE - 1) { + LM_ERR("very long Request-URI\n"); + return -1; + } if(parse_sip_msg_uri(msg) < 0) { LM_ERR("while parsing Request-URI\n"); return -1; @@ -1248,6 +1243,11 @@ static int ki_handle_ruri_alias_mode(struct sip_msg *msg, int mode) at = &(buf[0]); append_str(at, "sip:", 4); ip_port_len = trans - val; + if(ip_port_len >= MAX_URI_SIZE - 128) { + /* ip or hostname and port */ + LM_ERR("very long alias address\n"); + return -1; + } alias_len = _ksr_contact_salias.len + ip_port_len + 2 /* ~n */; if(is_ipv6 && val[0] != '[') { // IPv6 - add '[' ']' around IP @@ -1269,7 +1269,8 @@ static int ki_handle_ruri_alias_mode(struct sip_msg *msg, int mode) at = at + ip_port_len; } trans = trans + 1; - if((ip_port_len + 2 > val_len) || (*trans == ';') || (*trans == '?')) { + if((ip_port_len + 2 > val_len) || (trans >= val + val_len) + || (*trans == ';') || (*trans == '?')) { LM_ERR("no proto in alias param\n"); return -1; } @@ -1492,7 +1493,7 @@ static int contact_1918(struct sip_msg *msg) struct sip_uri uri; contact_t *c; - if(get_contact_uri(msg, &uri, &c) == -1) + if(get_contact_uri(msg, &uri, &c) < 0) return -1; return (is1918addr(&(uri.host)) == 1) ? 1 : 0; @@ -1507,7 +1508,7 @@ static int contact_rport(struct sip_msg *msg) struct sip_uri uri; contact_t *c; - if(get_contact_uri(msg, &uri, &c) == -1) { + if(get_contact_uri(msg, &uri, &c) < 0) { return -1; } @@ -2292,6 +2293,7 @@ static void nh_timer(unsigned int ticks, void *timer_idx) static unsigned int iteration = 0; int rval; void *buf, *cp; + char *buf_end; str c; str recv; str *dst_uri; @@ -2358,25 +2360,78 @@ static void nh_timer(unsigned int ticks, void *timer_idx) goto done; cp = buf; + buf_end = (char *)buf + cblen; while(1) { + if((char *)cp + sizeof(c.len) > buf_end) { + LM_ERR("truncated natping contact blob while reading contact " + "length\n"); + goto error; + } memcpy(&(c.len), cp, sizeof(c.len)); if(c.len == 0) break; - c.s = (char *)cp + sizeof(c.len); - cp = (char *)cp + sizeof(c.len) + c.len; + cp = (char *)cp + sizeof(c.len); + if(c.len < 0 || (char *)cp + c.len > buf_end) { + LM_ERR("invalid natping contact length: %d\n", c.len); + goto error; + } + c.s = (char *)cp; + cp = (char *)cp + c.len; + if((char *)cp + sizeof(recv.len) > buf_end) { + LM_ERR("truncated natping contact blob while reading received " + "length\n"); + goto error; + } memcpy(&(recv.len), cp, sizeof(recv.len)); - recv.s = (char *)cp + sizeof(recv.len); - cp = (char *)cp + sizeof(recv.len) + recv.len; + cp = (char *)cp + sizeof(recv.len); + if(recv.len < 0 || (char *)cp + recv.len > buf_end) { + LM_ERR("invalid natping received length: %d\n", recv.len); + goto error; + } + recv.s = recv.len ? (char *)cp : NULL; + cp = (char *)cp + recv.len; + if((char *)cp + sizeof(send_sock) > buf_end) { + LM_ERR("truncated natping contact blob while reading socket\n"); + goto error; + } memcpy(&send_sock, cp, sizeof(send_sock)); cp = (char *)cp + sizeof(send_sock); + if((char *)cp + sizeof(flags) > buf_end) { + LM_ERR("truncated natping contact blob while reading flags\n"); + goto error; + } memcpy(&flags, cp, sizeof(flags)); cp = (char *)cp + sizeof(flags); + if((char *)cp + sizeof(path.len) > buf_end) { + LM_ERR("truncated natping contact blob while reading path " + "length\n"); + goto error; + } memcpy(&(path.len), cp, sizeof(path.len)); - path.s = path.len ? ((char *)cp + sizeof(path.len)) : NULL; - cp = (char *)cp + sizeof(path.len) + path.len; + cp = (char *)cp + sizeof(path.len); + if(path.len < 0 || (char *)cp + path.len > buf_end) { + LM_ERR("invalid natping path length: %d\n", path.len); + goto error; + } + path.s = path.len ? (char *)cp : NULL; + cp = (char *)cp + path.len; + if((char *)cp + sizeof(ruid.len) > buf_end) { + LM_ERR("truncated natping contact blob while reading ruid " + "length\n"); + goto error; + } memcpy(&(ruid.len), cp, sizeof(ruid.len)); - ruid.s = ruid.len ? ((char *)cp + sizeof(ruid.len)) : NULL; - cp = (char *)cp + sizeof(ruid.len) + ruid.len; + cp = (char *)cp + sizeof(ruid.len); + if(ruid.len < 0 || (char *)cp + ruid.len > buf_end) { + LM_ERR("invalid natping ruid length: %d\n", ruid.len); + goto error; + } + ruid.s = ruid.len ? (char *)cp : NULL; + cp = (char *)cp + ruid.len; + if((char *)cp + sizeof(aorhash) > buf_end) { + LM_ERR("truncated natping contact blob while reading aorhash\n"); + goto error; + } memcpy(&aorhash, cp, sizeof(aorhash)); cp = (char *)cp + sizeof(aorhash); @@ -2475,11 +2530,15 @@ static void nh_timer(unsigned int ticks, void *timer_idx) } } } + +error: pkg_free(buf); + done: iteration++; if(iteration == natping_interval) iteration = 0; + return; } @@ -2717,7 +2776,7 @@ done: static int sel_rewrite_contact(str *res, select_t *s, struct sip_msg *msg) { - static char buf[500]; + static char buf[MAX_URI_SIZE]; contact_t *c; int n, def_port_fl, len; char *cp; @@ -2751,7 +2810,7 @@ static int sel_rewrite_contact(str *res, select_t *s, struct sip_msg *msg) || (msg->rcv.proto != PROTO_TLS && msg->rcv.src_port == SIP_PORT); if(!def_port_fl) len += 1 /*:*/ + 5 /*port*/; - if(len > sizeof(buf)) { + if(len > sizeof(buf) - 1) { LM_ERR("rewrite contact[%d] - contact too long\n", s->params[2].v.i); return -1; } @@ -2764,14 +2823,25 @@ static int sel_rewrite_contact(str *res, select_t *s, struct sip_msg *msg) memcpy(buf, c->name.s, res->len); cp = ip_addr2a(&msg->rcv.src_ip); if(def_port_fl) { - res->len += snprintf(buf + res->len, sizeof(buf) - res->len, "%s", cp); + len = snprintf(buf + res->len, sizeof(buf) - res->len, "%s", cp); } else { - res->len += snprintf(buf + res->len, sizeof(buf) - res->len, "%s:%d", - cp, msg->rcv.src_port); + len = snprintf(buf + res->len, sizeof(buf) - res->len, "%s:%d", cp, + msg->rcv.src_port); + } + if(len < 0 || len >= sizeof(buf) - res->len) { + LM_ERR("rewrite contact[%d] - result address too long\n", + s->params[2].v.i); + return -1; + } + res->len += len; + len = res->len + c->len - (hostport.s + hostport.len - c->name.s); + if(len >= MAX_URI_SIZE - 1) { + LM_ERR("rewrite contact[%d] - result too long\n", s->params[2].v.i); + return -1; } memcpy(buf + res->len, hostport.s + hostport.len, c->len - (hostport.s + hostport.len - c->name.s)); - res->len += c->len - (hostport.s + hostport.len - c->name.s); + res->len = len; return 0; } @@ -2900,6 +2970,7 @@ static int nh_alias_to_uri(str *contact_header, str *alias_uri) str port = {0, 0}; str proto = {0, 0}; char *memchr_pointer = NULL; + unsigned int proto_type = 0; if(!contact_header) return -1; @@ -2948,7 +3019,22 @@ static int nh_alias_to_uri(str *contact_header, str *alias_uri) } //last char is proto 0,1,2,3,4..7 proto.s = &port.s[port.len + 1]; - proto_type_to_str((unsigned short)atoi(proto.s), &proto); + if(proto.s >= contact_header->s + contact_header->len + || !isdigit((unsigned char)*proto.s)) { + LM_ERR("alias proto is not set or invalid\n"); + return -1; + } + proto_type = (unsigned int)(*proto.s - '0'); + if(proto.s + 1 < contact_header->s + contact_header->len + && isdigit((unsigned char)proto.s[1])) { + LM_ERR("alias proto has invalid length\n"); + return -1; + } + proto_type_to_str((unsigned short)proto_type, &proto); + if(proto.len == 0) { + LM_ERR("alias proto is unknown\n"); + return -1; + } LM_DBG("Host [%.*s][port: %.*s][proto: %.*s]\n", host.len, host.s, port.len, port.s, proto.len, proto.s); diff --git a/src/modules/nathelper/nhelpr_funcs.c b/src/modules/nathelper/nhelpr_funcs.c index 898daa0ee..5098c5dab 100644 --- a/src/modules/nathelper/nhelpr_funcs.c +++ b/src/modules/nathelper/nhelpr_funcs.c @@ -285,12 +285,24 @@ done: */ int get_contact_uri(struct sip_msg *_m, struct sip_uri *uri, contact_t **_c) { - if((parse_headers(_m, HDR_CONTACT_F, 0) == -1) || !_m->contact) - return -1; + if(!_m->contact) { + if(parse_headers(_m, HDR_CONTACT_F, 0) == -1) { + LM_ERR("while parsing headers\n"); + return -1; + } + if(!_m->contact) { + LM_DBG("no Contact header\n"); + return -2; + } + } if(!_m->contact->parsed && parse_contact(_m->contact) < 0) { LM_ERR("failed to parse Contact body\n"); return -1; } + if(((contact_body_t *)_m->contact->parsed)->star == 1) { + LM_DBG("star Contact header\n"); + return -3; + } *_c = ((contact_body_t *)_m->contact->parsed)->contacts; if(*_c == NULL) /* no contacts found */ diff --git a/src/modules/ndb_redis/redis_client.c b/src/modules/ndb_redis/redis_client.c index 99012f25a..c8bb257dd 100644 --- a/src/modules/ndb_redis/redis_client.c +++ b/src/modules/ndb_redis/redis_client.c @@ -93,6 +93,27 @@ static inline void cleanup_redis_context(redisc_server_t *rsrv) #endif } +static inline int redisc_ensure_connected(redisc_server_t *rsrv) +{ + if(rsrv == NULL) { + return -1; + } + + if(rsrv->ctxRedis != NULL) { + return 0; + } + + LM_NOTICE("redis server %.*s has no active context, trying reconnect\n", + rsrv->sname->len, rsrv->sname->s); + if(redisc_reconnect_server(rsrv) == 0 && rsrv->ctxRedis != NULL) { + return 0; + } + + LM_ERR("unable to reconnect to redis server: %.*s\n", rsrv->sname->len, + rsrv->sname->s); + return -1; +} + /** * */ @@ -764,10 +785,6 @@ int redisc_append_cmd(str *srv, str *res, str *cmd, ...) LM_ERR("no redis server found: %.*s\n", srv->len, srv->s); goto error_cmd; } - if(rsrv->ctxRedis == NULL) { - LM_ERR("no redis context for server: %.*s\n", srv->len, srv->s); - goto error_cmd; - } if(rsrv->piped.pending_commands >= MAXIMUM_PIPELINED_COMMANDS) { LM_ERR("Too many pipelined commands, maximum is %d\n", MAXIMUM_PIPELINED_COMMANDS); @@ -820,10 +837,6 @@ int redisc_exec_pipelined_cmd(str *srv) LM_ERR("no redis server found: %.*s\n", srv->len, srv->s); return -1; } - if(rsrv->ctxRedis == NULL) { - LM_ERR("no redis context for server: %.*s\n", srv->len, srv->s); - return -1; - } return redisc_exec_pipelined(rsrv); } @@ -834,6 +847,10 @@ int redisc_create_pipelined_message(redisc_server_t *rsrv) { int i; + if(redisc_ensure_connected(rsrv) < 0) { + return -1; + } + if(rsrv->ctxRedis->err) { LOG(ndb_redis_debug, "Reconnecting server because of error %d: \"%s\"", rsrv->ctxRedis->err, rsrv->ctxRedis->errstr); @@ -883,15 +900,15 @@ int redisc_exec_pipelined(redisc_server_t *rsrv) goto srv_disabled; } + if(redisc_ensure_connected(rsrv) < 0) { + redis_count_err_and_disable(rsrv); + goto error_exec; + } + if(rsrv->piped.pending_commands == 0) { LM_WARN("call for redis_cmd without any pipelined commands\n"); return -1; } - if(rsrv->ctxRedis == NULL) { - LM_ERR("no redis context for server: %.*s\n", rsrv->sname->len, - rsrv->sname->s); - goto error_exec; - } /* send the commands and retrieve the first reply */ rpl = rsrv->piped.replies[0]; @@ -1100,14 +1117,6 @@ int redisc_exec(str *srv, str *res, str *cmd, ...) goto error_exec; } - LM_DBG("rsrv->ctxRedis = %p\n", rsrv->ctxRedis); - - if(rsrv->ctxRedis == NULL) { - LM_ERR("no redis context for server: %.*s\n", srv->len, srv->s); - goto error_exec; - } - LM_DBG("rsrv->ctxRedis = %p\n", rsrv->ctxRedis); - if(rsrv->piped.pending_commands != 0) { LM_NOTICE("Calling redis_cmd with pipelined commands in the buffer." " Automatically call redis_execute"); @@ -1118,6 +1127,12 @@ int redisc_exec(str *srv, str *res, str *cmd, ...) goto srv_disabled; } + if(redisc_ensure_connected(rsrv) < 0) { + redis_count_err_and_disable(rsrv); + goto error_exec; + } + LM_DBG("rsrv->ctxRedis = %p\n", rsrv->ctxRedis); + rpl = redisc_get_reply(res); if(rpl == NULL) { LM_ERR("no redis reply id found: %.*s\n", res->len, res->s); @@ -1151,12 +1166,10 @@ int redisc_exec(str *srv, str *res, str *cmd, ...) } if(check_cluster_reply(rpl->rplRedis, &rsrv)) { - LM_DBG("rsrv->ctxRedis = %p\n", rsrv->ctxRedis); - if(rsrv->ctxRedis == NULL) { - LM_ERR("no redis context for server: %.*s\n", srv->len, srv->s); + if(redisc_ensure_connected(rsrv) < 0) { + redis_count_err_and_disable(rsrv); goto error_exec; } - LM_DBG("rsrv->ctxRedis = %p\n", rsrv->ctxRedis); if(rpl->rplRedis != NULL) { @@ -1243,9 +1256,7 @@ redisReply *redisc_exec_argv(redisc_server_t *rsrv, int argc, const char **argv, } LM_DBG("rsrv->ctxRedis = %p\n", rsrv->ctxRedis); - if(rsrv->ctxRedis == NULL) { - LM_ERR("no redis context found for server %.*s\n", - (rsrv) ? rsrv->sname->len : 0, (rsrv) ? rsrv->sname->s : ""); + if(redisc_ensure_connected(rsrv) < 0) { return NULL; } diff --git a/src/modules/permissions/hash.c b/src/modules/permissions/hash.c index 1ef625913..354ac2a03 100644 --- a/src/modules/permissions/hash.c +++ b/src/modules/permissions/hash.c @@ -261,7 +261,7 @@ int match_hash_table(struct trusted_list **table, struct sip_msg *msg, LM_DBG("match_hash_table src_ip: %s, proto: %d, uri: %s\n", src_ip_c_str, proto, from_uri); str ruri; - char ruri_string[MAX_URI_SIZE + 1]; + char ruri_string[MAX_URI_SIZE]; regex_t preg; struct trusted_list *np; str src_ip; @@ -273,7 +273,7 @@ int match_hash_table(struct trusted_list **table, struct sip_msg *msg, if(IS_SIP(msg)) { ruri = msg->first_line.u.request.uri; - if(ruri.len > MAX_URI_SIZE) { + if(ruri.len >= MAX_URI_SIZE - 1) { LM_ERR("message has Request URI too large\n"); return -1; } diff --git a/src/modules/permissions/permissions.c b/src/modules/permissions/permissions.c index fcf17fc75..65e23801d 100644 --- a/src/modules/permissions/permissions.c +++ b/src/modules/permissions/permissions.c @@ -34,6 +34,7 @@ #include "rpc.h" #include "../../core/mem/mem.h" #include "../../core/parser/parse_from.h" +#include "../../core/parser/parse_to.h" #include "../../core/parser/parse_uri.h" #include "../../core/parser/parse_refer_to.h" #include "../../core/parser/contact/parse_contact.h" @@ -843,6 +844,11 @@ static int check_register(struct sip_msg *msg, int idx, int check_port) return 1; } + if((!msg->to->parsed) && (parse_to_header(msg) < 0)) { + LM_ERR("failed to parse To body\n"); + return -1; + } + len = ((struct to_body *)msg->to->parsed)->uri.len; if(len > EXPRESSION_LENGTH) { LM_ERR("To header field is too long: %d chars\n", len); diff --git a/src/modules/permissions/rule.c b/src/modules/permissions/rule.c index 919dcd267..daa39855b 100644 --- a/src/modules/permissions/rule.c +++ b/src/modules/permissions/rule.c @@ -181,7 +181,10 @@ void free_expression(expression *e) if(e->next) free_expression(e->next); - regfree(e->reg_value); + if(e->reg_value) { + regfree(e->reg_value); + pkg_free(e->reg_value); + } pkg_free(e); } diff --git a/src/modules/phonenum/CMakeLists.txt b/src/modules/phonenum/CMakeLists.txt index ed26b71d9..6d4e9bf49 100644 --- a/src/modules/phonenum/CMakeLists.txt +++ b/src/modules/phonenum/CMakeLists.txt @@ -21,10 +21,10 @@ else() if(libphonenumber_LIBRARY AND libgeocoding_LIBRARY) set(libphonenum_LIBRARY ${libphonenumber_LIBRARY} ${libgeocoding_LIBRARY}) - find_path(libphonenumber_INCLUDE_DIR phonenumbers/geocoding/phonenumber_offline_geocoder.h + find_path(libphonenumber_INCLUDE_DIRS phonenumbers/geocoding/phonenumber_offline_geocoder.h phonenumbers/phonenumberutil.h ) - message(STATUS "Found libphonenumber include directory: ${libphonenumber_INCLUDE_DIR}") + message(STATUS "Found libphonenumber include directory: ${libphonenumber_INCLUDE_DIRS}") message(STATUS "Found libphonenumber library: ${libphonenum_LIBRARY}") else() message(FATAL_ERROR "libphonenumber library not found") diff --git a/src/modules/pike/pike_top.c b/src/modules/pike/pike_top.c index 71cda2a33..ce1bea9f5 100644 --- a/src/modules/pike/pike_top.c +++ b/src/modules/pike/pike_top.c @@ -45,9 +45,6 @@ struct TopListItem_t *pike_top_get_root() char *pike_top_print_addr( unsigned char *ip, int iplen, char *obuff, int obuffsize) { - unsigned short *ipv6_ptr = (unsigned short *)ip; - int blen; - memset(obuff, 0, obuffsize); DBG("address iplen: %d, buffsize: %d", iplen, obuffsize); @@ -57,15 +54,8 @@ char *pike_top_print_addr( } else if(iplen == 16) { inet_ntop(AF_INET6, ip, obuff, obuffsize); } else { - blen = snprintf(obuff, obuffsize, - "%04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x", htons(ipv6_ptr[0]), - htons(ipv6_ptr[1]), htons(ipv6_ptr[2]), htons(ipv6_ptr[3]), - htons(ipv6_ptr[4]), htons(ipv6_ptr[5]), htons(ipv6_ptr[6]), - htons(ipv6_ptr[7])); - if(blen < 0 || blen >= obuffsize) { - LM_ERR("failed to print the address - reset it\n"); - memset(obuff, 0, obuffsize); - } + strcpy(obuff, "0.0.0.0"); + LM_ERR("unsupported ip address length: %d\n", iplen); } return obuff; diff --git a/src/modules/pipelimit/pipelimit.c b/src/modules/pipelimit/pipelimit.c index 4f24db942..2b4539f48 100644 --- a/src/modules/pipelimit/pipelimit.c +++ b/src/modules/pipelimit/pipelimit.c @@ -38,6 +38,7 @@ #include #include #include +#include #include "../../core/mem/mem.h" #include "../../core/mem/shm_mem.h" @@ -68,6 +69,7 @@ MODULE_VERSION * timer interval length in seconds, tunable via modparam */ #define PL_TIMER_INTERVAL_DEFAULT 10 +#define PL_HASH_SIZE_MAX 20 /** SL API structure */ static sl_api_t _pl_slb; @@ -262,18 +264,24 @@ static int get_cpuload(double *load) + (n_sirq - o_sirq) + (n_stl - o_stl); long long d_idle = (n_idle - o_idle); - vload = ((double)d_idle) / (double)d_total; - - /* divide by numbers of cpu */ - ncpu = get_num_cpus(); - vload = vload / ncpu; - vload = 1.0 - vload; - if(vload < 0.0) - vload = 0.0; - else if(vload > 1.0) - vload = 1.0; - - *load = vload; + if(d_total <= 0) { + LM_DBG("no CPU tick delta available\n"); + } else { + vload = ((double)d_idle) / (double)d_total; + + /* divide by numbers of cpu */ + ncpu = get_num_cpus(); + vload = vload / ncpu; + vload = 1.0 - vload; + if(vload < 0.0) + vload = 0.0; + else if(vload > 1.0) + vload = 1.0; + + if(isfinite(vload)) { + *load = vload; + } + } } o_user = n_user; @@ -300,6 +308,14 @@ static void do_update_load(void) int load; double err, dif_err, output; + if(!isfinite(*load_value)) { + *load_value = 0.0; + } else if(*load_value < 0.0) { + *load_value = 0.0; + } else if(*load_value > 1.0) { + *load_value = 1.0; + } + /* PID update */ err = *_pl_pid_setpoint - *load_value; @@ -322,8 +338,13 @@ static void do_update_load(void) *drop_rate = (output > 0) ? output : 0; load = 0.5 + 100.0 * *load_value; /* round instead of floor */ + if(load < 0) { + load = 0; + } else if(load > 100) { + load = 100; + } - memset(spcs, '-', load / 4); + memset(spcs, '-', (size_t)(load / 4)); spcs[load / 4] = 0; /* @@ -340,6 +361,47 @@ static void update_cpu_load(void) do_update_load(); } +static void pl_cleanup(void) +{ + if(network_load_value != NULL) { + shm_free(network_load_value); + network_load_value = NULL; + } + if(load_value != NULL) { + shm_free(load_value); + load_value = NULL; + } + if(load_source != NULL) { + shm_free(load_source); + load_source = NULL; + } + if(pid_kp != NULL) { + shm_free(pid_kp); + pid_kp = NULL; + } + if(pid_ki != NULL) { + shm_free(pid_ki); + pid_ki = NULL; + } + if(pid_kd != NULL) { + shm_free(pid_kd); + pid_kd = NULL; + } + if(_pl_pid_setpoint != NULL) { + shm_free(_pl_pid_setpoint); + _pl_pid_setpoint = NULL; + } + if(drop_rate != NULL) { + shm_free(drop_rate); + drop_rate = NULL; + } + if(pl_timer != NULL) { + timer_free(pl_timer); + pl_timer = NULL; + } + pl_destroy_htable(); +} + /* initialize ratelimit module */ static int mod_init(void) { @@ -351,77 +413,70 @@ static int mod_init(void) LM_ERR("invalid hash size parameter: %d\n", pl_hash_size); return -1; } - if(pl_init_htable(1 << pl_hash_size) < 0) { + if(pl_hash_size > PL_HASH_SIZE_MAX) { + LM_ERR("hash size parameter too large: %d - max is %d\n", pl_hash_size, + PL_HASH_SIZE_MAX); + return -1; + } + if(pl_timer_interval <= 0) { + LM_ERR("invalid timer interval parameter: %d\n", pl_timer_interval); + return -1; + } + if(pl_init_htable(1U << pl_hash_size) < 0) { LM_ERR("could not allocate pipes htable\n"); return -1; } if(pl_init_db() < 0) { LM_ERR("could not load pipes description\n"); - return -1; - } - - if(pl_timer_mode == 0) { - /* register timer to reset counters */ - if((pl_timer = timer_alloc()) == NULL) { - LM_ERR("could not allocate timer\n"); - return -1; - } - timer_init(pl_timer, pl_timer_handle, 0, F_TIMER_FAST); - /* execute timer routine after pl_timer_interval * 1000ms */ - timer_add(pl_timer, pl_timer_interval * MS_TO_TICKS(1000)); - } else { - if(sr_wtimer_add(pl_timer_exec, NULL, pl_timer_interval) < 0) { - LM_ERR("cannot add timer exec routine\n"); - return -1; - } + goto error; } /* bind the SL API */ if(sl_load_api(&_pl_slb) != 0) { LM_ERR("cannot bind to SL API\n"); - return -1; + goto error; } network_load_value = shm_malloc(sizeof(int)); if(network_load_value == NULL) { LM_ERR("oom for network_load_value\n"); - return -1; + goto error; } load_value = shm_malloc(sizeof(double)); if(load_value == NULL) { LM_ERR("oom for load_value\n"); - return -1; + goto error; } load_source = shm_malloc(sizeof(int)); if(load_source == NULL) { LM_ERR("oom for load_source\n"); - return -1; + goto error; } pid_kp = shm_malloc(sizeof(double)); if(pid_kp == NULL) { LM_ERR("oom for pid_kp\n"); - return -1; + goto error; } pid_ki = shm_malloc(sizeof(double)); if(pid_ki == NULL) { LM_ERR("oom for pid_ki\n"); - return -1; + goto error; } pid_kd = shm_malloc(sizeof(double)); if(pid_kd == NULL) { LM_ERR("oom for pid_kd\n"); - return -1; + goto error; } _pl_pid_setpoint = shm_malloc(sizeof(double)); if(_pl_pid_setpoint == NULL) { LM_ERR("oom for pid_setpoint\n"); - return -1; + goto error; } drop_rate = shm_malloc(sizeof(int)); if(drop_rate == NULL) { LM_ERR("oom for drop_rate\n"); - return -1; + goto error; } *network_load_value = 0; @@ -433,7 +488,30 @@ static int mod_init(void) *_pl_pid_setpoint = 0.01 * (double)_pl_cfg_setpoint; *drop_rate = 0; + if(pl_timer_mode == 0) { + /* register timer to reset counters */ + if((pl_timer = timer_alloc()) == NULL) { + LM_ERR("could not allocate timer\n"); + goto error; + } + timer_init(pl_timer, pl_timer_handle, 0, F_TIMER_FAST); + /* execute timer routine after pl_timer_interval * 1000ms */ + if(timer_add(pl_timer, pl_timer_interval * MS_TO_TICKS(1000)) < 0) { + LM_ERR("cannot add timer routine\n"); + goto error; + } + } else { + if(sr_wtimer_add(pl_timer_exec, NULL, pl_timer_interval) < 0) { + LM_ERR("cannot add timer exec routine\n"); + goto error; + } + } + return 0; + +error: + pl_cleanup(); + return -1; } @@ -541,8 +619,16 @@ int hash[100] = {18, 50, 51, 39, 49, 68, 8, 78, 61, 75, 53, 32, 45, 77, 31, 12, static int pipe_push_direct(pl_pipe_t *pipe) { int ret; + unsigned int hash_idx; - pipe->counter++; + if(pipe->counter < 0) { + LM_WARN("resetting negative counter for pipe %.*s\n", pipe->name.len, + pipe->name.s); + pipe->counter = 0; + } + if(pipe->counter < INT_MAX) { + pipe->counter++; + } switch(pipe->algo) { case PIPE_ALGO_NOP: @@ -560,7 +646,8 @@ static int pipe_push_direct(pl_pipe_t *pipe) ret = (!(pipe->counter % pipe->load)) ? 1 : -1; break; case PIPE_ALGO_FEEDBACK: - ret = (hash[pipe->counter % 100] < *drop_rate) ? -1 : 1; + hash_idx = ((unsigned int)pipe->counter) % 100; + ret = (hash[hash_idx] < *drop_rate) ? -1 : 1; break; case PIPE_ALGO_NETWORK: ret = -1 * pipe->load; diff --git a/src/modules/pipelimit/pl_db.c b/src/modules/pipelimit/pl_db.c index f6f0d1cbf..3f4523e37 100644 --- a/src/modules/pipelimit/pl_db.c +++ b/src/modules/pipelimit/pl_db.c @@ -70,6 +70,39 @@ str rlp_table_name = str_init(RLP_TABLE_NAME); int pl_load_db(void); +static int pl_db_get_str(db_val_t *value, str *out, const char *colname) +{ + if(value == NULL || out == NULL) { + LM_ERR("invalid db value for column %s\n", colname); + return -1; + } + if(VAL_NULL(value)) { + LM_ERR("null value for column %s\n", colname); + return -1; + } + + switch(VAL_TYPE(value)) { + case DB1_STRING: + if(VAL_STRING(value) == NULL) { + LM_ERR("null string value for column %s\n", colname); + return -1; + } + out->s = (char *)VAL_STRING(value); + out->len = strlen(out->s); + return 0; + case DB1_STR: + if(VAL_STR(value).s == NULL || VAL_STR(value).len < 0) { + LM_ERR("invalid str value for column %s\n", colname); + return -1; + } + *out = VAL_STR(value); + return 0; + default: + LM_ERR("invalid type %d for column %s\n", VAL_TYPE(value), colname); + return -1; + } +} + int pl_connect_db(void) { if(pl_db_url.s == NULL) @@ -179,11 +212,11 @@ int pl_load_db(void) for(i = 0; i < nr_rows; i++) { values = ROW_VALUES(rows + i); - pipeid.s = VAL_STR(values).s; - pipeid.len = strlen(pipeid.s); + if(pl_db_get_str(values, &pipeid, RLP_PIPEID_COL) < 0) + goto error; limit = VAL_INT(values + 1); - algorithm.s = VAL_STR(values + 2).s; - algorithm.len = strlen(algorithm.s); + if(pl_db_get_str(values + 2, &algorithm, RLP_ALGORITHM_COL) < 0) + goto error; if(pl_pipe_add(&pipeid, &algorithm, limit) != 0) goto error; diff --git a/src/modules/pipelimit/pl_ht.c b/src/modules/pipelimit/pl_ht.c index 320c0e9c3..0e4defd41 100644 --- a/src/modules/pipelimit/pl_ht.c +++ b/src/modules/pipelimit/pl_ht.c @@ -76,6 +76,7 @@ int pl_init_htable(unsigned int hsize) if(_pl_pipes_ht->slots == NULL) { LM_ERR("no more shm.\n"); shm_free(_pl_pipes_ht); + _pl_pipes_ht = NULL; return -1; } memset(_pl_pipes_ht->slots, 0, _pl_pipes_ht->htsize * sizeof(rlp_slot_t)); @@ -90,6 +91,7 @@ int pl_init_htable(unsigned int hsize) } shm_free(_pl_pipes_ht->slots); shm_free(_pl_pipes_ht); + _pl_pipes_ht = NULL; return -1; } } @@ -142,6 +144,11 @@ int pl_pipe_add(str *pipeid, str *algorithm, int limit) if(_pl_pipes_ht == NULL) return -1; + if(pipeid == NULL || pipeid->s == NULL || pipeid->len <= 0 || pipeid->len > 4096) { + LM_ERR("invalid pipeid\n"); + return -1; + } + cellid = pl_compute_hash(pipeid); idx = pl_get_entry(cellid, _pl_pipes_ht->htsize); diff --git a/src/modules/prefix_route/pr_rpc.c b/src/modules/prefix_route/pr_rpc.c index 3cad03ab3..9504c9ca4 100644 --- a/src/modules/prefix_route/pr_rpc.c +++ b/src/modules/prefix_route/pr_rpc.c @@ -89,5 +89,10 @@ static void rpc_reload(rpc_t *rpc, void *c) } -rpc_export_t pr_rpc[] = {{"prefix_route.reload", rpc_reload, rpc_reload_doc, 0}, - {"prefix_route.dump", rpc_dump, rpc_dump_doc, 0}, {0, 0, 0, 0}}; +/* clang-format off */ +rpc_export_t pr_rpc[] = { + {"prefix_route.reload", rpc_reload, rpc_reload_doc, 0}, + {"prefix_route.dump", rpc_dump, rpc_dump_doc, 0}, + {0, 0, 0, 0} +}; +/* clang-format on */ diff --git a/src/modules/prefix_route/tree.c b/src/modules/prefix_route/tree.c index 52a420004..ba098efb7 100644 --- a/src/modules/prefix_route/tree.c +++ b/src/modules/prefix_route/tree.c @@ -49,7 +49,7 @@ enum struct tree_item { struct tree_item *digits[DIGITS]; /**< Child items for each digit */ - char name[16]; /**< Route name (for dump) */ + char name[64]; /**< Route name (for dump) */ int route; /**< Valid route number if >0 */ }; diff --git a/src/modules/presence/notify.c b/src/modules/presence/notify.c index 55622818a..717b7dbc1 100644 --- a/src/modules/presence/notify.c +++ b/src/modules/presence/notify.c @@ -2112,6 +2112,12 @@ str *create_winfo_xml(watcher_t *watchers, char *version, str resource, w = watchers->next; while(w) { + if(w->uri.len == 0 || w->uri.len > (int)sizeof(content) - 1) { + LM_ERR("Invalid watcher URI length (0 or over %d)\n", + (int)sizeof(content) - 1); + goto error; + } + strncpy(content, w->uri.s, w->uri.len); content[w->uri.len] = '\0'; node = xmlNewChild( diff --git a/src/modules/presence/publish.c b/src/modules/presence/publish.c index 3b629d682..d1fe8075f 100644 --- a/src/modules/presence/publish.c +++ b/src/modules/presence/publish.c @@ -501,9 +501,19 @@ int ki_handle_publish_uri(struct sip_msg *msg, str *sender_uri) } body.len = msg->buf + msg->len - body.s; - if(pres_sphere_enable && event->evp->type == EVENT_PRESENCE - && get_content_type(msg) == SUBTYPE_PIDFXML) { - sphere = extract_sphere(&body); + if(pres_sphere_enable && event->evp->type == EVENT_PRESENCE) { + int mime = 0; + mime = parse_content_type_hdr(msg); + if(mime < 0) { + LM_ERR("cannot parse Content-Type header\n"); + reply_code = 400; + reply_str = pu_400a_rpl; + goto error; + } + + if(mime == SUBTYPE_PIDFXML) { + sphere = extract_sphere(&body); + } } } memset(&puri, 0, sizeof(struct sip_uri)); diff --git a/src/modules/pua/README b/src/modules/pua/README index be627f315..41b896ad2 100644 --- a/src/modules/pua/README +++ b/src/modules/pua/README @@ -189,7 +189,7 @@ modparam("pua", "hash_size", 11) Database url. - Default value is “>mysql://kamailio:kamailiorw@localhost/kamailio”. + Default value is “mysql://kamailio:kamailiorw@localhost/kamailio”. Example 1.2. Set db_url parameter ... diff --git a/src/modules/pua/doc/pua_admin.xml b/src/modules/pua/doc/pua_admin.xml index aa56f1655..0e20cbf76 100644 --- a/src/modules/pua/doc/pua_admin.xml +++ b/src/modules/pua/doc/pua_admin.xml @@ -105,7 +105,7 @@ modparam("pua", "hash_size", 11) Database url. - Default value is >&defaultdb;. + Default value is &defaultdb;. diff --git a/src/modules/pua_bla/notify.c b/src/modules/pua_bla/notify.c index cd9c6c716..66ca29f93 100644 --- a/src/modules/pua_bla/notify.c +++ b/src/modules/pua_bla/notify.c @@ -186,6 +186,10 @@ int bla_handle_notify(struct sip_msg *msg, char *s1, char *s2) contact = ((contact_body_t *)msg->contact->parsed)->contacts->uri; /* build extra_headers with Sender*/ + if(header_name.len + 2 + contact.len + CRLF_LEN > sizeof(buf)) { + LM_ERR("extra headers too long\n"); + goto error; + } extra_headers.s = buf; memcpy(extra_headers.s, header_name.s, header_name.len); extra_headers.len = header_name.len; diff --git a/src/modules/pv/pv_core.c b/src/modules/pv/pv_core.c index cd7840fd5..a3d35c1da 100644 --- a/src/modules/pv/pv_core.c +++ b/src/modules/pv/pv_core.c @@ -258,12 +258,6 @@ int pv_get_ruri(struct sip_msg *msg, pv_param_t *param, pv_value_t *res) if(msg->first_line.type == SIP_REPLY) /* REPLY doesn't have a ruri */ return pv_get_null(msg, param, res); - if(msg->parsed_uri_ok == 0 /* R-URI not parsed*/ - && parse_sip_msg_uri(msg) < 0) { - LM_ERR("failed to parse the R-URI\n"); - return pv_get_null(msg, param, res); - } - if(msg->new_uri.s != NULL) return pv_get_strval(msg, param, res, &msg->new_uri); return pv_get_strval(msg, param, res, &msg->first_line.u.request.uri); @@ -277,12 +271,6 @@ int pv_get_ouri(struct sip_msg *msg, pv_param_t *param, pv_value_t *res) if(msg->first_line.type == SIP_REPLY) /* REPLY doesn't have a ruri */ return pv_get_null(msg, param, res); - if(msg->parsed_orig_ruri_ok == 0 - /* orig R-URI not parsed*/ - && parse_orig_ruri(msg) < 0) { - LM_ERR("failed to parse the R-URI\n"); - return pv_get_null(msg, param, res); - } return pv_get_strval(msg, param, res, &msg->first_line.u.request.uri); } @@ -3676,7 +3664,7 @@ int pv_set_xto_attr(struct sip_msg *msg, pv_param_t *param, int op, } buf.len = val->rs.len; - if(!(tb->style & TBS_URI_ENCLOSED)) { + if(val->rs.len > 0 && !(tb->style & TBS_URI_ENCLOSED)) { /* existing uri not enclosed - check if new one has parameters */ for(p = val->rs.s + val->rs.len - 1; p > val->rs.s; p--) { if(*p == ';') { diff --git a/src/modules/pv/pv_trans.c b/src/modules/pv/pv_trans.c index 9e2915598..98d6fd09e 100644 --- a/src/modules/pv/pv_trans.c +++ b/src/modules/pv/pv_trans.c @@ -1204,9 +1204,13 @@ int tr_eval_string( i = 0; j = 0; max = val->rs.len - st.len; - while(i < val->rs.len && j < TR_BUFFER_SIZE) { + while(i < val->rs.len && j < TR_BUFFER_SIZE - 1) { if(i <= max && val->rs.s[i] == st.s[0] && strncmp(val->rs.s + i, st.s, st.len) == 0) { + if(j + st2.len >= TR_BUFFER_SIZE - 1) { + LM_ERR("replacing result is too long\n"); + return -1; + } strncpy(_tr_buffer + j, st2.s, st2.len); i += st.len; j += st2.len; @@ -1216,6 +1220,7 @@ int tr_eval_string( } val->rs.s = _tr_buffer; val->rs.len = j; + val->rs.s[val->rs.len] = '\0'; break; case TR_S_TIMEFORMAT: diff --git a/src/modules/pv/pv_xavp.c b/src/modules/pv/pv_xavp.c index 8858c3763..e65471348 100644 --- a/src/modules/pv/pv_xavp.c +++ b/src/modules/pv/pv_xavp.c @@ -402,7 +402,7 @@ char *pv_xavp_fill_ni(str *in, pv_xavp_name_t *xname) while(p < in->s + in->len && (*p == ' ' || *p == '\t' || *p == '\n' || *p == '\r')) p++; - if(p > in->s + in->len || *p == '\0') + if(p >= in->s + in->len || *p == '\0') goto error; xname->name.s = p; while(p < in->s + in->len) { @@ -460,7 +460,26 @@ error: void pv_xavp_name_destroy(pv_xavp_name_t *xname) { - return; + if(xname == NULL) + return; + + if(xname->next != NULL) { + pkg_free(xname->next); + xname->next = NULL; + } + pkg_free(xname); +} + +static void pv_xavp_name_free(void *pvn) +{ + pv_name_t *pname = NULL; + + if(pvn == NULL) + return; + + pname = (pv_name_t *)pvn; + pv_xavp_name_destroy((pv_xavp_name_t *)pname->u.dname); + pname->u.dname = NULL; } int pv_parse_xavp_name(pv_spec_p sp, str *in) @@ -512,16 +531,12 @@ int pv_parse_xavp_name(pv_spec_p sp, str *in) done: sp->pvp.pvn.u.dname = (void *)xname; sp->pvp.pvn.type = PV_NAME_PVAR; + sp->pvp.pvn.nfree = pv_xavp_name_free; return 0; error: if(xname != NULL) { - if(xname->next != NULL) { - pkg_free(xname->next); - xname->next = NULL; - } pv_xavp_name_destroy(xname); - pkg_free(xname); } return -1; } @@ -905,7 +920,26 @@ int pv_xavp_to_var(str *xname) void pv_xavu_name_destroy(pv_xavu_name_t *xname) { - return; + if(xname == NULL) + return; + + if(xname->next != NULL) { + pkg_free(xname->next); + xname->next = NULL; + } + pkg_free(xname); +} + +static void pv_xavu_name_free(void *pvn) +{ + pv_name_t *pname = NULL; + + if(pvn == NULL) + return; + + pname = (pv_name_t *)pvn; + pv_xavu_name_destroy((pv_xavu_name_t *)pname->u.dname); + pname->u.dname = NULL; } int pv_parse_xavu_name(pv_spec_t *sp, str *in) @@ -964,16 +998,12 @@ int pv_parse_xavu_name(pv_spec_t *sp, str *in) done: sp->pvp.pvn.u.dname = (void *)xname; sp->pvp.pvn.type = PV_NAME_PVAR; + sp->pvp.pvn.nfree = pv_xavu_name_free; return 0; error: if(xname != NULL) { - if(xname->next != NULL) { - pkg_free(xname->next); - xname->next = NULL; - } pv_xavu_name_destroy(xname); - pkg_free(xname); } return -1; } @@ -1063,7 +1093,26 @@ int pv_set_xavu(struct sip_msg *msg, pv_param_t *param, int op, pv_value_t *val) void pv_xavi_name_destroy(pv_xavp_name_t *xname) { - return; + if(xname == NULL) + return; + + if(xname->next != NULL) { + pkg_free(xname->next); + xname->next = NULL; + } + pkg_free(xname); +} + +static void pv_xavi_name_free(void *pvn) +{ + pv_name_t *pname = NULL; + + if(pvn == NULL) + return; + + pname = (pv_name_t *)pvn; + pv_xavi_name_destroy((pv_xavp_name_t *)pname->u.dname); + pname->u.dname = NULL; } int pv_parse_xavi_name(pv_spec_p sp, str *in) @@ -1115,6 +1164,7 @@ int pv_parse_xavi_name(pv_spec_p sp, str *in) done: sp->pvp.pvn.u.dname = (void *)xname; sp->pvp.pvn.type = PV_NAME_PVAR; + sp->pvp.pvn.nfree = pv_xavi_name_free; return 0; error: diff --git a/src/modules/pv_headers/pvh_xavp.c b/src/modules/pv_headers/pvh_xavp.c index f416fdb0c..4110d3948 100644 --- a/src/modules/pv_headers/pvh_xavp.c +++ b/src/modules/pv_headers/pvh_xavp.c @@ -713,7 +713,13 @@ xavp_c_data_t *pvh_set_parsed( return c_data; err: - // how can I call?? pvh_xavi_free_data(c_data, shm_free); + if(c_data != NULL) { + if(c_data->value.s != NULL) { + shm_free(c_data->value.s); + } + shm_free(c_data); + c_data = NULL; + } return NULL; } @@ -886,6 +892,13 @@ int pvh_set_uri(struct sip_msg *msg, pv_param_t *param, int op, pv_value_t *val) err: if(pv_format) pv_elem_free_all(pv_format); + if(c_data != NULL) { + if(c_data->value.s != NULL) { + shm_free(c_data->value.s); + } + shm_free(c_data); + c_data = NULL; + } return -1; } diff --git a/src/modules/regex/regex_mod.c b/src/modules/regex/regex_mod.c index b6cbed048..f2c509b5a 100644 --- a/src/modules/regex/regex_mod.c +++ b/src/modules/regex/regex_mod.c @@ -497,7 +497,7 @@ err: pcre2_code_free(pcres_tmp[i]); } } - pkg_free(pcres_tmp); + shm_free(pcres_tmp); } if(reload_lock) { lock_release(reload_lock); @@ -516,7 +516,7 @@ static void free_shared_memory(void) if(pcres) { for(i = 0; i < *num_pcres; i++) { if(pcres[i]) { - shm_free(pcres[i]); + pcre2_code_free(pcres[i]); } } shm_free(pcres); @@ -556,7 +556,7 @@ static int ki_pcre_match(sip_msg_t *msg, str *string, str *regex) size_t pcre_erroffset; pcre_re = pcre2_compile((PCRE2_SPTR)regex->s, PCRE2_ZERO_TERMINATED, - pcre_options, &pcre_error_num, &pcre_erroffset, pcres_ctx); + pcre_options, &pcre_error_num, &pcre_erroffset, NULL); if(pcre_re == NULL) { switch(pcre2_get_error_message( pcre_error_num, (PCRE2_UCHAR *)pcre_error, 128)) { @@ -575,14 +575,19 @@ static int ki_pcre_match(sip_msg_t *msg, str *string, str *regex) return -4; } - pcre_md = pcre2_match_data_create_from_pattern(pcre_re, pcres_gctx); + pcre_md = pcre2_match_data_create_from_pattern(pcre_re, NULL); + if(pcre_md == NULL) { + LM_ERR("failed to allocate pcre match data\n"); + pcre2_code_free(pcre_re); + return -4; + } pcre_rc = pcre2_match(pcre_re, /* the compiled pattern */ (PCRE2_SPTR)string->s, /* the matching string */ (PCRE2_SIZE)(string->len), /* the length of the subject */ 0, /* start at offset 0 in the string */ 0, /* default options */ pcre_md, /* the match data block */ - pcres_mctx); /* a match context; NULL means use defaults */ + NULL); /* NULL means use default match context */ /* Matching failed: handle error cases */ if(pcre_rc < 0) { @@ -667,15 +672,20 @@ static int ki_pcre_match_group(sip_msg_t *_msg, str *string, int num_pcre) } lock_get(reload_lock); - pcre_md = pcre2_match_data_create_from_pattern( - (*pcres_addr)[num_pcre], pcres_gctx); + pcre_md = + pcre2_match_data_create_from_pattern((*pcres_addr)[num_pcre], NULL); + if(pcre_md == NULL) { + lock_release(reload_lock); + LM_ERR("failed to allocate pcre match data for group %d\n", num_pcre); + return -4; + } pcre_rc = pcre2_match((*pcres_addr)[num_pcre], /* the compiled pattern */ (PCRE2_SPTR)string->s, /* the matching string */ (PCRE2_SIZE)(string->len), /* the length of the subject */ 0, /* start at offset 0 in the string */ 0, /* default options */ pcre_md, /* the match data block */ - pcres_mctx); /* a match context; NULL means use defaults */ + NULL); /* NULL means use default match context */ lock_release(reload_lock); if(pcre_md) diff --git a/src/modules/rr/loose.c b/src/modules/rr/loose.c index da0ffe726..ffaabe278 100644 --- a/src/modules/rr/loose.c +++ b/src/modules/rr/loose.c @@ -752,7 +752,7 @@ static inline void rr_do_force_send_socket( if(rr_sockname_mode != 0 && puri->params.len > 0) { s = puri->params; - if(s.s[s.len - 1] == ';') { + if(s.len > 0 && s.s[s.len - 1] == ';') { s.len--; } if(parse_params(&s, CLASS_ANY, &phooks, &plist) < 0) { diff --git a/src/modules/rr/record.c b/src/modules/rr/record.c index 47a63143e..1854d9bfe 100644 --- a/src/modules/rr/record.c +++ b/src/modules/rr/record.c @@ -362,6 +362,10 @@ static int copy_flow_token(str *token, struct sip_msg *_m) LM_ERR("parsing Route-URI\n"); return -1; } + if(puri.user.len <= 0 || puri.user.s == NULL) { + LM_ERR("empty flow-token in Route user part\n"); + return -1; + } token->s = pkg_malloc(puri.user.len * sizeof(char)); if(token->s == NULL) { diff --git a/src/modules/rtpengine/README b/src/modules/rtpengine/README index 38758673a..550144c2c 100644 --- a/src/modules/rtpengine/README +++ b/src/modules/rtpengine/README @@ -882,7 +882,7 @@ fd99") ... modparam("rtpengine", "read_sdp_pv", "$var(sdp)") ... -route { +request_route { ... $var(sdp) = $rb + "a=foo:bar\r\n"; rtpengine_manage(); @@ -900,7 +900,7 @@ route { ... modparam("rtpengine", "write_sdp_pv", "$avp(sdp)") ... -route { +request_route { ... rtpengine_manage(); set_body("$avp(sdp)a=baz123\r\n", "application/sdp"); @@ -918,7 +918,7 @@ route { modparam("rtpengine", "write_sdp_pv", "$avp(sdp)") modparam("rtpengine", "write_sdp_pv_mode", 1) ... -route { +request_route { ... rtpengine_manage(); xinfo("new sdp: $avp(sdp)\n"); @@ -2591,6 +2591,9 @@ rtpengine_offer(); + label=... - adds a label to a current stream, that later can be used to get call quality stats, see “mos_A_label_pv” and “mos_B_label_pv” parameters. + + debug - enables debug logging (rtpengine log level 7) for this + call only. rtpengine will log everything related to that call + after parsing the flags. Useful in debugging scenarios. Check also the documentation of RTPEngine, these flags are documented there as well: https://github.com/sipwise/rtpengine. * via-branch - provide the via-branch taken from one of SIP message @@ -2613,7 +2616,7 @@ rtpengine_offer(); This function can be used from ANY_ROUTE. Example 1.91. rtpengine_offer usage -route { +request_route { ... if (is_method("INVITE")) { if (has_body("application/sdp")) { @@ -2645,16 +2648,16 @@ onreply_route[2] } ... if (has_body("application/sdp")) { - if (rtpengine_offer("codec-mask=all codec-transcode=PCMU codec-t -ranscode=PCMA")) - t_on_reply("1"); + if (rtpengine_offer("codec-mask=all codec-transcode=PCMU codec-transcode=PCM +A")) + t_on_reply("1"); } ... Example 1.92. rtpengine_offer usage to force transcoding from opus to PCMU -route { +request_route { ... if (is_method("INVITE")) { if (has_body("application/sdp")) { @@ -2676,7 +2679,7 @@ onreply_route[1] ... Example 1.93. rtpengine_offer usage of via-branch parameter -route { +request_route { ... if (is_method("INVITE")) { if (has_body("application/sdp")) { @@ -2929,13 +2932,13 @@ rtpengine_subscribe_request(flags,sdp_avp,to_tag_avp,stream_xavp[,via-branch] This function can be used from ANY_ROUTE. Example 1.102. rtpengine_subscribe_request usage -route { +request_route { ... if (is_method("INVITE")) { if (has_body("application/sdp")) { if (rtpengine_offer()) t_on_reply("1"); - } + } } ... } @@ -2951,12 +2954,12 @@ onreply_route[1] (siprec_streams[0]=>label[0])\n"); xinfo("SIPREC participant $xavp(siprec_streams[1]=>tag) with label $xavp (siprec_streams[0]=>label[0])\n"); - #use the above steam information to build the siprec xml metadata, will -just send sdp in this example + # use the above stream information to build the siprec xml metadata, wil +l just send SDP in this example $dlg_var(orig_to_tag) = $tt; $dlg_var(siprec_contact) = "sip:uac@" + $Ri; $dlg_var(siprec_to_tag) = $avp(siprec_to_tag); - t_uac_send("INVITE","sip:siprec@siprec_server.example.com", + t_uac_send("INVITE" ,"sip:siprec@siprec_server.example.com", "siprec_server.example.com", "", "To: <$tu>\r\n" + "From: <$fu>\r\n" + @@ -2979,7 +2982,7 @@ n t_on_reply("2"); } if (is_method("ACK")) { - # save the routeset in the original dialog + # save the route set in the original dialog dlg_get($avp(orig_callid), $avp(orig_from_tag), $avp(orig_to_tag)); $dlg_var(siprec_cseq) = $cs; $dlg_var(siprec_to_hdr) = $hdr(To); @@ -2991,7 +2994,7 @@ d } } -onreply_route[1] { +onreply_route[2] { if (has_body("application/sdp")) { rtpengine_subscribe_answer("from-tag=$avp(orig_from_tag) to-tag=$avp(sipr ec_to_tag) call-id="$avp(orig_callid)"); @@ -3044,7 +3047,7 @@ ec_to_tag) call-id="$avp(orig_callid)"); Example 1.104. rtpengine_unsubscribe usage event_route [dialog:end] { - #call over, stop recording + # call over, stop recording rtpengine_unsubscribe("from-tag=$avp(orig_from_tag) to-tag=$avp(siprec_to_ta g) call-id="$avp(orig_callid)"); $var(new_cseq) = $dlg_var(siprec_cseq) + 1; @@ -3299,10 +3302,10 @@ play_dtmf("code=1 volume=5 duration=300 pause=150"); Example 1.118. $rtpestat Usage ... - append_hf("X-RTP-Statistics: $rtpestat\r\n"); +append_hf("X-RTP-Statistics: $rtpestat\r\n"); ... - # $rtpestat = RTP: 54846 bytes, 1447 packets, 0 errors; RTCP: 336 bytes, 3 p -ackets, 0 errors +# $rtpestat = RTP: 54846 bytes, 1447 packets, 0 errors; RTCP: 336 bytes, 3 packe +ts, 0 errors ... 16.2. $rtpstat @@ -3431,9 +3434,9 @@ $ kamctl rpc rtpengine.get_hash_total ... event_route[rtpengine:dtmf-event] { xlog("L_INFO", "callid: $avp(dtmf_event_callid)\n"); - xlog("L_INFO", "source_tag: $avp(dtmf_event_source_tag)\n"); - xlog("L_INFO", "timestamp: $avp(dtmf_event_timestamp)\n"); - xlog("L_INFO", "dtmf: $avp(dtmf_event)\n"); + xlog("L_INFO", "source_tag: $avp(dtmf_event_source_tag)\n"); + xlog("L_INFO", "timestamp: $avp(dtmf_event_timestamp)\n"); + xlog("L_INFO", "dtmf: $avp(dtmf_event)\n"); } ... diff --git a/src/modules/rtpengine/doc/rtpengine_admin.xml b/src/modules/rtpengine/doc/rtpengine_admin.xml index 4b8a7a832..e239adc09 100644 --- a/src/modules/rtpengine/doc/rtpengine_admin.xml +++ b/src/modules/rtpengine/doc/rtpengine_admin.xml @@ -464,7 +464,7 @@ modparam("rtpengine", "force_send_interface", "2001:8d8:1ff:10c0:9a90:96ff:fea8: ... modparam("rtpengine", "read_sdp_pv", "$var(sdp)") ... -route { +request_route { ... $var(sdp) = $rb + "a=foo:bar\r\n"; rtpengine_manage(); @@ -490,7 +490,7 @@ route { ... modparam("rtpengine", "write_sdp_pv", "$avp(sdp)") ... -route { +request_route { ... rtpengine_manage(); set_body("$avp(sdp)a=baz123\r\n", "application/sdp"); @@ -515,7 +515,7 @@ route { modparam("rtpengine", "write_sdp_pv", "$avp(sdp)") modparam("rtpengine", "write_sdp_pv_mode", 1) ... -route { +request_route { ... rtpengine_manage(); xinfo("new sdp: $avp(sdp)\n"); @@ -2935,6 +2935,11 @@ rtpengine_offer(); can be used to get call quality stats, see mos_A_label_pv and mos_B_label_pv parameters. + + debug - enables debug logging (rtpengine log level 7) for this + call only. rtpengine will log everything related to that call + after parsing the flags. Useful in debugging scenarios. + Check also the documentation of RTPEngine, these flags are documented there as well: @@ -2964,7 +2969,7 @@ rtpengine_offer(); <function>rtpengine_offer</function> usage -route { +request_route { ... if (is_method("INVITE")) { if (has_body("application/sdp")) { @@ -2996,8 +3001,8 @@ onreply_route[2] } ... if (has_body("application/sdp")) { - if (rtpengine_offer("codec-mask=all codec-transcode=PCMU codec-transcode=PCMA")) - t_on_reply("1"); + if (rtpengine_offer("codec-mask=all codec-transcode=PCMU codec-transcode=PCMA")) + t_on_reply("1"); } ... @@ -3006,7 +3011,7 @@ if (has_body("application/sdp")) { <function>rtpengine_offer</function> usage to force transcoding from opus to PCMU -route { +request_route { ... if (is_method("INVITE")) { if (has_body("application/sdp")) { @@ -3032,7 +3037,7 @@ onreply_route[1] <function>rtpengine_offer</function> usage of via-branch parameter -route { +request_route { ... if (is_method("INVITE")) { if (has_body("application/sdp")) { @@ -3416,13 +3421,13 @@ rtpengine_manage(); <function>rtpengine_subscribe_request</function> usage -route { +request_route { ... if (is_method("INVITE")) { if (has_body("application/sdp")) { if (rtpengine_offer()) t_on_reply("1"); - } + } } ... } @@ -3436,11 +3441,11 @@ onreply_route[1] "$avp(siprec_to_tag)", "siprec_streams"); xinfo("SIPREC participant $xavp(siprec_streams[0]=>tag) with label $xavp(siprec_streams[0]=>label[0])\n"); xinfo("SIPREC participant $xavp(siprec_streams[1]=>tag) with label $xavp(siprec_streams[0]=>label[0])\n"); - #use the above steam information to build the siprec xml metadata, will just send sdp in this example + # use the above stream information to build the siprec xml metadata, will just send SDP in this example $dlg_var(orig_to_tag) = $tt; $dlg_var(siprec_contact) = "sip:uac@" + $Ri; $dlg_var(siprec_to_tag) = $avp(siprec_to_tag); - t_uac_send("INVITE","sip:siprec@siprec_server.example.com", + t_uac_send("INVITE" ,"sip:siprec@siprec_server.example.com", "siprec_server.example.com", "", "To: <$tu>\r\n" + "From: <$fu>\r\n" + @@ -3462,7 +3467,7 @@ event_route [tm:local-request] { t_on_reply("2"); } if (is_method("ACK")) { - # save the routeset in the original dialog + # save the route set in the original dialog dlg_get($avp(orig_callid), $avp(orig_from_tag), $avp(orig_to_tag)); $dlg_var(siprec_cseq) = $cs; $dlg_var(siprec_to_hdr) = $hdr(To); @@ -3473,7 +3478,7 @@ event_route [tm:local-request] { } } -onreply_route[1] { +onreply_route[2] { if (has_body("application/sdp")) { rtpengine_subscribe_answer("from-tag=$avp(orig_from_tag) to-tag=$avp(siprec_to_tag) call-id="$avp(orig_callid)"); } @@ -3570,7 +3575,7 @@ onreply_route[1] { event_route [dialog:end] { - #call over, stop recording + # call over, stop recording rtpengine_unsubscribe("from-tag=$avp(orig_from_tag) to-tag=$avp(siprec_to_tag) call-id="$avp(orig_callid)"); $var(new_cseq) = $dlg_var(siprec_cseq) + 1; t_uac_send("BYE", "sip:siprec@siprec_server.example.com", @@ -3949,9 +3954,9 @@ play_dtmf("code=1 volume=5 duration=300 pause=150"); $rtpestat Usage ... - append_hf("X-RTP-Statistics: $rtpestat\r\n"); +append_hf("X-RTP-Statistics: $rtpestat\r\n"); ... - # $rtpestat = RTP: 54846 bytes, 1447 packets, 0 errors; RTCP: 336 bytes, 3 packets, 0 errors +# $rtpestat = RTP: 54846 bytes, 1447 packets, 0 errors; RTCP: 336 bytes, 3 packets, 0 errors ... @@ -4126,9 +4131,9 @@ $ &kamctl; rpc rtpengine.get_hash_total ... event_route[rtpengine:dtmf-event] { xlog("L_INFO", "callid: $avp(dtmf_event_callid)\n"); - xlog("L_INFO", "source_tag: $avp(dtmf_event_source_tag)\n"); - xlog("L_INFO", "timestamp: $avp(dtmf_event_timestamp)\n"); - xlog("L_INFO", "dtmf: $avp(dtmf_event)\n"); + xlog("L_INFO", "source_tag: $avp(dtmf_event_source_tag)\n"); + xlog("L_INFO", "timestamp: $avp(dtmf_event_timestamp)\n"); + xlog("L_INFO", "dtmf: $avp(dtmf_event)\n"); } ... diff --git a/src/modules/rtpengine/rtpengine.c b/src/modules/rtpengine/rtpengine.c index 62a6d6b73..b10784550 100644 --- a/src/modules/rtpengine/rtpengine.c +++ b/src/modules/rtpengine/rtpengine.c @@ -1689,203 +1689,224 @@ static int rtpengine_raise_dtmf_event(char *buffer, int len) for(it = jdoc.root->child; it; it = it->next) { LM_DBG("found field: %s\n", it->string); if(strcmp(it->string, "callid") == 0) { - pv_value_t pv_val; - pv_val.rs.s = it->valuestring; - pv_val.rs.len = strlen(it->valuestring); - pv_val.flags = PV_VAL_STR; + if(dtmf_event_callid_pvar) { + pv_value_t pv_val; + pv_val.rs.s = it->valuestring; + pv_val.rs.len = strlen(it->valuestring); + pv_val.flags = PV_VAL_STR; - if(dtmf_event_callid_pvar->setf( - 0, &dtmf_event_callid_pvar->pvp, (int)EQ_T, &pv_val) - < 0) { - LM_ERR("error setting pvar <%.*s>\n", - dtmf_event_callid_pvar_str.len, - dtmf_event_callid_pvar_str.s); - goto error; + if(dtmf_event_callid_pvar->setf( + 0, &dtmf_event_callid_pvar->pvp, (int)EQ_T, &pv_val) + < 0) { + LM_ERR("error setting pvar <%.*s>\n", + dtmf_event_callid_pvar_str.len, + dtmf_event_callid_pvar_str.s); + goto error; + } } } else if(strcmp(it->string, "source_tag") == 0) { - pv_value_t pv_val; - pv_val.rs.s = it->valuestring; - pv_val.rs.len = strlen(it->valuestring); - pv_val.flags = PV_VAL_STR; + if(dtmf_event_source_tag_pvar) { + pv_value_t pv_val; + pv_val.rs.s = it->valuestring; + pv_val.rs.len = strlen(it->valuestring); + pv_val.flags = PV_VAL_STR; - if(dtmf_event_source_tag_pvar->setf( - 0, &dtmf_event_source_tag_pvar->pvp, (int)EQ_T, &pv_val) - < 0) { - LM_ERR("error setting pvar <%.*s>\n", - dtmf_event_source_tag_pvar_str.len, - dtmf_event_source_tag_pvar_str.s); - goto error; + if(dtmf_event_source_tag_pvar->setf(0, + &dtmf_event_source_tag_pvar->pvp, (int)EQ_T, &pv_val) + < 0) { + LM_ERR("error setting pvar <%.*s>\n", + dtmf_event_source_tag_pvar_str.len, + dtmf_event_source_tag_pvar_str.s); + goto error; + } } } else if(strcmp(it->string, "timestamp") == 0) { - pv_value_t pv_val; - int_str val = {0}; - char intbuf[32]; - snprintf(intbuf, sizeof(intbuf), "%lld", SRJSON_GET_LLONG(it)); - memset(&val, 0, sizeof(val)); - - pv_val.rs.s = intbuf; - pv_val.rs.len = strlen(intbuf); - pv_val.flags = PV_VAL_STR; + if(dtmf_event_timestamp_pvar) { + pv_value_t pv_val; + int_str val = {0}; + char intbuf[32]; + snprintf(intbuf, sizeof(intbuf), "%lld", SRJSON_GET_LLONG(it)); + memset(&val, 0, sizeof(val)); + + pv_val.rs.s = intbuf; + pv_val.rs.len = strlen(intbuf); + pv_val.flags = PV_VAL_STR; - if(dtmf_event_timestamp_pvar->setf( - 0, &dtmf_event_timestamp_pvar->pvp, (int)EQ_T, &pv_val) - < 0) { - LM_ERR("error setting pvar <%.*s>\n", - dtmf_event_timestamp_pvar_str.len, - dtmf_event_timestamp_pvar_str.s); - goto error; + if(dtmf_event_timestamp_pvar->setf(0, + &dtmf_event_timestamp_pvar->pvp, (int)EQ_T, &pv_val) + < 0) { + LM_ERR("error setting pvar <%.*s>\n", + dtmf_event_timestamp_pvar_str.len, + dtmf_event_timestamp_pvar_str.s); + goto error; + } } } else if(strcmp(it->string, "event") == 0) { - pv_value_t pv_val; - int_str val = {0}; - char intbuf[32]; - snprintf(intbuf, sizeof(intbuf), "%lld", SRJSON_GET_LLONG(it)); - memset(&val, 0, sizeof(val)); - - pv_val.rs.s = intbuf; - pv_val.rs.len = strlen(intbuf); - pv_val.flags = PV_VAL_STR; - - if(dtmf_event_pvar->setf( - 0, &dtmf_event_pvar->pvp, (int)EQ_T, &pv_val) - < 0) { - LM_ERR("error setting pvar <%.*s>\n", dtmf_event_pvar_str.len, - dtmf_event_pvar_str.s); - goto error; - } - } else if(strcmp(it->string, "source_label") == 0) { - pv_value_t pv_val; - pv_val.rs.s = it->valuestring; - pv_val.rs.len = strlen(it->valuestring); - pv_val.flags = PV_VAL_STR; + if(dtmf_event_pvar) { + pv_value_t pv_val; + int_str val = {0}; + char intbuf[32]; + snprintf(intbuf, sizeof(intbuf), "%lld", SRJSON_GET_LLONG(it)); + memset(&val, 0, sizeof(val)); + + pv_val.rs.s = intbuf; + pv_val.rs.len = strlen(intbuf); + pv_val.flags = PV_VAL_STR; - if(dtmf_event_source_label_pvar->setf(0, - &dtmf_event_source_label_pvar->pvp, (int)EQ_T, &pv_val) - < 0) { - LM_ERR("error setting pvar <%.*s>\n", - dtmf_event_source_label_pvar_str.len, - dtmf_event_source_label_pvar_str.s); - goto error; - } - } else if(strcmp(it->string, "tags") == 0) { - pv_value_t pv_val; - srjson_t *tag; - char *tags_str = NULL; - int tags_len = 0; - int first = 1; - - /* Calculate total length needed for all tags */ - for(tag = it->child; tag; tag = tag->next) { - if(!first) { - tags_len += 1; /* For comma */ + if(dtmf_event_pvar->setf( + 0, &dtmf_event_pvar->pvp, (int)EQ_T, &pv_val) + < 0) { + LM_ERR("error setting pvar <%.*s>\n", + dtmf_event_pvar_str.len, dtmf_event_pvar_str.s); + goto error; } - tags_len += strlen(tag->valuestring); - first = 0; } + } else if(strcmp(it->string, "source_label") == 0) { + if(dtmf_event_source_label_pvar) { + pv_value_t pv_val; + pv_val.rs.s = it->valuestring; + pv_val.rs.len = strlen(it->valuestring); + pv_val.flags = PV_VAL_STR; - if(tags_len > 0) { - tags_str = pkg_malloc(tags_len + 1); - if(!tags_str) { - LM_ERR("no more pkg memory\n"); + if(dtmf_event_source_label_pvar->setf(0, + &dtmf_event_source_label_pvar->pvp, (int)EQ_T, + &pv_val) + < 0) { + LM_ERR("error setting pvar <%.*s>\n", + dtmf_event_source_label_pvar_str.len, + dtmf_event_source_label_pvar_str.s); goto error; } - tags_str[0] = '\0'; - first = 1; - - /* Concatenate all tags with commas */ + } + } else if(strcmp(it->string, "tags") == 0) { + if(dtmf_event_tags_pvar) { + pv_value_t pv_val; + srjson_t *tag; + char *tags_str = NULL; + int tags_len = 0; + int first = 1; + + /* Calculate total length needed for all tags */ for(tag = it->child; tag; tag = tag->next) { if(!first) { - strcat(tags_str, ","); + tags_len += 1; /* For comma */ } - strcat(tags_str, tag->valuestring); + tags_len += strlen(tag->valuestring); first = 0; } - pv_val.rs.s = tags_str; - pv_val.rs.len = tags_len; - pv_val.flags = PV_VAL_STR; + if(tags_len > 0) { + tags_str = pkg_malloc(tags_len + 1); + if(!tags_str) { + LM_ERR("no more pkg memory\n"); + goto error; + } + tags_str[0] = '\0'; + first = 1; + + /* Concatenate all tags with commas */ + for(tag = it->child; tag; tag = tag->next) { + if(!first) { + strcat(tags_str, ","); + } + strcat(tags_str, tag->valuestring); + first = 0; + } - if(dtmf_event_tags_pvar->setf( - 0, &dtmf_event_tags_pvar->pvp, (int)EQ_T, &pv_val) - < 0) { - LM_ERR("error setting pvar <%.*s>\n", - dtmf_event_tags_pvar_str.len, - dtmf_event_tags_pvar_str.s); + pv_val.rs.s = tags_str; + pv_val.rs.len = tags_len; + pv_val.flags = PV_VAL_STR; + + if(dtmf_event_tags_pvar->setf(0, &dtmf_event_tags_pvar->pvp, + (int)EQ_T, &pv_val) + < 0) { + LM_ERR("error setting pvar <%.*s>\n", + dtmf_event_tags_pvar_str.len, + dtmf_event_tags_pvar_str.s); + pkg_free(tags_str); + goto error; + } pkg_free(tags_str); - goto error; } - pkg_free(tags_str); } } else if(strcmp(it->string, "type") == 0) { - pv_value_t pv_val; - int_str val = {0}; - char intbuf[32]; - snprintf(intbuf, sizeof(intbuf), "%lld", SRJSON_GET_LLONG(it)); - memset(&val, 0, sizeof(val)); - - pv_val.rs.s = intbuf; - pv_val.rs.len = strlen(intbuf); - pv_val.flags = PV_VAL_STR; + if(dtmf_event_type_pvar) { + pv_value_t pv_val; + int_str val = {0}; + char intbuf[32]; + snprintf(intbuf, sizeof(intbuf), "%lld", SRJSON_GET_LLONG(it)); + memset(&val, 0, sizeof(val)); + + pv_val.rs.s = intbuf; + pv_val.rs.len = strlen(intbuf); + pv_val.flags = PV_VAL_STR; - if(dtmf_event_type_pvar->setf( - 0, &dtmf_event_type_pvar->pvp, (int)EQ_T, &pv_val) - < 0) { - LM_ERR("error setting pvar <%.*s>\n", - dtmf_event_type_pvar_str.len, - dtmf_event_type_pvar_str.s); - goto error; + if(dtmf_event_type_pvar->setf( + 0, &dtmf_event_type_pvar->pvp, (int)EQ_T, &pv_val) + < 0) { + LM_ERR("error setting pvar <%.*s>\n", + dtmf_event_type_pvar_str.len, + dtmf_event_type_pvar_str.s); + goto error; + } } } else if(strcmp(it->string, "source_ip") == 0) { - pv_value_t pv_val; - pv_val.rs.s = it->valuestring; - pv_val.rs.len = strlen(it->valuestring); - pv_val.flags = PV_VAL_STR; + if(dtmf_event_source_ip_pvar) { + pv_value_t pv_val; + pv_val.rs.s = it->valuestring; + pv_val.rs.len = strlen(it->valuestring); + pv_val.flags = PV_VAL_STR; - if(dtmf_event_source_ip_pvar->setf( - 0, &dtmf_event_source_ip_pvar->pvp, (int)EQ_T, &pv_val) - < 0) { - LM_ERR("error setting pvar <%.*s>\n", - dtmf_event_source_ip_pvar_str.len, - dtmf_event_source_ip_pvar_str.s); - goto error; + if(dtmf_event_source_ip_pvar->setf(0, + &dtmf_event_source_ip_pvar->pvp, (int)EQ_T, &pv_val) + < 0) { + LM_ERR("error setting pvar <%.*s>\n", + dtmf_event_source_ip_pvar_str.len, + dtmf_event_source_ip_pvar_str.s); + goto error; + } } } else if(strcmp(it->string, "duration") == 0) { - pv_value_t pv_val; - int_str val = {0}; - char intbuf[32]; - snprintf(intbuf, sizeof(intbuf), "%lld", SRJSON_GET_LLONG(it)); - memset(&val, 0, sizeof(val)); - - pv_val.rs.s = intbuf; - pv_val.rs.len = strlen(intbuf); - pv_val.flags = PV_VAL_STR; + if(dtmf_event_duration_pvar) { + pv_value_t pv_val; + int_str val = {0}; + char intbuf[32]; + snprintf(intbuf, sizeof(intbuf), "%lld", SRJSON_GET_LLONG(it)); + memset(&val, 0, sizeof(val)); + + pv_val.rs.s = intbuf; + pv_val.rs.len = strlen(intbuf); + pv_val.flags = PV_VAL_STR; - if(dtmf_event_duration_pvar->setf( - 0, &dtmf_event_duration_pvar->pvp, (int)EQ_T, &pv_val) - < 0) { - LM_ERR("error setting pvar <%.*s>\n", - dtmf_event_duration_pvar_str.len, - dtmf_event_duration_pvar_str.s); - goto error; + if(dtmf_event_duration_pvar->setf(0, + &dtmf_event_duration_pvar->pvp, (int)EQ_T, &pv_val) + < 0) { + LM_ERR("error setting pvar <%.*s>\n", + dtmf_event_duration_pvar_str.len, + dtmf_event_duration_pvar_str.s); + goto error; + } } } else if(strcmp(it->string, "volume") == 0) { - pv_value_t pv_val; - int_str val = {0}; - char intbuf[32]; - snprintf(intbuf, sizeof(intbuf), "%lld", SRJSON_GET_LLONG(it)); - memset(&val, 0, sizeof(val)); - - pv_val.rs.s = intbuf; - pv_val.rs.len = strlen(intbuf); - pv_val.flags = PV_VAL_STR; + if(dtmf_event_volume_pvar) { + pv_value_t pv_val; + int_str val = {0}; + char intbuf[32]; + snprintf(intbuf, sizeof(intbuf), "%lld", SRJSON_GET_LLONG(it)); + memset(&val, 0, sizeof(val)); + + pv_val.rs.s = intbuf; + pv_val.rs.len = strlen(intbuf); + pv_val.flags = PV_VAL_STR; - if(dtmf_event_volume_pvar->setf( - 0, &dtmf_event_volume_pvar->pvp, (int)EQ_T, &pv_val) - < 0) { - LM_ERR("error setting pvar <%.*s>\n", - dtmf_event_volume_pvar_str.len, - dtmf_event_volume_pvar_str.s); - goto error; + if(dtmf_event_volume_pvar->setf( + 0, &dtmf_event_volume_pvar->pvp, (int)EQ_T, &pv_val) + < 0) { + LM_ERR("error setting pvar <%.*s>\n", + dtmf_event_volume_pvar_str.len, + dtmf_event_volume_pvar_str.s); + goto error; + } } } } @@ -4091,7 +4112,7 @@ static void rtpengine_ping_check_timer(unsigned int ticks, void *param) for(rtpp_list = rtpp_set_list->rset_first; rtpp_list != NULL; rtpp_list = rtpp_list->rset_next) { lock_get(rtpp_list->rset_lock); - for(crt_rtpp = rtpp_list->rn_first, idx = 0; + for(crt_rtpp = rtpp_list->rn_first; crt_rtpp != NULL && idx < total_nodes; crt_rtpp = crt_rtpp->rn_next, idx++) { nodes[idx] = *crt_rtpp; diff --git a/src/modules/rtpproxy/rtpproxy_funcs.c b/src/modules/rtpproxy/rtpproxy_funcs.c index 671e44759..762af6df1 100644 --- a/src/modules/rtpproxy/rtpproxy_funcs.c +++ b/src/modules/rtpproxy/rtpproxy_funcs.c @@ -269,37 +269,6 @@ done: return 1; } -/* - * ser_memmem() returns the location of the first occurrence of data - * pattern b2 of size len2 in memory block b1 of size len1 or - * NULL if none is found. Obtained from NetBSD. - */ -void *ser_memmem(const void *b1, const void *b2, size_t len1, size_t len2) -{ - /* Initialize search pointer */ - char *sp = (char *)b1; - - /* Initialize pattern pointer */ - char *pp = (char *)b2; - - /* Initialize end of search address space pointer */ - char *eos = sp + len1 - len2; - - /* Sanity check */ - if(!(b1 && b2 && len1 && len2)) - return NULL; - - while(sp <= eos) { - if(*sp == *pp) - if(memcmp(sp, pp, len2) == 0) - return sp; - - sp++; - } - - return NULL; -} - /* * Some helper functions taken verbatim from tm module. */ diff --git a/src/modules/rtpproxy/rtpproxy_funcs.h b/src/modules/rtpproxy/rtpproxy_funcs.h index aae411694..f96bf8063 100644 --- a/src/modules/rtpproxy/rtpproxy_funcs.h +++ b/src/modules/rtpproxy/rtpproxy_funcs.h @@ -30,7 +30,6 @@ int extract_body(struct sip_msg *, str *); int check_content_type(struct sip_msg *); -void *ser_memmem(const void *, const void *, size_t, size_t); int get_callid(struct sip_msg *, str *); int get_to_tag(struct sip_msg *, str *); int get_from_tag(struct sip_msg *, str *); diff --git a/src/modules/sanity/sanity.c b/src/modules/sanity/sanity.c index 8059866c4..a1c86e2c2 100644 --- a/src/modules/sanity/sanity.c +++ b/src/modules/sanity/sanity.c @@ -736,7 +736,14 @@ int check_proxy_require(sip_msg_t *msg) memcpy(u + UNSUPPORTED_HEADER_LEN, r_pr->s.s, r_pr->s.len); memcpy(u + UNSUPPORTED_HEADER_LEN + r_pr->s.len, CRLF, CRLF_LEN); - add_lump_rpl(msg, u, u_len, LUMP_RPL_HDR); + if(add_lump_rpl(msg, u, u_len, LUMP_RPL_HDR) == 0) { + LM_ERR("failed to append Unsupported header to " + "reply\n"); + pkg_free(u); + u = NULL; + } else { + u = NULL; + } } if(sanity_reply(msg, 420, "Bad Proxy Require Extension") < 0) { diff --git a/src/modules/sdpops/sdpops_mod.c b/src/modules/sdpops/sdpops_mod.c index 7631779c7..720b48462 100644 --- a/src/modules/sdpops/sdpops_mod.c +++ b/src/modules/sdpops/sdpops_mod.c @@ -81,7 +81,7 @@ static int sdp_get_sess_version( sip_msg_t *msg, str *sess_version, long *sess_version_num); static int sdp_set_sess_version( sip_msg_t *msg, str *sess_version, long *sess_version_num); -static int w_sdp_get_address_family(sip_msg_t *msg); +static int w_sdp_get_address_family(sip_msg_t *msg, char *p1, char *p2); static int pv_get_sdp(sip_msg_t *msg, pv_param_t *param, pv_value_t *res); static int pv_set_sdp( @@ -1016,12 +1016,13 @@ it helps to extract IP address family at c line from sdp 6 for IP6 */ -static int w_sdp_get_address_family(sip_msg_t *msg) +static int ki_sdp_get_address_family(sip_msg_t *msg) { - sdp_session_cell_t *session; + sdp_stream_cell_t *stream; int sdp_session_num; int result = -1; + if(parse_sdp(msg) < 0) { LM_ERR("Unable to parse sdp body \n"); return -1; @@ -1030,23 +1031,49 @@ static int w_sdp_get_address_family(sip_msg_t *msg) sdp_session_num = 0; for(;;) { - session = get_sdp_session(msg, sdp_session_num); if(!session) break; - if(session->pf == AF_INET) { - result = 4; - } else if(session->pf == AF_INET6) { - result = 6; + if(session->ip_addr.s != NULL && session->ip_addr.len > 0) { + if(session->pf == AF_INET) { + result = 4; + } else if(session->pf == AF_INET6) { + result = 6; + } else { + result = -1; + } } else { - result = -1; + stream = session->streams; + while(stream) { + if(stream->ip_addr.s != NULL && stream->ip_addr.len > 0) { + if(stream->pf == AF_INET) { + result = 4; + } else if(stream->pf == AF_INET6) { + result = 6; + } else { + result = -1; + } + break; + } + stream = stream->next; + } + } + + if(result == 4 || result == 6) { + break; } sdp_session_num++; } return result; } + +static int w_sdp_get_address_family(sip_msg_t *msg, char *p1, char *p2) +{ + return ki_sdp_get_address_family(msg); +} + /** * @brief remove streams matching the m='media' * @return -1 - error; 0 - not found; >=1 - found @@ -3023,6 +3050,11 @@ static sr_kemi_t sr_kemi_sdpops_exports[] = { { SR_KEMIP_STR, SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE } }, + { str_init("sdpops"), str_init("sdp_get_address_family"), + SR_KEMIP_INT, ki_sdp_get_address_family, + { SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE, + SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE } + }, { {0, 0}, {0, 0}, 0, NULL, { 0, 0, 0, 0, 0, 0 } } }; diff --git a/src/modules/siprepo/README b/src/modules/siprepo/README index a0143a266..1c3bf2cd8 100644 --- a/src/modules/siprepo/README +++ b/src/modules/siprepo/README @@ -32,9 +32,9 @@ Daniel-Constantin Mierla 4. Functions - 4.1. sr_msg_push(msgid) - 4.2. sr_msg_pull(callid, msgid, rname) - 4.3. sr_msg_async_pull(callid, msgid, gname, rname) + 4.1. sr_msg_push(msgid, rmode) + 4.2. sr_msg_pull(callid, msgid, rname, rmode) + 4.3. sr_msg_async_pull(callid, msgid, gname, rname, rmode) 4.4. sr_msg_rm(callid, msgid) 4.5. sr_msg_check() @@ -69,9 +69,9 @@ Chapter 1. Admin Guide 4. Functions - 4.1. sr_msg_push(msgid) - 4.2. sr_msg_pull(callid, msgid, rname) - 4.3. sr_msg_async_pull(callid, msgid, gname, rname) + 4.1. sr_msg_push(msgid, rmode) + 4.2. sr_msg_pull(callid, msgid, rname, rmode) + 4.3. sr_msg_async_pull(callid, msgid, gname, rname, rmode) 4.4. sr_msg_rm(callid, msgid) 4.5. sr_msg_check() @@ -149,16 +149,17 @@ modparam("siprepo", "timer_procs", 2) 4. Functions - 4.1. sr_msg_push(msgid) - 4.2. sr_msg_pull(callid, msgid, rname) - 4.3. sr_msg_async_pull(callid, msgid, gname, rname) + 4.1. sr_msg_push(msgid, rmode) + 4.2. sr_msg_pull(callid, msgid, rname, rmode) + 4.3. sr_msg_async_pull(callid, msgid, gname, rname, rmode) 4.4. sr_msg_rm(callid, msgid) 4.5. sr_msg_check() -4.1. sr_msg_push(msgid) +4.1. sr_msg_push(msgid, rmode) Push the message content to hash table and associate it with `msgid`. - The Call-Id and msgid are needed to pull the message. + The Call-Id and msgid are needed to pull the message. The rmode is + reserved for repo mode, use 0. This function can be used from ANY_ROUTE. @@ -167,15 +168,18 @@ modparam("siprepo", "timer_procs", 2) request_route { ... $var(msgid) = $sruid; - if(sr_msg_push("$var(msgid)")) { + if(sr_msg_push("$var(msgid)", "0")) { + ... } ... } ... -4.2. sr_msg_pull(callid, msgid, rname) +4.2. sr_msg_pull(callid, msgid, rname, rmode) - Pull the message content and execute the route block 'rname'. + Pull the message content and execute the route block 'rname'. If rmode + is set to "1", the item of the message is removed from siprepo storage, + use "0" to keep it. This function can be used from ANY_ROUTE. @@ -183,16 +187,17 @@ request_route { ... request_route { ... - if(sr_msg_pull("$var(callid)", "$var(msgid)", "REPOPULL")) { + if(sr_msg_pull("$var(callid)", "$var(msgid)", "REPOPULL", "1")) { } ... } ... -4.3. sr_msg_async_pull(callid, msgid, gname, rname) +4.3. sr_msg_async_pull(callid, msgid, gname, rname, rmode) Pull the message content and execute the route block 'rname' via async - group 'gname'. + group 'gname'. If rmode is set to "1", the item of the message is + removed from siprepo storage, use "0" to keep it. This function can be used from ANY_ROUTE. @@ -200,7 +205,8 @@ request_route { ... request_route { ... - if(sr_msg_async_pull("$var(callid)", "$var(msgid)", "WG01", "REPOPULL")) { + if(sr_msg_async_pull("$var(callid)", "$var(msgid)", "WG01", "REPOPULL", "1") +) { } ... } @@ -208,7 +214,7 @@ request_route { 4.4. sr_msg_rm(callid, msgid) - Remove the message content. + Remove the item of the message from the siprepo storage. This function can be used from ANY_ROUTE. diff --git a/src/modules/siprepo/doc/siprepo_admin.xml b/src/modules/siprepo/doc/siprepo_admin.xml index 80ed13920..0460df48d 100644 --- a/src/modules/siprepo/doc/siprepo_admin.xml +++ b/src/modules/siprepo/doc/siprepo_admin.xml @@ -137,11 +137,12 @@ modparam("siprepo", "timer_procs", 2) Functions
- <function moreinfo="none">sr_msg_push(msgid)</function> + <function moreinfo="none">sr_msg_push(msgid, rmode)</function> Push the message content to hash table and associate it with `msgid`. The Call-Id and msgid are needed to pull the message. + The rmode is reserved for repo mode, use 0. This function can be used from ANY_ROUTE. @@ -153,7 +154,8 @@ modparam("siprepo", "timer_procs", 2) request_route { ... $var(msgid) = $sruid; - if(sr_msg_push("$var(msgid)")) { + if(sr_msg_push("$var(msgid)", "0")) { + ... } ... } @@ -163,10 +165,12 @@ request_route {
- <function moreinfo="none">sr_msg_pull(callid, msgid, rname)</function> + <function moreinfo="none">sr_msg_pull(callid, msgid, rname, rmode)</function> Pull the message content and execute the route block 'rname'. + If rmode is set to "1", the item of the message is removed from siprepo + storage, use "0" to keep it. This function can be used from ANY_ROUTE. @@ -177,7 +181,7 @@ request_route { ... request_route { ... - if(sr_msg_pull("$var(callid)", "$var(msgid)", "REPOPULL")) { + if(sr_msg_pull("$var(callid)", "$var(msgid)", "REPOPULL", "1")) { } ... } @@ -187,11 +191,12 @@ request_route {
- <function moreinfo="none">sr_msg_async_pull(callid, msgid, gname, rname)</function> + <function moreinfo="none">sr_msg_async_pull(callid, msgid, gname, rname, rmode)</function> Pull the message content and execute the route block 'rname' via - async group 'gname'. + async group 'gname'. If rmode is set to "1", the item of the message + is removed from siprepo storage, use "0" to keep it. This function can be used from ANY_ROUTE. @@ -202,7 +207,7 @@ request_route { ... request_route { ... - if(sr_msg_async_pull("$var(callid)", "$var(msgid)", "WG01", "REPOPULL")) { + if(sr_msg_async_pull("$var(callid)", "$var(msgid)", "WG01", "REPOPULL", "1")) { } ... } @@ -215,7 +220,7 @@ request_route { sr_msg_rm(callid, msgid) - Remove the message content. + Remove the item of the message from the siprepo storage. This function can be used from ANY_ROUTE. diff --git a/src/modules/siprepo/siprepo_data.c b/src/modules/siprepo/siprepo_data.c index 2720c50c2..5f0a73b04 100644 --- a/src/modules/siprepo/siprepo_data.c +++ b/src/modules/siprepo/siprepo_data.c @@ -166,11 +166,6 @@ int siprepo_msg_set(sip_msg_t *msg, str *msgid, int rmode) LM_ERR("failed to parse cseq headers\n"); return -1; } - if(get_cseq(msg)->method_id==METHOD_ACK - || get_cseq(msg)->method_id==METHOD_CANCEL) { - LM_DBG("no pre-transaction management for ACK or CANCEL\n"); - return -1; - } if (msg->via1==0) { LM_ERR("failed to get Via header\n"); return -1; @@ -241,6 +236,7 @@ int siprepo_msg_set(sip_msg_t *msg, str *msgid, int rmode) it->msgno = msg->id; it->pid = msg->pid; it->mflags = msg->flags; + it->rcv = msg->rcv; if(_siprepo_table[slotid].plist!=NULL) { _siprepo_table[slotid].plist->prev = it; @@ -313,11 +309,6 @@ int siprepo_msg_check(sip_msg_t *msg) LM_ERR("failed to parse cseq headers\n"); return -1; } - if(get_cseq(msg)->method_id==METHOD_ACK - || get_cseq(msg)->method_id==METHOD_CANCEL) { - LM_DBG("no pre-transaction management for ACK or CANCEL\n"); - return -1; - } if (msg->via1==0) { LM_ERR("failed to get Via header\n"); return -1; diff --git a/src/modules/siprepo/siprepo_mod.c b/src/modules/siprepo/siprepo_mod.c index 0ce005774..810eb9002 100644 --- a/src/modules/siprepo/siprepo_mod.c +++ b/src/modules/siprepo/siprepo_mod.c @@ -62,16 +62,9 @@ static int fixup_sr_msg_async_pull(void **param, int param_no); static int fixup_free_sr_msg_async_pull(void **param, int param_no); /* clang-format off */ -typedef struct sworker_task_param { - char *buf; - int len; - receive_info_t rcv; - str xdata; -} sworker_task_param_t; - static cmd_export_t cmds[]={ {"sr_msg_push", (cmd_function)w_sr_msg_push, 2, fixup_spve_igp, - fixup_free_spve_null, REQUEST_ROUTE|CORE_ONREPLY_ROUTE}, + fixup_free_spve_igp, REQUEST_ROUTE|CORE_ONREPLY_ROUTE}, {"sr_msg_pull", (cmd_function)w_sr_msg_pull, 4, fixup_sssi, fixup_free_sssi, REQUEST_ROUTE|CORE_ONREPLY_ROUTE}, {"sr_msg_async_pull", (cmd_function)w_sr_msg_async_pull, 5, fixup_sr_msg_async_pull, diff --git a/src/modules/sipt/ss7_parser.c b/src/modules/sipt/ss7_parser.c index 53d357d61..0b2c5c99a 100644 --- a/src/modules/sipt/ss7_parser.c +++ b/src/modules/sipt/ss7_parser.c @@ -69,8 +69,8 @@ static char char2digit(char localchar) } } -static void isup_put_number( - unsigned char *dest, char *src, int *len, int *oddeven) +static int isup_put_number( + unsigned char *dest, int dest_len, char *src, int *len, int *oddeven) { int i = 0; int numlen = strlen(src); @@ -83,6 +83,12 @@ static void isup_put_number( *len = numlen / 2; } + if(*len > dest_len) { + LM_ERR("phone number too long (%d chars, max %d bytes)\n", numlen, + dest_len); + return -1; + } + while(i < numlen) { if(!(i % 2)) @@ -92,16 +98,22 @@ static void isup_put_number( } i++; } + + return 1; } static int encode_called_party(char *number, unsigned char *flags, int nai, unsigned char *buf, int len) { int numlen, oddeven; + int res; buf[0] = flags[0] & 0x7F; buf[1] = flags[1]; - isup_put_number(&buf[2], number, &numlen, &oddeven); + res = isup_put_number(&buf[2], len - 2, number, &numlen, &oddeven); + if(res < 0) { + return -1; + } if(oddeven) { buf[0] |= 0x80; @@ -119,12 +131,16 @@ static int encode_calling_party(char *number, int nai, int presentation, int screening, unsigned char *buf, int len) { int oddeven, datalen; + int res; if(!number[0] && presentation != SS7_PRESENTATION_ADDR_NOT_AVAILABLE) return 0; if(number[0] && presentation != SS7_PRESENTATION_ADDR_NOT_AVAILABLE) { - isup_put_number(&buf[2], number, &datalen, &oddeven); + res = isup_put_number(&buf[2], len - 2, number, &datalen, &oddeven); + if(res < 0) { + return -1; + } } else { datalen = 0; oddeven = 0; @@ -144,8 +160,12 @@ static int encode_forwarding_number( char *number, int nai, unsigned char *buf, int len) { int oddeven, datalen; + int res; - isup_put_number(&buf[2], number, &datalen, &oddeven); + res = isup_put_number(&buf[2], len - 2, number, &datalen, &oddeven); + if(res < 0) { + return -1; + } buf[0] = (oddeven << 7) | nai; /* Nature of Address Indicator */ /* Assume E.164 ISDN numbering plan, calling number complete */ @@ -643,6 +663,9 @@ int isup_update_destination(struct sdp_mangler *mangle, char *dest, int hops, // modify the mandatory fixed header res2 = encode_called_party( dest, buf + offset + 1, nai, tmp_buf + 2, 255 - 1); + if(res2 < 0) { + return -1; + } tmp_buf[1] = (char)res2; res = buf[offset] + 1; @@ -748,6 +771,8 @@ int isup_update_calling(struct sdp_mangler *mangle, char *origin, int nai, case ISUP_PARM_CALLING_PARTY_NUM: res2 = encode_calling_party(origin, nai, presentation, screening, &new_party[1], 255 - 1); + if(res2 < 0) + return -1; new_party[0] = (char)res2; replace_body_segment(mangle, offset + 1, (int)buf[offset + 1] + 1, new_party, res2 + 1); @@ -769,6 +794,8 @@ int isup_update_calling(struct sdp_mangler *mangle, char *origin, int nai, new_party[0] = ISUP_PARM_CALLING_PARTY_NUM; res = encode_calling_party(origin, nai, presentation, screening, new_party + 2, 255 - 2); + if(res < 0) + return -1; new_party[1] = (char)res; add_body_segment(mangle, offset, new_party, res + 2); @@ -823,6 +850,8 @@ int isup_update_forwarding(struct sdp_mangler *mangle, char *forwardn, int nai, case ISUP_PARM_REDIRECTING_NUMBER: res2 = encode_forwarding_number( forwardn, nai, &new_party[1], 255 - 1); + if(res2 < 0) + return -1; new_party[0] = (char)res2; replace_body_segment(mangle, offset + 1, (int)buf[offset + 1] + 1, new_party, res2 + 1); @@ -830,6 +859,8 @@ int isup_update_forwarding(struct sdp_mangler *mangle, char *forwardn, int nai, case ISUP_PARM_ORIGINAL_CALLED_NUM: res2 = encode_forwarding_number( forwardn, nai, &new_party[1], 255 - 1); + if(res2 < 0) + return -1; new_party[0] = (char)res2; replace_body_segment(mangle, offset + 1, (int)buf[offset + 1] + 1, new_party, res2 + 1); diff --git a/src/modules/siptrace/siptrace_hep.c b/src/modules/siptrace/siptrace_hep.c index ffc79d0fe..682d5263d 100644 --- a/src/modules/siptrace/siptrace_hep.c +++ b/src/modules/siptrace/siptrace_hep.c @@ -173,7 +173,7 @@ int trace_send_hep3_duplicate(str *body, str *from, str *to, HEP3_PACK_CHUNK_DATA(0, 0x000f, body->s, body->len); HEP3_PACK_FINALIZE(buffer, &len); - if(!dst2) { + if(!dst2 && trace_dup_uri) { init_dest_info(&dst); dst.proto = trace_dup_uri->proto; p = mk_proxy(&trace_dup_uri->host, trace_dup_uri->port_no, dst.proto); @@ -186,8 +186,11 @@ int trace_send_hep3_duplicate(str *body, str *from, str *to, &dst.to, &p->host, p->addr_idx, (p->port) ? p->port : SIP_PORT); LM_DBG("setting up the socket_info\n"); dst_fin = &dst; - } else { + } else if(dst2) { dst_fin = dst2; + } else { + LM_ERR("Don't have anywhere to send the trace to\n"); + goto error; } si = NULL; diff --git a/src/modules/siputils/chargingvector.c b/src/modules/siputils/chargingvector.c index fa99b732d..8afa987f7 100644 --- a/src/modules/siputils/chargingvector.c +++ b/src/modules/siputils/chargingvector.c @@ -29,6 +29,7 @@ #include "../../core/mem/mem.h" #include "../../core/str.h" #include "../../core/strutils.h" +#include "../../core/ut.h" #include "chargingvector.h" #define SIZE_CONF_ID 16 @@ -193,10 +194,15 @@ static int sip_parse_charging_vector(const char *pcv_value, unsigned int len) char *s = NULL; const char *pcv_value_end = pcv_value + len; + static const char icid_value_key[] = "icid-value="; + static const char icid_generated_at_key[] = "icid-generated-at="; + static const char orig_ioi_key[] = "orig-ioi="; + static const char term_ioi_key[] = "term-ioi="; - s = strstr(pcv_value, "icid-value="); + s = (char *)ser_memmem( + pcv_value, icid_value_key, len, sizeof(icid_value_key) - 1); if(s != NULL) { - _siputils_pcv_id.s = s + strlen("icid-value="); + _siputils_pcv_id.s = s + sizeof(icid_value_key) - 1; _siputils_pcv_id.len = sip_param_end(_siputils_pcv_id.s, pcv_value_end); LM_DBG("parsed P-Charging-Vector icid-value=%.*s\n", STR_FMT(&_siputils_pcv_id)); @@ -205,9 +211,10 @@ static int sip_parse_charging_vector(const char *pcv_value, unsigned int len) _siputils_pcv_id = (str)STR_NULL; } - s = strstr(pcv_value, "icid-generated-at="); + s = (char *)ser_memmem(pcv_value, icid_generated_at_key, len, + sizeof(icid_generated_at_key) - 1); if(s != NULL) { - _siputils_pcv_genaddr.s = s + strlen("icid-generated-at="); + _siputils_pcv_genaddr.s = s + sizeof(icid_generated_at_key) - 1; _siputils_pcv_genaddr.len = sip_param_end(_siputils_pcv_genaddr.s, pcv_value_end); LM_DBG("parsed P-Charging-Vector icid-generated-at=%.*s\n", @@ -217,9 +224,10 @@ static int sip_parse_charging_vector(const char *pcv_value, unsigned int len) _siputils_pcv_genaddr = (str)STR_NULL; } - s = strstr(pcv_value, "orig-ioi="); + s = (char *)ser_memmem( + pcv_value, orig_ioi_key, len, sizeof(orig_ioi_key) - 1); if(s != NULL) { - _siputils_pcv_orig.s = s + strlen("orig-ioi="); + _siputils_pcv_orig.s = s + sizeof(orig_ioi_key) - 1; _siputils_pcv_orig.len = sip_param_end(_siputils_pcv_orig.s, pcv_value_end); LM_INFO("parsed P-Charging-Vector orig-ioi=%.*s\n", @@ -228,9 +236,10 @@ static int sip_parse_charging_vector(const char *pcv_value, unsigned int len) _siputils_pcv_orig = (str)STR_NULL; } - s = strstr(pcv_value, "term-ioi="); + s = (char *)ser_memmem( + pcv_value, term_ioi_key, len, sizeof(term_ioi_key) - 1); if(s != NULL) { - _siputils_pcv_term.s = s + strlen("term-ioi="); + _siputils_pcv_term.s = s + sizeof(term_ioi_key) - 1; _siputils_pcv_term.len = sip_param_end(_siputils_pcv_term.s, pcv_value_end); LM_INFO("parsed P-Charging-Vector term-ioi=%.*s\n", diff --git a/src/modules/siputils/checks.c b/src/modules/siputils/checks.c index 2883bceee..21ad59d04 100644 --- a/src/modules/siputils/checks.c +++ b/src/modules/siputils/checks.c @@ -645,6 +645,7 @@ int tel2sip(struct sip_msg *_msg, char *_uri, char *_hostpart, char *_res) int i, j, in_tel_parameters = 0; pv_spec_t *res; pv_value_t res_val; + struct sip_uri parsed_check; /* get parameters */ if(get_str_fparam(&uri, _msg, (fparam_t *)_uri) < 0) { @@ -709,6 +710,11 @@ int tel2sip(struct sip_msg *_msg, char *_uri, char *_hostpart, char *_res) /* tel_uri is not needed anymore */ pkg_free(tel_uri.s); + if(parse_uri(sip_uri.s, sip_uri.len, &parsed_check) < 0) { + pkg_free(sip_uri.s); + return -1; + } + /* set result pv value and write sip uri to result pv */ res_val.rs = sip_uri; res_val.flags = PV_VAL_STR; @@ -823,6 +829,7 @@ int tel2sip2(struct sip_msg *_msg, char *_uri, char *_hostpart, char *_res) pv_value_t res_val; char *tmp_ptr = NULL; tel_param_t params[MAX_TEL_PARAMS]; + struct sip_uri parsed_check; /* get parameters */ if(get_str_fparam(&uri, _msg, (fparam_t *)_uri) < 0) { @@ -935,6 +942,11 @@ int tel2sip2(struct sip_msg *_msg, char *_uri, char *_hostpart, char *_res) /* tel_uri is not needed anymore */ pkg_free(tel_uri.s); + if(parse_uri(sip_uri.s, sip_uri.len, &parsed_check) < 0) { + pkg_free(sip_uri.s); + return -1; + } + sip_uri.len = strlen(sip_uri.s); /* set result pv value and write sip uri to result pv */ @@ -1091,21 +1103,21 @@ int set_uri_user(struct sip_msg *_m, char *_uri, char *_value) return -1; } value = value_val.rs; - - colon = strchr(uri.s, ':'); + if(uri.len + value.len >= MAX_URI_SIZE - 2) { + LM_ERR("resulting uri would be too large\n"); + return -1; + } + colon = memchr(uri.s, ':', uri.len); if(colon == NULL) { LM_ERR("uri does not contain ':' character\n"); return -1; } - at = strchr(uri.s, '@'); + at = memchr(uri.s, '@', uri.len); c = &(new_uri[0]); if(at == NULL) { if(value.len == 0) return 1; - if(uri.len + value.len > MAX_URI_SIZE) { - LM_ERR("resulting uri would be too large\n"); - return -1; - } + append_str(c, uri.s, colon - uri.s + 1); append_str(c, value.s, value.len); append_chr(c, '@'); @@ -1117,10 +1129,6 @@ int set_uri_user(struct sip_msg *_m, char *_uri, char *_value) append_str(c, at + 1, uri.len - (at - uri.s + 1)); res_val.rs.len = uri.len - (at - colon); } else { - if(uri.len + value.len - (at - colon - 1) > MAX_URI_SIZE) { - LM_ERR("resulting uri would be too large\n"); - return -1; - } append_str(c, uri.s, colon - uri.s + 1); append_str(c, value.s, value.len); append_str(c, at, uri.len - (at - uri.s)); @@ -1129,6 +1137,7 @@ int set_uri_user(struct sip_msg *_m, char *_uri, char *_value) } res_val.rs.s = &(new_uri[0]); + res_val.rs.s[res_val.rs.len] = '\0'; LM_DBG("resulting uri: %.*s\n", res_val.rs.len, res_val.rs.s); res_val.flags = PV_VAL_STR; uri_pv->setf(_m, &uri_pv->pvp, (int)EQ_T, &res_val); @@ -1186,29 +1195,41 @@ int set_uri_host(struct sip_msg *_m, char *_uri, char *_value) LM_ERR("hostpart of uri cannot be empty\n"); return -1; } - if(uri.len + value.len > MAX_URI_SIZE) { + if(uri.len + value.len >= MAX_URI_SIZE - 2) { LM_ERR("resulting uri would be too large\n"); return -1; } - colon = strchr(uri.s, ':'); + colon = memchr(uri.s, ':', uri.len); if(colon == NULL) { LM_ERR("uri does not contain ':' character\n"); return -1; } c = &(new_uri[0]); - at = strchr(colon + 1, '@'); + at = memchr(colon + 1, '@', (uri.s + uri.len) - (colon + 1)); if(at == NULL) { next = colon + 1; } else { next = at + 1; } append_str(c, uri.s, next - uri.s); - host_len = strcspn(next, ":;?"); + host_len = 0; + while(next + host_len < uri.s + uri.len) { + if(next[host_len] == ':' || next[host_len] == ';' + || next[host_len] == '?') { + break; + } + host_len++; + } + if(host_len == 0) { + LM_ERR("uri does not contain host\n"); + return -1; + } append_str(c, value.s, value.len); - strcpy(c, next + host_len); + memcpy(c, next + host_len, (uri.s + uri.len) - (next + host_len)); res_val.rs.len = uri.len + value.len - host_len; res_val.rs.s = &(new_uri[0]); + res_val.rs.s[res_val.rs.len] = '\0'; LM_DBG("resulting uri: %.*s\n", res_val.rs.len, res_val.rs.s); res_val.flags = PV_VAL_STR; diff --git a/src/modules/siputils/contact_ops.c b/src/modules/siputils/contact_ops.c index 0ac7da9e3..d3e844ac3 100644 --- a/src/modules/siputils/contact_ops.c +++ b/src/modules/siputils/contact_ops.c @@ -112,7 +112,7 @@ int ki_encode_contact(sip_msg_t *msg, str *eprefix, str *eaddr) return -3; } } /* while */ - } /* if c != NULL */ + } /* if c != NULL */ return 1; } @@ -254,7 +254,7 @@ int ki_decode_contact_header(sip_msg_t *msg) return -3; } } // end while - } // if c!= NULL + } // if c!= NULL return 1; } @@ -439,7 +439,7 @@ int decode2format(str uri, char separator, struct uri_format *format) if(start == NULL) { LM_ERR("invalid SIP uri - missing :\n"); return -2; - } /* invalid uri */ + } /* invalid uri */ start = start + 1; /* jumping over sip: */ format->first = start - uri.s; @@ -707,7 +707,7 @@ int ki_contact_param_encode_helper( break; } } - nuri.len = snprintf(nuri.s, MAX_URI_SIZE - 1, "%s%.*s;%.*s=%.*s%s", + nuri.len = snprintf(nuri.s, MAX_URI_SIZE, "%s%.*s;%.*s=%.*s%s", (q) ? "<" : "", saddr->len, saddr->s, nparam->len, nparam->s, pval.len, pval.s, (q) ? ">" : ""); if(nuri.len <= 0 || nuri.len >= MAX_URI_SIZE) { diff --git a/src/modules/siputils/utils.c b/src/modules/siputils/utils.c index ff9144e10..2b4288b5f 100644 --- a/src/modules/siputils/utils.c +++ b/src/modules/siputils/utils.c @@ -92,18 +92,22 @@ int patch_content_length(struct sip_msg *msg, unsigned int newValue) } /* perhaps dangerous because buffer is static ? */ //pos = int2str(newValue,&len); - len = snprintf((char *)pos, 10, "%u", newValue); + len = snprintf((char *)pos, sizeof(pos), "%u", newValue); + if(len <= 0 || len >= (int)sizeof(pos)) { + LM_ERR("failed to format Content-Length value %u\n", newValue); + return -3; + } s = pkg_malloc(len); if(s == NULL) { PKG_MEM_ERROR_FMT("missing %d bytes\n", len); - return -3; + return -4; } memcpy(s, pos, len); /* perhaps we made it and no one called int2str,might use sprintf */ if(patch(msg, contentLength->body.s, contentLength->body.len, s, len) < 0) { pkg_free(s); LM_ERR("lumping failed\n"); - return -4; + return -5; } LM_DBG("succeeded in altering Content-Length to new value %u\n", newValue); diff --git a/src/modules/sl/sl.c b/src/modules/sl/sl.c index 6ff9949cf..2fde896de 100644 --- a/src/modules/sl/sl.c +++ b/src/modules/sl/sl.c @@ -64,7 +64,6 @@ MODULE_VERSION static int default_code = 500; static str default_reason = STR_STATIC_INIT("Internal Server Error"); - static int sl_bind_tm = 1; static struct tm_binds tmb; @@ -233,7 +232,10 @@ static int w_sl_send_reply(struct sip_msg *msg, char *p1, char *p2) reason = default_reason; } - if(reason.s[reason.len - 1] == '\0') { + if(reason.s == NULL || reason.len <= 0) { + LM_ERR("reply reason is null or empty\n"); + return -1; + } else if(reason.s[reason.len - 1] == '\0') { r = reason.s; } else { r = as_asciiz(&reason); @@ -278,7 +280,10 @@ int send_reply(struct sip_msg *msg, int code, str *reason) return -2; } - if(reason->s[reason->len - 1] == '\0') { + if(reason == NULL || reason->s == NULL || reason->len <= 0) { + LM_ERR("reply reason is null or empty\n"); + return -1; + } else if(reason->s[reason->len - 1] == '\0') { r = reason->s; } else { r = as_asciiz(reason); @@ -307,12 +312,12 @@ int send_reply(struct sip_msg *msg, int code, str *reason) ret = sl_send_reply(msg, code, r); done: - if(r != reason->s) + if(reason != NULL && r != reason->s) pkg_free(r); return ret; error: - if(r != reason->s) + if(reason != NULL && r != reason->s) pkg_free(r); return -1; } diff --git a/src/modules/sl/sl_funcs.c b/src/modules/sl/sl_funcs.c index 0219af4f8..926b08443 100644 --- a/src/modules/sl/sl_funcs.c +++ b/src/modules/sl/sl_funcs.c @@ -140,6 +140,11 @@ int sl_reply_helper(struct sip_msg *msg, int code, char *reason, str *tag) str evname = str_init("sl:local-response"); struct sip_msg pmsg; + if(reason == NULL || reason[0] == '\0') { + LM_ERR("reply reason is null or empty\n"); + goto error; + } + if(msg->first_line.u.request.method_value == METHOD_ACK) goto error; @@ -363,7 +368,10 @@ int sl_send_reply_str(struct sip_msg *msg, int code, str *reason) char *r; int ret; - if(reason->s[reason->len - 1] == '\0') { + if(reason == NULL || reason->s == NULL || reason->len <= 0) { + LM_ERR("reply reason is null or empty\n"); + return -1; + } else if(reason->s[reason->len - 1] == '\0') { r = reason->s; } else { r = as_asciiz(reason); @@ -375,7 +383,7 @@ int sl_send_reply_str(struct sip_msg *msg, int code, str *reason) ret = sl_reply_helper(msg, code, r, 0); - if(r != reason->s) + if(reason != NULL && r != reason->s) pkg_free(r); return ret; } @@ -386,7 +394,10 @@ int sl_send_reply_dlg(struct sip_msg *msg, int code, str *reason, str *tag) char *r; int ret; - if(reason->s[reason->len - 1] == '\0') { + if(reason == NULL || reason->s == NULL || reason->len <= 0) { + LM_ERR("reply reason is null or empty\n"); + return -1; + } else if(reason->s[reason->len - 1] == '\0') { r = reason->s; } else { r = as_asciiz(reason); @@ -398,7 +409,7 @@ int sl_send_reply_dlg(struct sip_msg *msg, int code, str *reason, str *tag) ret = sl_reply_helper(msg, code, r, tag); - if(r != reason->s) + if(reason != NULL && r != reason->s) pkg_free(r); return ret; } diff --git a/src/modules/sl/sl_stats.c b/src/modules/sl/sl_stats.c index 8e8c835c2..d8f931009 100644 --- a/src/modules/sl/sl_stats.c +++ b/src/modules/sl/sl_stats.c @@ -119,6 +119,7 @@ int init_sl_stats_child(void) if(*sl_stats == 0) { SHM_MEM_ERROR; shm_free(sl_stats); + sl_stats = NULL; return -1; } memset(*sl_stats, 0, len); diff --git a/src/modules/tcpops/tcpops_mod.c b/src/modules/tcpops/tcpops_mod.c index cf7abf5f5..ed074906d 100644 --- a/src/modules/tcpops/tcpops_mod.c +++ b/src/modules/tcpops/tcpops_mod.c @@ -600,7 +600,7 @@ static int ki_tcp_get_conid_helper(sip_msg_t *msg, str *saddr, pv_spec_t *pvs) port = su_getport(&dst.to); c = tcpconn_get(dst.id, &ip, port, NULL, clifetime); - if(unlikely(c <= 0)) { + if(unlikely(c == NULL)) { goto setvalue; } conid = c->id; diff --git a/src/modules/textops/api.c b/src/modules/textops/api.c index a9d2309ff..321dda245 100644 --- a/src/modules/textops/api.c +++ b/src/modules/textops/api.c @@ -64,11 +64,26 @@ int search_append_api(struct sip_msg *msg, str *regex, str *data_str) void **param; data = pkg_malloc(data_str->len + 1); + if(data == NULL) { + LM_ERR("no pkg memory for data buffer\n"); + return -1; + } memcpy(data, data_str->s, data_str->len); memset(data + data_str->len, 0, 1); param = pkg_malloc(sizeof(void *)); + if(param == NULL) { + LM_ERR("no pkg memory for regex parameter\n"); + pkg_free(data); + return -1; + } *param = pkg_malloc(regex->len + 1); + if(*param == NULL) { + LM_ERR("no pkg memory for regex buffer\n"); + pkg_free(param); + pkg_free(data); + return -1; + } memcpy(*param, regex->s, regex->len); memset(*param + regex->len, 0, 1); @@ -92,8 +107,17 @@ int search_api(struct sip_msg *msg, str *regex) int retval; void **param = pkg_malloc(sizeof(void *)); + if(param == NULL) { + LM_ERR("no pkg memory for regex parameter\n"); + return -1; + } *param = pkg_malloc(regex->len + 1); + if(*param == NULL) { + LM_ERR("no pkg memory for regex buffer\n"); + pkg_free(param); + return -1; + } memcpy(*param, regex->s, regex->len); memset(*param + regex->len, 0, 1); @@ -111,7 +135,16 @@ int is_privacy_api(struct sip_msg *msg, str *privacy_type) { int retval; void **param = pkg_malloc(sizeof(void *)); + if(param == NULL) { + LM_ERR("no pkg memory for privacy parameter\n"); + return -1; + } *param = pkg_malloc(privacy_type->len + 1); + if(*param == NULL) { + LM_ERR("no pkg memory for privacy buffer\n"); + pkg_free(param); + return -1; + } memcpy(*param, privacy_type->s, privacy_type->len); memset(*param + privacy_type->len, 0, 1); diff --git a/src/modules/textops/textops.c b/src/modules/textops/textops.c index 8d685f804..b5c715101 100644 --- a/src/modules/textops/textops.c +++ b/src/modules/textops/textops.c @@ -2807,7 +2807,7 @@ static str *generate_boundary(str *txt, str *content_type, n->len = delimiter->len + 2 + CRLF_LEN; if(initial) n->len = 2 * n->len; - if(strncmp("\r\n\r\n", txt->s + txt->len - 4, 4) != 0) { + if(txt->len < 4 || strncmp("\r\n\r\n", txt->s + txt->len - 4, 4) != 0) { n->len = n->len + CRLF_LEN; flag = 1; LM_DBG("adding final CRLF+CRLF\n"); @@ -3179,6 +3179,7 @@ int ki_append_multibody_cd(sip_msg_t *msg, str *txt, str *ct, str *cd) { struct lump *l; int off; + int mime; str body = {0, 0}; str *nbb = NULL; str delimiter = {0, 0}; @@ -3204,9 +3205,23 @@ int ki_append_multibody_cd(sip_msg_t *msg, str *txt, str *ct, str *cd) return -1; } + mime = parse_content_type_hdr(msg); + if(mime < 0) { + LM_ERR("failed to parse Content-Type header\n"); + return -1; + } + if(msg->content_type == NULL) { + LM_ERR("missing Content-Type header for existing message body\n"); + return -1; + } + off = body.s - msg->buf; if((l = anchor_lump(msg, off + body.len, 0, 0)) == 0) { - LM_ERR("WTF\n"); + LM_ERR("failed to anchor lump\n"); + return -1; + } + if(mime != MIMETYPE(MULTIPART, MIXED)) { + LM_ERR("message body is not multipart/mixed\n"); return -1; } /* get delimiter no initial -- */ diff --git a/src/modules/textopsx/textopsx.c b/src/modules/textopsx/textopsx.c index 4f6944816..101ffb53a 100644 --- a/src/modules/textopsx/textopsx.c +++ b/src/modules/textopsx/textopsx.c @@ -1207,7 +1207,9 @@ static int find_hf_value2_param(struct hname_data *hname, str *param_area, i++; } else { while(i < param_area->len && !is_space(param_area->s[i]) - && !(param_area->s[i] != ',')) + && param_area->s[i] != ',') + i++; + if(i < param_area->len && param_area->s[i] == ',') i++; } } @@ -2483,10 +2485,10 @@ static int pv_get_hf_iterator_hname( return pv_get_null(msg, param, res); } - if(_hf_iterators[i].it == NULL) { + if(_hf_iterators[k].it == NULL) { return pv_get_null(msg, param, res); } - return pv_get_strval(msg, param, res, &_hf_iterators[i].it->name); + return pv_get_strval(msg, param, res, &_hf_iterators[k].it->name); } /** @@ -2649,11 +2651,12 @@ static int ki_bl_iterator_next(sip_msg_t *msg, str *iname) _bl_iterators[k].it.s = p; while(p < _bl_iterators[k].body.s + _bl_iterators[k].body.len) { if(*p == '\n') { + p++; break; } p++; } - _bl_iterators[k].it.len = p - _bl_iterators[k].it.s + 1; + _bl_iterators[k].it.len = p - _bl_iterators[k].it.s; return 1; } @@ -2999,8 +3002,14 @@ static int sel_hf_value_name(str *res, select_t *s, struct sip_msg *msg) if(s->params[1].v.s.s[i] == '_') s->params[1].v.s.s[i] = '-'; } - i = snprintf(buf, sizeof(buf) - 1, "%.*s: X\n", - s->params[1].v.s.len, s->params[1].v.s.s); + i = snprintf(buf, sizeof(buf) - 1, "%.*s: X\n", s->params[1].v.s.len, + s->params[1].v.s.s); + if(i < 0 || i >= (int)sizeof(buf) - 1) { + LM_ERR("header name is too long [%.*s]\n", s->params[1].v.s.len, + s->params[1].v.s.s); + pkg_free(hname); + return E_CFG; + } buf[i] = 0; hname->hname = s->params[1].v.s; diff --git a/src/modules/tls/README b/src/modules/tls/README index c6930b9ec..65dbc7d05 100644 --- a/src/modules/tls/README +++ b/src/modules/tls/README @@ -73,9 +73,10 @@ Olle E. Johansson 10.39. engine_algorithms (string) 10.40. verify_client (string) 10.41. provider_quirks (integer) - 10.42. keylog_mode (int) - 10.43. keylog_file (str) - 10.44. keylog_peer (str) + 10.42. provider_quirks_config (string) + 10.43. keylog_mode (int) + 10.44. keylog_file (str) + 10.45. keylog_peer (str) 11. Functions @@ -154,12 +155,14 @@ Olle E. Johansson 1.49. Set rand_engine parameter 1.50. Set verify_client modparam parameter 1.51. Set verify_client tls.cfg parameter - 1.52. Set keylog_mode parameter - 1.53. Set keylog_file parameter - 1.54. Set keylog_peer parameter - 1.55. is_peer_verified usage - 1.56. tls_set_connect_server_id usage - 1.57. Use of event_route[tls:connection-out] + 1.52. Set provider_quirks modparam parameter + 1.53. Set provider_quirks_config modparam parameter + 1.54. Set keylog_mode parameter + 1.55. Set keylog_file parameter + 1.56. Set keylog_peer parameter + 1.57. is_peer_verified usage + 1.58. tls_set_connect_server_id usage + 1.59. Use of event_route[tls:connection-out] Chapter 1. Admin Guide @@ -217,9 +220,10 @@ Chapter 1. Admin Guide 10.39. engine_algorithms (string) 10.40. verify_client (string) 10.41. provider_quirks (integer) - 10.42. keylog_mode (int) - 10.43. keylog_file (str) - 10.44. keylog_peer (str) + 10.42. provider_quirks_config (string) + 10.43. keylog_mode (int) + 10.44. keylog_file (str) + 10.45. keylog_peer (str) 11. Functions @@ -660,9 +664,10 @@ Place holder 10.39. engine_algorithms (string) 10.40. verify_client (string) 10.41. provider_quirks (integer) - 10.42. keylog_mode (int) - 10.43. keylog_file (str) - 10.44. keylog_peer (str) + 10.42. provider_quirks_config (string) + 10.43. keylog_mode (int) + 10.44. keylog_file (str) + 10.45. keylog_peer (str) 10.1. tls_method (string) @@ -1655,12 +1660,46 @@ verify_client = optional_no_ca 10.41. provider_quirks (integer) - Sets a flag to configure OpenSSL 3 behaviour. Currently only 1 - * 0 - no flags set (default) - * 1 - create a new `OSSL_LIB_CTX` context in the child process. Known - to be required when using OpenSSL 3 pkcs11-provider. + Reload a provider in the child - needed in MP-mode only + (tcp_main_threads = 0) for some providers. The configuration file for + the provider is provided in the provider_quirks_config parameter. + Should be 0 in MT-mode. + * 0 - no reload (default) + * 1 - reloads a provider in a new library context in the child. + pkcs11-provider is known to require this. -10.42. keylog_mode (int) + Example 1.52. Set provider_quirks modparam parameter +... +modparam("tls", "provider_quirks", 1) +# 1: provider_quirks_config parameter must be set +... + +10.42. provider_quirks_config (string) + + A file name of a OpenSSL configuration snippet that contains the + provider configuration. The file must contain two mandatory keys: + quirks_sect - section to load, quirks_provider - the provider to load. + + Example 1.53. Set provider_quirks_config modparam parameter +... +modparam("tls", "provider_quirks_config", "/etc/kamailio/tls/pkcs11-provider.cnf +") +... + + A provider example: +# /etc/kamailio/tls/pkcs11-provider.cnf +quirks_sect = pkcs11_sect +quirks_provider = pkcs11 + +[pkcs11_sect] +module = pkcs11.so +pkcs11-module-path = /usr/lib64/libsoftokn3.so +pkcs11-module-init-args = configDir=/etc/kamailio/certs/tokens +pkcs11-module-token-pin = file:/etc/kamailio/certs/pinfile-softoken.txt +pkcs11-module-quirks = no-deinit no-operation-state +activate = 1 + +10.43. keylog_mode (int) Control the TLS key logging functionality, available for libssl version greater than 1.1.0. Its value is composed from bitwise values (can be @@ -1682,12 +1721,12 @@ verify_client = optional_no_ca The default value: 0. - Example 1.52. Set keylog_mode parameter + Example 1.54. Set keylog_mode parameter ... modparam("tls", "keylog_mode", 15) ... -10.43. keylog_file (str) +10.44. keylog_file (str) Path to the file where to write the TLS keys. The values are appended to the content of the file. The value 8 (bit 4) has to be set to @@ -1695,12 +1734,12 @@ modparam("tls", "keylog_mode", 15) The default value: NULL. - Example 1.53. Set keylog_file parameter + Example 1.55. Set keylog_file parameter ... modparam("tls", "keylog_file", "/tmp/kamailio-tls-keylog.txt") ... -10.44. keylog_peer (str) +10.45. keylog_peer (str) Address of the peer where to send the keys log. It has to be in the format "proto:ip:port". Only "udp" protocol (proto) is supported. The @@ -1708,7 +1747,7 @@ modparam("tls", "keylog_file", "/tmp/kamailio-tls-keylog.txt") The default value: NULL. - Example 1.54. Set keylog_peer parameter + Example 1.56. Set keylog_peer parameter ... modparam("tls", "keylog_peer", "udp:127.0.0.1:8020") ... @@ -1726,7 +1765,7 @@ modparam("tls", "keylog_peer", "udp:127.0.0.1:8020") It can be used only in a request route. - Example 1.55. is_peer_verified usage + Example 1.57. is_peer_verified usage ... if (proto==TLS && !is_peer_verified()) { sl_send_reply("400", "No certificate or verification failed"); @@ -1745,7 +1784,7 @@ modparam("tls", "keylog_peer", "udp:127.0.0.1:8020") It can be used only in ANY_ROUTE. - Example 1.56. tls_set_connect_server_id usage + Example 1.58. tls_set_connect_server_id usage ... tls_set_connect_server_id("clientone"); ... @@ -1837,7 +1876,7 @@ modparam("tls", "keylog_peer", "udp:127.0.0.1:8020") If drop() is executed in the event route, then the data is no longer sent over the connection. - Example 1.57. Use of event_route[tls:connection-out] + Example 1.59. Use of event_route[tls:connection-out] ... event_route[tls:connection-out] { if($sndto(ip)=="1.2.3.4") { diff --git a/src/modules/tls/doc/params.xml b/src/modules/tls/doc/params.xml index a39891f38..41bd9a16c 100644 --- a/src/modules/tls/doc/params.xml +++ b/src/modules/tls/doc/params.xml @@ -1493,18 +1493,60 @@ verify_client = optional_no_ca
<varname>provider_quirks</varname> (integer) - Sets a flag to configure OpenSSL 3 behaviour. Currently only 1 + Reload a provider in the child - needed in MP-mode only (tcp_main_threads = 0) for some providers. + The configuration file for the provider is provided in the provider_quirks_config parameter. + Should be 0 in MT-mode. - 0 - no flags set (default) + 0 - no reload (default) - 1 - create a new `OSSL_LIB_CTX` context in the child process. - Known to be required when using OpenSSL 3 pkcs11-provider. + 1 - reloads a provider in a new library context + in the child. pkcs11-provider is known to require this. + + Set <varname>provider_quirks</varname> modparam parameter + +... +modparam("tls", "provider_quirks", 1) +# 1: provider_quirks_config parameter must be set +... + + +
+
+ <varname>provider_quirks_config</varname> (string) + + A file name of a OpenSSL configuration snippet that contains the provider configuration. + The file must contain two mandatory keys: quirks_sect - section to load, + quirks_provider - the provider to load. + + Set <varname>provider_quirks_config</varname> modparam parameter + +... +modparam("tls", "provider_quirks_config", "/etc/kamailio/tls/pkcs11-provider.cnf") +... + + + A provider example: + +# /etc/kamailio/tls/pkcs11-provider.cnf +quirks_sect = pkcs11_sect +quirks_provider = pkcs11 + +[pkcs11_sect] +module = pkcs11.so +pkcs11-module-path = /usr/lib64/libsoftokn3.so +pkcs11-module-init-args = configDir=/etc/kamailio/certs/tokens +pkcs11-module-token-pin = file:/etc/kamailio/certs/pinfile-softoken.txt +pkcs11-module-quirks = no-deinit no-operation-state +activate = 1 + + +
<varname>keylog_mode</varname> (int) diff --git a/src/modules/tls/tls_domain.c b/src/modules/tls/tls_domain.c index 88e516307..cda9046bb 100644 --- a/src/modules/tls/tls_domain.c +++ b/src/modules/tls/tls_domain.c @@ -738,7 +738,7 @@ static int set_cipher_list(tls_domain_t *d) return 0; procs_no = get_max_procs(); for(i = 0; i < procs_no; i++) { -#if OPENSSL_VERSION_NUMBER < 0x030000000L +#if OPENSSL_VERSION_NUMBER < 0x010101000L if(SSL_CTX_set_cipher_list(d->ctx[i], cipher_list) == 0) { ERR("%s: Failure to set SSL context cipher list \"%s\"\n", tls_domain_str(d), cipher_list); diff --git a/src/modules/tls/tls_mod.c b/src/modules/tls/tls_mod.c index 5ce10e5d2..765dfb9ed 100644 --- a/src/modules/tls/tls_mod.c +++ b/src/modules/tls/tls_mod.c @@ -27,6 +27,7 @@ #include #include #include + #include "../../core/locking.h" #include "../../core/sr_module.h" #include "../../core/ip_addr.h" @@ -57,6 +58,7 @@ #include "tls_rand.h" #include "tls_ct_wrq.h" + #ifndef TLS_HOOKS #error "TLS_HOOKS must be defined, or the tls module won't work" #endif @@ -103,6 +105,9 @@ MODULE_VERSION #define KSR_SSL_COMMON #define KSR_SSL_PROVIDER #include +#include +#include +#include #define KEY_PREFIX "/uri:" #define KEY_PREFIX_LEN (strlen(KEY_PREFIX)) #endif @@ -205,6 +210,7 @@ static ENGINE *ksr_tls_engine; #ifdef KSR_SSL_PROVIDER static int tls_provider_quirks; +str tls_provider_config = STR_NULL; #endif /* @@ -289,6 +295,8 @@ static param_export_t params[] = { &tls_engine_settings.engine_algorithms}, #endif /* KSR_SSL_ENGINE */ #ifdef KSR_SSL_PROVIDER + {"provider_quirks_config", PARAM_STR, + &tls_provider_config}, {"provider_quirks", PARAM_INT, &tls_provider_quirks}, /* OpenSSL 3 provider that needs new OSSL_LIB_CTX in child */ @@ -409,7 +417,20 @@ static int mod_init(void) return -1; } #endif +#if OPENSSL_VERSION_NUMBER >= 0x30000000L \ + && OPENSSL_VERSION_NUMBER < 0x30200000L + unsigned long run_ver = OpenSSL_version_num(); + if(run_ver >= 0x30200000L) { + LM_ERR("OpenSSL version < 3.2.0 is required\n"); + return -1; + } +#endif #if OPENSSL_VERSION_NUMBER >= 0x10101000L + { + pthread_key_t _ksr_tsd_init; + pthread_key_create(&_ksr_tsd_init, NULL); + pthread_key_delete(_ksr_tsd_init); + } for(k = 0; k < 32; k++) { if(pthread_getspecific(k) != 0) { LM_WARN("detected initialized thread-locals created before tls.so; " @@ -615,9 +636,70 @@ static int mod_child_hook(int *rank, void *dummy) } #ifdef KSR_SSL_PROVIDER -static OSSL_LIB_CTX *orig_ctx; -static OSSL_LIB_CTX *new_ctx; +#if OPENSSL_VERSION_NUMBER >= 0x30200000L +void load_p11_via_nconf(const char *config_path) +{ + CONF *conf = NCONF_new(NULL); + STACK_OF(CONF_VALUE) * sec; + OSSL_PARAM params[16]; // Ensure this is large enough for your keys + int p_idx = 0; + char *q_sect = NULL; + char *q_prov = NULL; + + // 1. Load the file into a private NCONF object + if(NCONF_load(conf, config_path, NULL) <= 0) { + // Handle error: File not found or syntax error + return; + } + q_sect = NCONF_get_string(conf, NULL, "quirks_sect"); // e.g., pkcs11_sect + q_prov = NCONF_get_string(conf, NULL, "quirks_provider"); // e.g., pkcs11 + + if(!q_sect || !q_prov) { + LM_ERR("quirks file %s missing quirks_sect or quirks_provider in " + "[default]\n", + config_path); + goto cleanup; + } + // 2. Get the specific section [pkcs11_sect] + sec = NCONF_get_section(conf, q_sect); + if(!sec) + return; + + // 3. Iterate pairs and build the OSSL_PARAM array + for(int i = 0; i < sk_CONF_VALUE_num(sec); i++) { + CONF_VALUE *v = sk_CONF_VALUE_value(sec, i); + + // Map string values to OSSL_PARAMS + // Note: In a real app, ensure these strings persist until OSSL_PROVIDER_load + params[p_idx++] = + OSSL_PARAM_construct_utf8_string(v->name, v->value, 0); + + if(p_idx >= 15) + break; + } + params[p_idx] = OSSL_PARAM_construct_end(); + + // 4. Load into a fresh Child Context + OSSL_LIB_CTX *child_ctx = OSSL_LIB_CTX_new(); + OSSL_LIB_CTX_set0_default(child_ctx); + OSSL_PROVIDER_load(child_ctx, "default"); + + OSSL_PROVIDER *p11 = OSSL_PROVIDER_load_ex(child_ctx, q_prov, params); + + if(p11) { + LM_INFO("%s: Successfully bootstrapped PKCS11 via NCONF abstraction\n", + config_path); + } else { + LM_ERR("failed to load provider %s from quirks file\n", q_prov); + } + +cleanup: + NCONF_free( + conf); // The params now live in the provider, we can free the parser +} #endif +#endif + static int mod_child(int rank) { if(tls_disable || (tls_domains_cfg == 0)) @@ -640,9 +722,18 @@ static int mod_child(int rank) if(rank > 0) { #ifdef KSR_SSL_PROVIDER if(tls_provider_quirks & 1) { - new_ctx = OSSL_LIB_CTX_new(); - orig_ctx = OSSL_LIB_CTX_set0_default(new_ctx); - CONF_modules_load_file(CONF_get1_default_config_file(), NULL, 0L); +#if OPENSSL_VERSION_NUMBER >= 0x30200000L + load_p11_via_nconf(tls_provider_config.s); +#else + OSSL_LIB_CTX *new_ctx = OSSL_LIB_CTX_new(); + if(CONF_modules_load_file_ex( + new_ctx, CONF_get1_default_config_file(), NULL, 0L) + <= 0) { + LM_ERR("Failed to load provider config in child %d\n", + process_no); + } + OSSL_LIB_CTX_set0_default(new_ctx); +#endif } #endif /* KSR_SSL_PROVIDER */ if(tls_engine_init() < 0) diff --git a/src/modules/tls/tls_select.c b/src/modules/tls/tls_select.c index 18abcc7dd..f65061fa8 100644 --- a/src/modules/tls/tls_select.c +++ b/src/modules/tls/tls_select.c @@ -1013,6 +1013,20 @@ static int get_comp(str *res, int local, int issuer, int nid, sip_msg_t *msg) goto err; } + if(nid == NID_undef) { + /* no component requested - return the full subject/issuer oneline */ + if(X509_NAME_oneline(name, buf, sizeof(buf)) == NULL) { + ERR("Error converting X509 name to string\n"); + goto err; + } + res->s = buf; + res->len = strlen(buf); + if(!local) + X509_free(cert); + tcpconn_put(c); + return 0; + } + index = X509_NAME_get_index_by_NID(name, nid, -1); if(index == -1) { switch(nid) { @@ -1238,8 +1252,8 @@ static int get_alt(str *res, int local, int type, int idx, sip_msg_t *msg) case GEN_EMAIL: case GEN_DNS: case GEN_URI: - text.s = (char *)nm->d.ia5->data; - text.len = nm->d.ia5->length; + text.s = (char *)ASN1_STRING_get0_data(nm->d.ia5); + text.len = ASN1_STRING_length(nm->d.ia5); if(text.len >= 1024) { ERR("Alternative subject text too long\n"); goto err; @@ -1249,9 +1263,14 @@ static int get_alt(str *res, int local, int type, int idx, sip_msg_t *msg) res->len = text.len; break; case GEN_IPADD: - ip.len = nm->d.iPAddress->length; + ip.len = ASN1_STRING_length(nm->d.iPAddress); + if(ip.len != 4 && ip.len != 16) { + ERR("Invalid ip address length\n"); + goto err; + } ip.af = (ip.len == 16) ? AF_INET6 : AF_INET; - memcpy(ip.u.addr, nm->d.iPAddress->data, ip.len); + memcpy(ip.u.addr, ASN1_STRING_get0_data(nm->d.iPAddress), + ip.len); text.s = ip_addr2a(&ip); text.len = strlen(text.s); memcpy(buf, text.s, text.len); diff --git a/src/modules/tls/tls_server.c b/src/modules/tls/tls_server.c index cf1f9955b..34a887dac 100644 --- a/src/modules/tls/tls_server.c +++ b/src/modules/tls/tls_server.c @@ -838,7 +838,7 @@ static char *get_tls_domain_str( atomic_inc(&cfg->ref_count); lock_release(tls_domains_cfg_lock); - if(c->flags & F_CONN_PASSIVE) { + if(c && (c->flags & F_CONN_PASSIVE)) { dom = tls_lookup_cfg(cfg, TLS_DOMAIN_SRV, ip, port, 0, 0); } else { sname = tls_get_connect_server_name(c); @@ -872,7 +872,7 @@ int tls_h_match_domain_f( return 0; } - dom_str = get_tls_domain_str(c, ip, port); + dom_str = get_tls_domain_str(NULL /* to use XAVPs only */, ip, port); STR_SET(dom, dom_str); return STR_EQ(tls_c->dom, dom); diff --git a/src/modules/tls_wolfssl/README b/src/modules/tls_wolfssl/README index 624e81593..9d37341b1 100644 --- a/src/modules/tls_wolfssl/README +++ b/src/modules/tls_wolfssl/README @@ -13,6 +13,9 @@ Shih-Ping Chan 2. Quick Start 3. Important Notes 4. Compiling the wolfSSL TLS Module + 5. Parameters + + 5.1. crl List of Examples @@ -26,6 +29,9 @@ Chapter 1. Admin Guide 2. Quick Start 3. Important Notes 4. Compiling the wolfSSL TLS Module + 5. Parameters + + 5.1. crl 1. Overview @@ -83,3 +89,13 @@ make modules modules=modules/tls_wolfssl make all include_modules=tls_wolfssl . + +5. Parameters + + 5.1. crl + + Important differences to the tls module + +5.1. crl + + The value is a folder containing PEM CRL files with extension .pem. diff --git a/src/modules/tls_wolfssl/doc/tls_wolfssl.xml b/src/modules/tls_wolfssl/doc/tls_wolfssl.xml index 5eee19b6b..c8ef5b1d6 100644 --- a/src/modules/tls_wolfssl/doc/tls_wolfssl.xml +++ b/src/modules/tls_wolfssl/doc/tls_wolfssl.xml @@ -105,6 +105,18 @@ make all include_modules=tls_wolfssl .
+
+ + Parameters + Important differences to the tls module +
+ <varname>crl</varname> + + The value is a folder containing PEM CRL files + with extension .pem. + +
+
diff --git a/src/modules/tls_wolfssl/tls_domain.c b/src/modules/tls_wolfssl/tls_domain.c index 35888845e..d60d0c943 100644 --- a/src/modules/tls_wolfssl/tls_domain.c +++ b/src/modules/tls_wolfssl/tls_domain.c @@ -83,35 +83,8 @@ static unsigned char dh3072_g[] = {0x02}; static void setup_dh(WOLFSSL_CTX *ctx) { - /* - * not needed for OpenSSL 1.1.0+ and LibreSSL - * DH_new() is deprecated in OpenSSL 3 - */ - DH *dh; - BIGNUM *p; - BIGNUM *g; - - dh = DH_new(); - if(dh == NULL) { - return; - } - - p = BN_bin2bn(dh3072_p, sizeof(dh3072_p), NULL); - g = BN_bin2bn(dh3072_g, sizeof(dh3072_g), NULL); - - if(p == NULL || g == NULL) { - DH_free(dh); - return; - } - - dh->p = p; - dh->g = g; - - - wolfSSL_CTX_set_options(ctx, WOLFSSL_OP_SINGLE_DH_USE); - wolfSSL_CTX_set_tmp_dh(ctx, dh); - - DH_free(dh); + wolfSSL_CTX_SetTmpDH( + ctx, dh3072_p, sizeof(dh3072_p), dh3072_g, sizeof(dh3072_g)); } @@ -589,18 +562,21 @@ static int load_crl(tls_domain_t *d) LOG(L_INFO, "%s: Certificate revocation lists will be checked (%.*s)\n", tls_domain_str(d), d->crl_file.len, d->crl_file.s); - do { - if(wolfSSL_CTX_load_verify_locations(d->ctx[0], d->crl_file.s, 0) - != 1) { - ERR("%s: Unable to load certificate revocation list '%s'\n", - tls_domain_str(d), d->crl_file.s); - TLS_ERR("load_crl:"); - return -1; - } - store = wolfSSL_CTX_get_cert_store(d->ctx[0]); - wolfSSL_X509_STORE_set_flags( - store, WOLFSSL_CRL_CHECK | WOLFSSL_CRL_CHECKALL); - } while(0); + + if(wolfSSL_CTX_EnableCRL(d->ctx[0], 0) != WOLFSSL_SUCCESS) { + ERR("%s: Unable to enable CRL checking '%s'\n", tls_domain_str(d), + d->crl_file.s); + TLS_ERR("load_crl:"); + return -1; + } + if(wolfSSL_CTX_LoadCRL(d->ctx[0], d->crl_file.s, WOLFSSL_FILETYPE_PEM, 0) + != WOLFSSL_SUCCESS) { + ERR("%s: Unable to load CRL file '%s'\n", tls_domain_str(d), + d->crl_file.s); + TLS_ERR("load_crl:"); + return -1; + } + return 0; } @@ -620,18 +596,16 @@ static int set_cipher_list(tls_domain_t *d) { char *cipher_list; + setup_dh(d->ctx[0]); cipher_list = d->cipher_list.s; if(!cipher_list) return 0; - do { - if(wolfSSL_CTX_set_cipher_list(d->ctx[0], cipher_list) == 0) { - ERR("%s: Failure to set SSL context cipher list \"%s\"\n", - tls_domain_str(d), cipher_list); - return -1; - } - setup_dh(d->ctx[0]); - } while(0); + if(wolfSSL_CTX_set_cipher_list(d->ctx[0], cipher_list) == 0) { + ERR("%s: Failure to set SSL context cipher list \"%s\"\n", + tls_domain_str(d), cipher_list); + return -1; + } return 0; } diff --git a/src/modules/tls_wolfssl/tls_select.c b/src/modules/tls_wolfssl/tls_select.c index 84de5b178..adffa58e1 100644 --- a/src/modules/tls_wolfssl/tls_select.c +++ b/src/modules/tls_wolfssl/tls_select.c @@ -1214,8 +1214,8 @@ static int get_alt(str *res, int local, int type, sip_msg_t *msg) case GEN_EMAIL: case GEN_DNS: case GEN_URI: - text.s = (char *)nm->d.ia5->data; - text.len = nm->d.ia5->length; + text.s = (char *)ASN1_STRING_get0_data(nm->d.ia5); + text.len = ASN1_STRING_length(nm->d.ia5); if(text.len >= 1024) { ERR("Alternative subject text too long\n"); goto err; @@ -1227,9 +1227,14 @@ static int get_alt(str *res, int local, int type, sip_msg_t *msg) break; case GEN_IPADD: - ip.len = nm->d.iPAddress->length; + ip.len = ASN1_STRING_length(nm->d.iPAddress); + if(ip.len != 4 && ip.len != 16) { + ERR("Invalid ip address length\n"); + goto err; + } ip.af = (ip.len == 16) ? AF_INET6 : AF_INET; - memcpy(ip.u.addr, nm->d.iPAddress->data, ip.len); + memcpy(ip.u.addr, ASN1_STRING_get0_data(nm->d.iPAddress), + ip.len); text.s = ip_addr2a(&ip); text.len = strlen(text.s); memcpy(buf, text.s, text.len); diff --git a/src/modules/tls_wolfssl/tls_server.c b/src/modules/tls_wolfssl/tls_server.c index fc9e0e477..359b74d71 100644 --- a/src/modules/tls_wolfssl/tls_server.c +++ b/src/modules/tls_wolfssl/tls_server.c @@ -716,7 +716,7 @@ static char *get_tls_domain_str( atomic_inc(&cfg->ref_count); lock_release(tls_domains_cfg_lock); - if(c->flags & F_CONN_PASSIVE) { + if(c && (c->flags & F_CONN_PASSIVE)) { dom = tls_lookup_cfg(cfg, TLS_DOMAIN_SRV, ip, port, 0, 0); } else { sname = tls_get_connect_server_name(); @@ -750,7 +750,7 @@ int tls_h_match_domain_f( return 0; } - dom_str = get_tls_domain_str(c, ip, port); + dom_str = get_tls_domain_str(NULL /* to use XAVPs only */, ip, port); STR_SET(dom, dom_str); return STR_EQ(tls_c->dom, dom); diff --git a/src/modules/tm/config.h b/src/modules/tm/config.h index 6a7082938..b2b0369fa 100644 --- a/src/modules/tm/config.h +++ b/src/modules/tm/config.h @@ -100,9 +100,6 @@ /* to-tag separator for stateful processing */ #define TM_TAG_SEPARATOR '-' -/* FIFO substitution character */ -#define SUBST_CHAR '!' - struct cfg_group_tm { char *tm_auto_inv_100_r; diff --git a/src/modules/tm/rpc_uac.c b/src/modules/tm/rpc_uac.c index 67556c095..386e682bd 100644 --- a/src/modules/tm/rpc_uac.c +++ b/src/modules/tm/rpc_uac.c @@ -34,6 +34,9 @@ /* RPC substitution char (used in rpc_t_uac headers) */ #define SUBST_CHAR '!' +#ifndef TM_RPC_SUBST_CHAR_ON +#define TM_RPC_SUBST_CHAR_ON 0 +#endif #define TM_RPC_RESPONSE_LIFETIME 300 #define TM_RPC_RESPONSE_TIMERSTEP 10 @@ -739,7 +742,7 @@ static void rpc_t_uac_attrs_helper( < 0) goto error; if(get_hfblock(tattrs->nexthop.len ? &tattrs->nexthop : &tattrs->ruri, - faked_msg.headers, PROTO_NONE, ssock, 1, &hfb) + faked_msg.headers, PROTO_NONE, ssock, TM_RPC_SUBST_CHAR_ON, &hfb) < 0) { rpc->fault(c, 500, "Failed to build headers block"); goto error; @@ -771,10 +774,16 @@ static void rpc_t_uac_attrs_helper( dlg.loc_seq.is_set = DLG_SEQ_VALSET; dlg.loc_uri = get_from(&faked_msg)->uri; + if(get_from(&faked_msg)->display.len > 0) { + dlg.loc_dname = get_from(&faked_msg)->display; + } dlg.rem_uri = get_to(&faked_msg)->uri; if(get_to(&faked_msg)->tag_value.len > 0) { dlg.id.rem_tag = get_to(&faked_msg)->tag_value; } + if(get_to(&faked_msg)->display.len > 0) { + dlg.rem_dname = get_to(&faked_msg)->display; + } dlg.rem_target = tattrs->ruri; dlg.dst_uri = tattrs->nexthop; dlg.send_sock = ssock; diff --git a/src/modules/tm/t_msgbuilder.c b/src/modules/tm/t_msgbuilder.c index f8dfc4c40..dae57fe54 100644 --- a/src/modules/tm/t_msgbuilder.c +++ b/src/modules/tm/t_msgbuilder.c @@ -1554,11 +1554,15 @@ static inline char *print_to( char *w, dlg_t *dialog, struct cell *t, int bracket) { t->to_hdr.s = w; - t->to_hdr.len = - TO_LEN + dialog->rem_uri.len + CRLF_LEN - + (((dialog->rem_uri.s[dialog->rem_uri.len - 1] != '>')) ? 2 : 0); + t->to_hdr.len = TO_LEN + dialog->rem_dname.len + + ((dialog->rem_dname.len > 0) ? 1 : 0) + + dialog->rem_uri.len + ((bracket) ? 2 : 0) + CRLF_LEN; memapp(w, TO, TO_LEN); + if(dialog->rem_dname.len > 0) { + memapp(w, dialog->rem_dname.s, dialog->rem_dname.len); + memapp(w, " ", 1); + } if(bracket) memapp(w, "<", 1); memapp(w, dialog->rem_uri.s, dialog->rem_uri.len); @@ -1583,11 +1587,15 @@ static inline char *print_from( char *w, dlg_t *dialog, struct cell *t, int bracket) { t->from_hdr.s = w; - t->from_hdr.len = - FROM_LEN + dialog->loc_uri.len + CRLF_LEN - + ((dialog->loc_uri.s[dialog->loc_uri.len - 1] != '>') ? 2 : 0); + t->from_hdr.len = FROM_LEN + dialog->loc_dname.len + + ((dialog->loc_dname.len > 0) ? 1 : 0) + + dialog->loc_uri.len + ((bracket) ? 2 : 0) + CRLF_LEN; memapp(w, FROM, FROM_LEN); + if(dialog->loc_dname.len > 0) { + memapp(w, dialog->loc_dname.s, dialog->loc_dname.len); + memapp(w, " ", 1); + } if(bracket) memapp(w, "<", 1); memapp(w, dialog->loc_uri.s, dialog->loc_uri.len); @@ -1675,6 +1683,7 @@ char *build_uac_req(str *method, str *headers, str *body, dlg_t *dialog, str content_length, cseq, via; unsigned int maxfwd_len; int tbracket, fbracket; + int tdname = 0, fdname = 0; str fromtag = STR_NULL; str loc_tag = STR_NULL; @@ -1724,6 +1733,9 @@ char *build_uac_req(str *method, str *headers, str *body, dlg_t *dialog, } else { tbracket = 1; } + if(dialog->rem_dname.len > 0) { + tdname = 1; + } if((p = q_memrchr(dialog->loc_uri.s, '>', dialog->loc_uri.len)) != NULL) { if((p == dialog->loc_uri.s + dialog->loc_uri.len - 1) || *(p + 1) == ';') { @@ -1734,14 +1746,17 @@ char *build_uac_req(str *method, str *headers, str *body, dlg_t *dialog, } else { fbracket = 1; } + if(dialog->loc_dname.len > 0) { + fdname = 1; + } - *len += TO_LEN + dialog->rem_uri.len + *len += TO_LEN + dialog->rem_dname.len + tdname + dialog->rem_uri.len + (dialog->id.rem_tag.len ? (TOTAG_LEN + dialog->id.rem_tag.len) : 0) + CRLF_LEN; /* To */ if(tbracket) *len += 2; /* To-URI < > */ - *len += FROM_LEN + dialog->loc_uri.len + *len += FROM_LEN + dialog->loc_dname.len + fdname + dialog->loc_uri.len + (dialog->id.loc_tag.len ? (FROMTAG_LEN + dialog->id.loc_tag.len) : 0) + CRLF_LEN; /* From */ diff --git a/src/modules/tmx/t_var.c b/src/modules/tmx/t_var.c index 5e3bda679..5320366aa 100644 --- a/src/modules/tmx/t_var.c +++ b/src/modules/tmx/t_var.c @@ -46,6 +46,20 @@ static struct _pv_tmx_data _pv_treq; static struct _pv_tmx_data _pv_trpl; static struct _pv_tmx_data _pv_tinv; +static void pv_t_var_free(void *p) +{ + pv_name_t *pvn = NULL; + + if(p == NULL) + return; + + pvn = (pv_name_t *)p; + if(pvn->u.dname != NULL) { + pv_spec_free((pv_spec_t *)pvn->u.dname); + pvn->u.dname = NULL; + } +} + void pv_tmx_data_init(void) { memset(&_pv_treq, 0, sizeof(struct _pv_tmx_data)); @@ -53,6 +67,34 @@ void pv_tmx_data_init(void) memset(&_pv_tinv, 0, sizeof(struct _pv_tmx_data)); } +void pv_tmx_data_free(void) +{ + if(_pv_treq.buf) { + if(_pv_treq.tmsgp) + free_sip_msg(&_pv_treq.msg); + pkg_free(_pv_treq.buf); + _pv_treq.buf = NULL; + _pv_treq.buf_size = 0; + _pv_treq.tmsgp = NULL; + } + if(_pv_trpl.buf) { + if(_pv_trpl.tmsgp) + free_sip_msg(&_pv_trpl.msg); + pkg_free(_pv_trpl.buf); + _pv_trpl.buf = NULL; + _pv_trpl.buf_size = 0; + _pv_trpl.tmsgp = NULL; + } + if(_pv_tinv.buf) { + if(_pv_tinv.tmsgp) + free_sip_msg(&_pv_tinv.msg); + pkg_free(_pv_tinv.buf); + _pv_tinv.buf = NULL; + _pv_tinv.buf_size = 0; + _pv_tinv.tmsgp = NULL; + } +} + int pv_t_copy_msg(struct sip_msg *src, struct sip_msg *dst) { dst->id = src->id; @@ -386,6 +428,7 @@ int pv_parse_t_var_name(pv_spec_p sp, str *in) sp->pvp.pvn.u.dname = (void *)pv; sp->pvp.pvn.type = PV_NAME_PVAR; + sp->pvp.pvn.nfree = pv_t_var_free; return 0; error: @@ -846,6 +889,10 @@ int pv_get_t_branch(struct sip_msg *msg, pv_param_t *param, pv_value_t *res) tcx = _tmx_tmb.tm_ctx_get(); if(tcx == NULL) return pv_get_null(msg, param, res); + if(tcx->branch_index < 0 + || tcx->branch_index >= t->nr_of_outgoings) { + return pv_get_null(msg, param, res); + } return pv_get_strval( msg, param, res, &t->uac[tcx->branch_index].ruid); break; diff --git a/src/modules/tmx/t_var.h b/src/modules/tmx/t_var.h index 0ecb6a605..56b7d757b 100644 --- a/src/modules/tmx/t_var.h +++ b/src/modules/tmx/t_var.h @@ -30,6 +30,7 @@ #include "../../core/pvar.h" void pv_tmx_data_init(void); +void pv_tmx_data_free(void); int pv_get_t_var_inv(struct sip_msg *msg, pv_param_t *param, pv_value_t *res); int pv_get_t_var_req(struct sip_msg *msg, pv_param_t *param, pv_value_t *res); diff --git a/src/modules/tmx/tmx_mod.c b/src/modules/tmx/tmx_mod.c index ea17e1539..091738935 100644 --- a/src/modules/tmx/tmx_mod.c +++ b/src/modules/tmx/tmx_mod.c @@ -613,6 +613,10 @@ static int ki_t_reply_callid( } LM_DBG("now calling internal tm reply\n"); + if(trans->uas.request == NULL) { + LM_DBG("no uas.request for transaction\n"); + return -1; + } if(_tmx_tmb.t_reply_trans( trans, trans->uas.request, (unsigned int)code, status_s->s) > 0) diff --git a/src/modules/tmx/tmx_pretran.c b/src/modules/tmx/tmx_pretran.c index a7c7d52df..332d82dd8 100644 --- a/src/modules/tmx/tmx_pretran.c +++ b/src/modules/tmx/tmx_pretran.c @@ -252,6 +252,12 @@ int tmx_check_pretran(sip_msg_t *msg) sftag = get_from(msg)->tag_value; trim(&sftag); + if(4096 < scallid.len || 32 < scseqnum.len || 128 < scseqmet.len + || 4096 < sftag.len) { + LM_ERR("attributes are too large\n"); + return -1; + } + chid = get_hash1_raw(scallid.s, scallid.len); slotid = chid & (_tmx_ptran_size - 1); @@ -265,9 +271,14 @@ int tmx_check_pretran(sip_msg_t *msg) _tmx_proc_ptran->pid = my_pid(); } dsize = scallid.len + scseqnum.len + scseqmet.len + sftag.len + 4; + if(likely(vbr != NULL)) { svbranch = vbr->value; trim(&svbranch); + if(4096 < svbranch.len + 1) { + LM_ERR("too large branch value\n"); + return -1; + } dsize += svbranch.len + 1; } if(dsize < 256) @@ -336,6 +347,8 @@ int tmx_check_pretran(sip_msg_t *msg) if(_tmx_proc_ptran->vbranch.s != NULL && it->vbranch.s != NULL) { if(_tmx_proc_ptran->vbranch.len != it->vbranch.len) continue; + if(_tmx_proc_ptran->vbranch.len == 0) + continue; /* shortcut - check last char in Via branch * - kamailio/ser adds there branch index => in case of parallel * forking by previous hop, catch it here quickly */ diff --git a/src/modules/topos/README b/src/modules/topos/README index 775a0b510..0995e4286 100644 --- a/src/modules/topos/README +++ b/src/modules/topos/README @@ -328,13 +328,13 @@ end 3.9. event_mode (int) - Control what event_route blocks to be executed. It is a bitmask of: 1 - - execute event_route[topos:msg-outgoing]; 2 - execute - event_route[topos:msg-sending]; 4 execute - event_route[topos:msg-incoming]; 8 execute - event_route[topos:msg-receiving];. + Control what event_route blocks to be executed. It is a bitmask of: + * 1 - execute event_route[topos:msg-outgoing] + * 2 - execute event_route[topos:msg-sending] + * 4 - execute event_route[topos:msg-incoming] + * 8 - execute event_route[topos:msg-receiving] - Default value is 3 (execute both event_route blocks). + Default value is 15 (execute all event_route blocks). Example 1.9. Set event_mode parameter ... diff --git a/src/modules/topos/doc/topos_admin.xml b/src/modules/topos/doc/topos_admin.xml index 3edadf8b1..c7a5138e4 100644 --- a/src/modules/topos/doc/topos_admin.xml +++ b/src/modules/topos/doc/topos_admin.xml @@ -279,19 +279,29 @@ end ... -
+
<varname>event_mode</varname> (int) - Control what event_route blocks to be executed. It is a bitmask of: - 1 - execute event_route[topos:msg-outgoing]; 2 - execute - event_route[topos:msg-sending]; 4 execute - event_route[topos:msg-incoming]; 8 execute - event_route[topos:msg-receiving];. + Control what event_route blocks to be executed. It is a bitmask of: + + + 1 - execute event_route[topos:msg-outgoing] + + + 2 - execute event_route[topos:msg-sending] + + + 4 - execute event_route[topos:msg-incoming] + + + 8 - execute event_route[topos:msg-receiving] + + - Default value is 3 (execute both event_route blocks). + Default value is 15 (execute all event_route blocks). @@ -302,7 +312,7 @@ modparam("topos", "event_mode", 2) ... -
+
<varname>contact_host</varname> (str) diff --git a/src/modules/topos/topos_mod.c b/src/modules/topos/topos_mod.c index 2270f733b..a88f63d22 100644 --- a/src/modules/topos/topos_mod.c +++ b/src/modules/topos/topos_mod.c @@ -719,7 +719,9 @@ static int tps_execute_event_route(sip_msg_t *msg, sr_event_param_t *evp, { sip_msg_t *fmsg = NULL; struct run_act_ctx ctx; - int rtb; + int rtb = 0; + int ret = 0; + int route_set = 0; sr_kemi_eng_t *keng = NULL; onsend_info_t onsnd_info = {0}; onsend_info_t *p_onsend_bak = 0; @@ -771,6 +773,7 @@ static int tps_execute_event_route(sip_msg_t *msg, sr_event_param_t *evp, rtb = get_route_type(); set_route_type(REQUEST_ROUTE); + route_set = 1; init_run_actions_ctx(&ctx); if(evidx >= 0) { run_top_route(event_rt.rlist[evidx], (msg) ? msg : fmsg, &ctx); @@ -780,28 +783,25 @@ static int tps_execute_event_route(sip_msg_t *msg, sr_event_param_t *evp, &_tps_eventrt_callback, evname) < 0) { LM_ERR("error running event route kemi callback\n"); - p_onsend = p_onsend_bak; - if(fmsg != NULL && evp->rcv != NULL) { - fmsg->rcv = fmsg_rcv_bak; - } - return -1; + ret = -1; + goto done; } } } - if(fmsg != NULL && evp->rcv != NULL) { - fmsg->rcv = fmsg_rcv_bak; - } - - set_route_type(rtb); if(ctx.run_flags & DROP_R_F) { LM_DBG("exit due to 'drop' in event route\n"); - p_onsend = p_onsend_bak; - return 1; + ret = 1; } done: + if(route_set) { + set_route_type(rtb); + } + if(fmsg != NULL && evp->rcv != NULL) { + fmsg->rcv = fmsg_rcv_bak; + } p_onsend = p_onsend_bak; - return 0; + return ret; } /** diff --git a/src/modules/topos/tps_storage.c b/src/modules/topos/tps_storage.c index b8d3378b1..2ece53c15 100644 --- a/src/modules/topos/tps_storage.c +++ b/src/modules/topos/tps_storage.c @@ -317,7 +317,9 @@ int tps_storage_fill_contact( vavu = get_xavu_host(dir); } - append_host_info(td, &puri, vavu, 0); + /* ctmode=0 preserves port/transport from original URI; ctmode=3 does not */ + append_host_info( + td, &puri, vavu, (ctmode == TPS_CONTACT_MODE_SKEYUSER) ? 1 : 0); } /* Finalize the contact header */ diff --git a/src/modules/uac/auth.c b/src/modules/uac/auth.c index 2bb376c2f..5748f87a6 100644 --- a/src/modules/uac/auth.c +++ b/src/modules/uac/auth.c @@ -215,6 +215,8 @@ struct hdr_field *get_authenticate_hdr(struct sip_msg *rpl, int rpl_code) { struct hdr_field *hdr; str hdr_name; + struct authenticate_body auth; + int auth_hdr_found = 0; /* what hdr should we look for */ if(rpl_code == WWW_AUTH_CODE) { @@ -237,17 +239,26 @@ struct hdr_field *get_authenticate_hdr(struct sip_msg *rpl, int rpl_code) goto error; } for(hdr = rpl->headers; hdr; hdr = hdr->next) { - if(rpl_code == WWW_AUTH_CODE && hdr->type == HDR_WWW_AUTHENTICATE_T) - return hdr; - if(rpl_code == PROXY_AUTH_CODE && hdr->type == HDR_PROXY_AUTHENTICATE_T) - return hdr; + if((rpl_code == WWW_AUTH_CODE && hdr->type == HDR_WWW_AUTHENTICATE_T) + || (rpl_code == PROXY_AUTH_CODE + && hdr->type == HDR_PROXY_AUTHENTICATE_T)) { + auth_hdr_found = 1; + if(parse_authenticate_body(&hdr->body, &auth) == 0) { + return hdr; + } + LM_DBG("skipping unsupported authenticate header body <%.*s>\n", + hdr->body.len, hdr->body.s); + } } - LM_ERR("reply has no " - "auth hdr (%.*s)\n", - hdr_name.len, hdr_name.s); + if(auth_hdr_found) { + LM_ERR("reply has no supported auth hdr (%.*s)\n", hdr_name.len, + hdr_name.s); + } else { + LM_ERR("reply has no auth hdr (%.*s)\n", hdr_name.len, hdr_name.s); + } error: - return 0; + return NULL; } diff --git a/src/modules/usrloc/urecord.c b/src/modules/usrloc/urecord.c index ecc7f0d4b..ae69b7748 100644 --- a/src/modules/usrloc/urecord.c +++ b/src/modules/usrloc/urecord.c @@ -285,9 +285,14 @@ static inline void nodb_timer(urecord_t *_r) while(ptr) { if(ul_handle_lost_tcp && is_valid_tcpconn(ptr) && !is_tcp_alive(ptr)) { - LM_DBG("tcp connection has been lost, expiring contact %.*s\n", + LM_DBG("tcp connection has been lost, deleting contact %.*s\n", ptr->c.len, ptr->c.s); - ptr->expires = UL_EXPIRED_TIME; + t = ptr; + ptr = ptr->next; + if(delete_ucontact(_r, t) < 0) { + LM_ERR("failed to delete contact with lost tcp connection\n"); + } + continue; } if(!VALID_CONTACT(ptr, ul_act_time)) { @@ -379,9 +384,14 @@ static inline void wb_timer(urecord_t *_r) while(ptr) { if(ul_handle_lost_tcp && is_valid_tcpconn(ptr) && !is_tcp_alive(ptr)) { - LM_DBG("tcp connection has been lost, expiring contact %.*s\n", + LM_DBG("tcp connection has been lost, deleting contact %.*s\n", ptr->c.len, ptr->c.s); - ptr->expires = UL_EXPIRED_TIME; + t = ptr; + ptr = ptr->next; + if(delete_ucontact(_r, t) < 0) { + LM_ERR("failed to delete contact with lost tcp connection\n"); + } + continue; } if(!VALID_CONTACT(ptr, ul_act_time)) { diff --git a/src/modules/websocket/CMakeLists.txt b/src/modules/websocket/CMakeLists.txt index 94aa41ac3..9d2e1594c 100644 --- a/src/modules/websocket/CMakeLists.txt +++ b/src/modules/websocket/CMakeLists.txt @@ -7,9 +7,6 @@ option(EMBEDDED_UTF8_DECODE "Use embedded UTF-8 decode (websocket module)" OFF) if(EMBEDDED_UTF8_DECODE) target_compile_definitions(${module_name} PRIVATE EMBEDDED_UTF8_DECODE) else() - if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") - target_include_directories(${module_name} PRIVATE /opt/local/include) - target_link_directories(${module_name} PRIVATE /opt/local/lib) - endif() - target_link_libraries(${module_name} PRIVATE unistring) + find_package(Unistring REQUIRED) + target_link_libraries(${module_name} PRIVATE Unistring::Unistring) endif() diff --git a/src/modules/xhttp_prom/prom_metric.c b/src/modules/xhttp_prom/prom_metric.c index bd1269584..31f53f8da 100644 --- a/src/modules/xhttp_prom/prom_metric.c +++ b/src/modules/xhttp_prom/prom_metric.c @@ -1735,13 +1735,12 @@ static int prom_label_print( goto error; } - if(plval->n_elem == 0) { - /* Nothing to print. */ - return 0; - } - - if(!lb_name || lb_name->n_elem == 0) { - /* Nothing to print. */ + if(plval->n_elem == 0 || !lb_name || lb_name->n_elem == 0) { + /* No metric-specific labels, but print global tags if present. */ + if(prom_body_printf(ctx, "%s", xhttp_prom_tags_braces) == -1) { + LM_ERR("Fail to print\n"); + goto error; + } return 0; } @@ -1773,8 +1772,8 @@ static int prom_label_print( plval_node = plval_node->next; } /* while (lb_name_node && plval_node) */ - /* Close labels. */ - if(prom_body_printf(ctx, "}") == -1) { + /* Append global tags and close labels. */ + if(prom_body_printf(ctx, "%s}", xhttp_prom_tags_comma) == -1) { LM_ERR("Fail to print\n"); goto error; } @@ -1832,8 +1831,8 @@ static int prom_label_print_le( goto error; } - /* Close labels. */ - if(prom_body_printf(ctx, "}") == -1) { + /* Append global tags and close labels. */ + if(prom_body_printf(ctx, "%s}", xhttp_prom_tags_comma) == -1) { LM_ERR("Fail to print\n"); goto error; } @@ -1887,10 +1886,44 @@ static int prom_metric_lvalue_print( goto error; } - /* Print labels */ - if(prom_label_print(ctx, p->lb_name, &pvl->lval)) { - LM_ERR("Fail to print labels\n"); - goto error; + + /* Print labels and append global tags if set */ + int has_labels = + (p->lb_name && p->lb_name->n_elem > 0 && pvl->lval.n_elem > 0); + int has_tags = + (xhttp_prom_tags_comma && xhttp_prom_tags_comma[0] != '\0'); + if(has_labels) { + /* Print user labels, then append global tags if set */ + /* Remove closing brace, append comma, then tags, then close */ + if(prom_body_printf(ctx, "{") == -1) + goto error; + prom_lb_node_t *lb_name_node = p->lb_name->lb; + prom_lb_node_t *plval_node = pvl->lval.lb; + int first = 1; + while(lb_name_node && plval_node) { + if(!first) { + if(prom_body_printf(ctx, ", ") == -1) + goto error; + } + if(prom_body_printf(ctx, "%.*s=\"%.*s\"", lb_name_node->n.len, + lb_name_node->n.s, plval_node->n.len, + plval_node->n.s) + == -1) + goto error; + lb_name_node = lb_name_node->next; + plval_node = plval_node->next; + first = 0; + } + if(has_tags) { + if(prom_body_printf(ctx, "%s", xhttp_prom_tags_comma) == -1) + goto error; + } + if(prom_body_printf(ctx, "}") == -1) + goto error; + } else if(has_tags) { + /* Only global tags */ + if(prom_body_printf(ctx, "{%s}", xhttp_prom_tags) == -1) + goto error; } if(prom_body_printf(ctx, " %" PRIu64, pvl->m.cval) == -1) { diff --git a/utils/kamctl/dbtextdb/__init__.py b/utils/kamctl/dbtextdb/__init__.py index 1041be860..4f296473c 100644 --- a/utils/kamctl/dbtextdb/__init__.py +++ b/utils/kamctl/dbtextdb/__init__.py @@ -1,6 +1,24 @@ #!/usr/bin/python # # Copyright 2008 Google Inc. All Rights Reserved. +# +# This file is part of Kamailio, a free SIP server. +# +# SPDX-License-Identifier: GPL-2.0-or-later +# +# Kamailio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version +# +# Kamailio is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA """Empty __init__ for dbtextdb module. diff --git a/utils/kamctl/dbtextdb/dbtextdb.py b/utils/kamctl/dbtextdb/dbtextdb.py index 182190664..ec5d65db9 100755 --- a/utils/kamctl/dbtextdb/dbtextdb.py +++ b/utils/kamctl/dbtextdb/dbtextdb.py @@ -1,7 +1,25 @@ #!/usr/bin/python3 # # Copyright 2008 Google Inc. All Rights Reserved. - +# +# This file is part of Kamailio, a free SIP server. +# +# SPDX-License-Identifier: GPL-2.0-or-later +# +# Kamailio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version +# +# Kamailio is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +# """SQL-like access layer for dbtext. This module provides the glue for kamctl to interact with dbtext files diff --git a/utils/kamctl/dbtextdb/dbtextdb_test.py b/utils/kamctl/dbtextdb/dbtextdb_test.py index 8762de1b3..062458578 100644 --- a/utils/kamctl/dbtextdb/dbtextdb_test.py +++ b/utils/kamctl/dbtextdb/dbtextdb_test.py @@ -1,6 +1,24 @@ #!/usr/bin/python # # Copyright 2008 Google Inc. All Rights Reserved. +# +# This file is part of Kamailio, a free SIP server. +# +# SPDX-License-Identifier: GPL-2.0-or-later +# +# Kamailio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version +# +# Kamailio is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA """Test for dbtext_query.""" diff --git a/utils/kamctl/generate_version_create_mongo.sh b/utils/kamctl/generate_version_create_mongo.sh index 9e95ab14d..b8081c68f 100644 --- a/utils/kamctl/generate_version_create_mongo.sh +++ b/utils/kamctl/generate_version_create_mongo.sh @@ -1,4 +1,22 @@ #!/usr/bin/env sh +# +# This file is part of Kamailio, a free SIP server. +# +# SPDX-License-Identifier: GPL-2.0-or-later +# +# Kamailio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version +# +# Kamailio is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA OUTPUT_FILE="$1" JSON_DIR="$2" diff --git a/utils/kamctl/kamctl b/utils/kamctl/kamctl index e0a339c1f..f74954a16 100755 --- a/utils/kamctl/kamctl +++ b/utils/kamctl/kamctl @@ -2,6 +2,24 @@ # # control tool for maintaining Kamailio # +# This file is part of Kamailio, a free SIP server. +# +# SPDX-License-Identifier: GPL-2.0-or-later +# +# Kamailio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version +# +# Kamailio is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +# #=================================================================== ### version for this script diff --git a/utils/kamctl/kamctl.base b/utils/kamctl/kamctl.base index e61b556c3..a8bf1d6dc 100644 --- a/utils/kamctl/kamctl.base +++ b/utils/kamctl/kamctl.base @@ -1,6 +1,24 @@ # # control tool for maintaining Kamailio # +# This file is part of Kamailio, a free SIP server. +# +# SPDX-License-Identifier: GPL-2.0-or-later +# +# Kamailio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version +# +# Kamailio is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +# #=================================================================== ##### ----------------------------------------------- ##### diff --git a/utils/kamctl/kamctl.ctlbase b/utils/kamctl/kamctl.ctlbase index 5215099a3..d6e758f15 100644 --- a/utils/kamctl/kamctl.ctlbase +++ b/utils/kamctl/kamctl.ctlbase @@ -1,6 +1,24 @@ # # control tool for maintaining Kamailio # +# This file is part of Kamailio, a free SIP server. +# +# SPDX-License-Identifier: GPL-2.0-or-later +# +# Kamailio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version +# +# Kamailio is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +# #=================================================================== [ "${IMPCTLBASE}" = "yes" ] && return @@ -103,4 +121,3 @@ cat < ..................... execute SQL query db roexec ................. execute read-only SQL query db run ......................... execute SQL query from \$id variable - db rorun ....................... execute read-only SQL query from + db rorun ....................... execute read-only SQL query from \$id variable db show
..................... display table content db showg
.................... display formatted table content diff --git a/utils/kamctl/kamctl.sqlite b/utils/kamctl/kamctl.sqlite index c2ea07171..0a9040ab9 100644 --- a/utils/kamctl/kamctl.sqlite +++ b/utils/kamctl/kamctl.sqlite @@ -2,6 +2,24 @@ # # control tool for maintaining Kamailio # +# This file is part of Kamailio, a free SIP server. +# +# SPDX-License-Identifier: GPL-2.0-or-later +# +# Kamailio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version +# +# Kamailio is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +# #=================================================================== ##### ----------------------------------------------- ##### @@ -50,4 +68,3 @@ sqlite_ro_query() { DBCMD=sqlite_query DBROCMD=sqlite_ro_query DBRAWPARAMS= - diff --git a/utils/kamctl/kamdbctl b/utils/kamctl/kamdbctl index 9c490f830..939365d7e 100755 --- a/utils/kamctl/kamdbctl +++ b/utils/kamctl/kamdbctl @@ -2,6 +2,24 @@ # # control tool for maintaining Kamailio databases # +# This file is part of Kamailio, a free SIP server. +# +# SPDX-License-Identifier: GPL-2.0-or-later +# +# Kamailio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version +# +# Kamailio is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +# #=================================================================== ### version for this script diff --git a/utils/kamctl/kamdbctl.base b/utils/kamctl/kamdbctl.base index 77d2991ef..f4b39fbda 100644 --- a/utils/kamctl/kamdbctl.base +++ b/utils/kamctl/kamdbctl.base @@ -1,3 +1,22 @@ +# +# This file is part of Kamailio, a free SIP server. +# +# SPDX-License-Identifier: GPL-2.0-or-later +# +# Kamailio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version +# +# Kamailio is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + PATH=$PATH:/usr/local/sbin # config vars diff --git a/utils/kamctl/kamdbctl.dbtext b/utils/kamctl/kamdbctl.dbtext index 8c2019ec3..289bf1faa 100644 --- a/utils/kamctl/kamdbctl.dbtext +++ b/utils/kamctl/kamdbctl.dbtext @@ -1,12 +1,24 @@ # # Script for adding and dropping Kamailio DBTEXT tables # -# History: -# 2007-02-14 Branch from mysqldb.sh script and adapt minimal capabilities(Cesc Santasusana) +# This file is part of Kamailio, a free SIP server. +# +# SPDX-License-Identifier: GPL-2.0-or-later +# +# Kamailio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version +# +# Kamailio is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # -# 2007-05-31 Move common definitions to kamdbctl.base file (henningw) -# 2007-06-13 Move database definitions out of this script, use a common -# control tool for database tasks, like the kamctl (henning) # path to the database schemas DATA_DIR="/usr/local/share/kamailio" diff --git a/utils/kamctl/kamdbctl.mysql b/utils/kamctl/kamdbctl.mysql index e5c447204..e7bc8693d 100644 --- a/utils/kamctl/kamdbctl.mysql +++ b/utils/kamctl/kamdbctl.mysql @@ -1,19 +1,24 @@ # # Script for adding and dropping Kamailio MySQL tables # -# History: -# 2006-04-07 removed gen_ha1 dependency - use md5sum; -# separated the serweb from kamailio tables; -# fixed the reinstall functionality (bogdan) -# 2006-05-16 added ability to specify MD5 from a configuration file -# FreeBSD does not have the md5sum function (norm) -# 2006-09-02 Added address table (juhe) -# 2006-10-27 subscriber table cleanup; some columns are created only if -# serweb is installed (bogdan) -# 2007-02-28 DB migration added (bogdan) -# 2007-05-21 Move SQL database definitions out of this script (henning) -# 2007-05-31 Move common definitions to kamdbctl.base file (henningw) -# 2007-06-11 Use a common control tool for database tasks, like the kamctl +# This file is part of Kamailio, a free SIP server. +# +# SPDX-License-Identifier: GPL-2.0-or-later +# +# Kamailio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version +# +# Kamailio is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +# # path to the database schemas DATA_DIR="/usr/local/share/kamailio" diff --git a/utils/kamctl/kamdbctl.oracle b/utils/kamctl/kamdbctl.oracle index e6de52f3a..7bd4722ac 100644 --- a/utils/kamctl/kamdbctl.oracle +++ b/utils/kamctl/kamdbctl.oracle @@ -2,7 +2,24 @@ # # Script for adding and dropping Kamailio Oracle tables # -# History: +# This file is part of Kamailio, a free SIP server. +# +# SPDX-License-Identifier: GPL-2.0-or-later +# +# Kamailio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version +# +# Kamailio is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +# ##In you not have 'AS SYSDBA' access to database connect, comment next string ##and Oracle administrator must create DBROOTUSER @@ -308,4 +325,3 @@ oracle_restore() fi return 0 } - diff --git a/utils/kamctl/kamdbctl.pgsql b/utils/kamctl/kamdbctl.pgsql index 5c657ad86..ae1274c29 100644 --- a/utils/kamctl/kamdbctl.pgsql +++ b/utils/kamctl/kamdbctl.pgsql @@ -1,31 +1,24 @@ # # Script for adding and dropping Kamailio Postgres tables # -# History: -# 2006-05-16 added ability to specify MD5 from a configuration file -# FreeBSD does not have the md5sum function (norm) -# 2006-07-14 Corrected syntax from MySQL to Postgres (norm) -# moved INDEX creation out of CREATE table statement into -# CREATE INDEX (usr_preferences, trusted) -# auto_increment isn't valid in Postgres, replaced with -# local AUTO_INCREMENT -# datetime isn't valid in Postgres, replaced with local DATETIME -# split GRANTs for SERWeb tables so that it is only executed -# if SERWeb tables are created -# added GRANTs for re_grp table -# added CREATE pdt table (from PDT module) -# corrected comments to indicate Postgres as opposed to MySQL -# made last_modified/created stamps consistent to now() using -# local TIMESTAMP -# 2006-10-19 Added address table (bogdan) -# 2006-10-27 subscriber table cleanup; some columns are created only if -# serweb is installed (bogdan) -# 2007-01-26 added separate installation routine for presence related tables -# and fix permissions for the SERIAL sequences. -# 2007-05-21 Move SQL database definitions out of this script (henning) -# 2007-05-31 Move common definitions to kamdbctl.base file (henningw) +# This file is part of Kamailio, a free SIP server. +# +# SPDX-License-Identifier: GPL-2.0-or-later +# +# Kamailio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version +# +# Kamailio is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # -# 2007-06-11 Use a common control tool for database tasks, like the kamctl # path to the database schemas DATA_DIR="/usr/local/share/kamailio" @@ -51,7 +44,7 @@ if [ -z "$DBROOTUSER" ]; then fi fi if [ -z "$DBCLI" ] ; then - DBCMD="psql" + DBCLI="psql" fi if [ -z "$DBROOTPORT" ] ; then diff --git a/utils/kamctl/kamdbctl.sqlite b/utils/kamctl/kamdbctl.sqlite index 1aeae559f..4a97b36eb 100644 --- a/utils/kamctl/kamdbctl.sqlite +++ b/utils/kamctl/kamdbctl.sqlite @@ -1,6 +1,24 @@ # # Script for adding and dropping Kamailio sqlite tables # +# This file is part of Kamailio, a free SIP server. +# +# SPDX-License-Identifier: GPL-2.0-or-later +# +# Kamailio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version +# +# Kamailio is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +# # path to the database schemas DATA_DIR="/usr/local/share/kamailio" diff --git a/utils/kamctl/kamdbfunc.oracle b/utils/kamctl/kamdbfunc.oracle index db71fe42c..be1967b27 100644 --- a/utils/kamctl/kamdbfunc.oracle +++ b/utils/kamctl/kamdbfunc.oracle @@ -2,7 +2,24 @@ # # Script for common functions for Oracle engine in Kamailio # -# History: +# This file is part of Kamailio, a free SIP server. +# +# SPDX-License-Identifier: GPL-2.0-or-later +# +# Kamailio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version +# +# Kamailio is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +# if [ -z "$EGREP" ]; then EGREP="egrep"