提交 2e9e9b83 编写于 作者: S Sebastian Kemper

pjproject: bump to 2.13

- bump to 2.13
- new option "--disable-libsrtp" now available so we can get rid of
  dependency on libsrtp2 (asterisk's SRTP support doesn't depend on pjproject)
- new option "--disable-upnp"
- 0007-execinfo.patch not required anymore, pjproject now checks for
  __GLIBC__
- sync patches with asterisk 20.3.0
Signed-off-by: NSebastian Kemper <sebastian_ml@gmx.net>
上级 5960523a
......@@ -10,14 +10,14 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=pjproject
PKG_VERSION:=2.12.1
PKG_RELEASE:=2
PKG_VERSION:=2.13
PKG_RELEASE:=1
# download "vX.Y.tar.gz" as "pjproject-vX.Y.tar.gz"
PKG_SOURCE_URL_FILE:=$(PKG_VERSION).tar.gz
PKG_SOURCE:=$(PKG_NAME)-$(PKG_SOURCE_URL_FILE)
PKG_SOURCE_URL:=https://github.com/pjsip/$(PKG_NAME)/archive
PKG_HASH:=d0feef6963b07934e821ba4328aecb4c36358515c1b3e507da5874555d713533
PKG_HASH:=4178bb9f586299111463fc16ea04e461adca4a73e646f8ddef61ea53dafa92d9
PKG_INSTALL:=1
PKG_LICENSE:=GPL-2.0
......@@ -71,6 +71,7 @@ CONFIGURE_ARGS+= \
--disable-ilbc-codec \
--disable-ipp \
--disable-l16-codec \
--disable-libsrtp \
--disable-libwebrtc \
--disable-libyuv \
--disable-opencore-amr \
......@@ -82,10 +83,10 @@ CONFIGURE_ARGS+= \
--disable-sound \
--disable-speex-aec \
--disable-speex-codec \
--disable-upnp \
--disable-v4l2 \
--disable-video \
--enable-shared \
--with-external-srtp="$(STAGING_DIR)/usr" \
--with-ssl="$(STAGING_DIR)/usr" \
--without-external-gsm \
--without-external-pa \
......@@ -116,10 +117,10 @@ endef
$(eval $(call PJSIPpackage,libpj,libpj,+librt))
$(eval $(call PJSIPpackage,libpjlib-util,libpjlib-util,+libpj +librt))
$(eval $(call PJSIPpackage,libpjmedia,libpjmedia*,+libpj +libpjlib-util +libpjnath +librt +libsrtp2))
$(eval $(call PJSIPpackage,libpjmedia,libpjmedia*,+libpj +libpjlib-util +libpjnath +librt))
$(eval $(call PJSIPpackage,libpjnath,libpjnath,+libpj +libpjlib-util +librt))
$(eval $(call PJSIPpackage,libpjsip-simple,libpjsip-simple,+libpj +libpjlib-util +libpjsip +librt))
$(eval $(call PJSIPpackage,libpjsip-ua,libpjsip-ua,+libpj +libpjlib-util +libpjmedia +libpjsip-simple +libpjsip +librt))
$(eval $(call PJSIPpackage,libpjsip,libpjsip,+libpj +libpjlib-util +librt +libsrtp2))
$(eval $(call PJSIPpackage,libpjsip,libpjsip,+libpj +libpjlib-util +librt))
$(eval $(call PJSIPpackage,libpjsua,libpjsua,+libpj +libpjlib-util +libpjmedia +libpjnath +libpjsip-simple +libpjsip-ua +libpjsip +librt))
$(eval $(call PJSIPpackage,libpjsua2,libpjsua2,+libpj +libpjlib-util +libpjmedia +libpjnath +libpjsip-simple +libpjsip-ua +libpjsip +librt +libpjsua))
......@@ -13,7 +13,7 @@
Description: Multimedia communication library
--- a/build.mak.in
+++ b/build.mak.in
@@ -349,6 +349,6 @@ export PJ_LIBXX_FILES := $(APP_LIBXX_FIL
@@ -352,6 +352,6 @@ export PJ_LIBXX_FILES := $(APP_LIBXX_FIL
export PJ_INSTALL_DIR := @prefix@
export PJ_INSTALL_INC_DIR := @includedir@
export PJ_INSTALL_LIB_DIR := @libdir@
......
In upstream commit b236337 unit tests were extended to print stack traces when
crashing, using GNU extensions. But this won't work with musl etc. (no
"execinfo.h"), so we need to update the condition to make sure this is only
done when glibc is used.
--- a/pjlib-util/src/pjlib-util-test/main.c
+++ b/pjlib-util/src/pjlib-util-test/main.c
@@ -33,7 +33,7 @@ static void init_signals()
sigaction(SIGALRM, &act, NULL);
}
-#elif PJ_LINUX || PJ_DARWINOS
+#elif (defined(PJ_LINUX) && PJ_LINUX!=0 && defined(__GLIBC__)) || PJ_DARWINOS
#include <execinfo.h>
#include <signal.h>
--- a/pjlib/src/pjlib-test/main.c
+++ b/pjlib/src/pjlib-test/main.c
@@ -54,7 +54,7 @@ static void init_signals()
sigaction(SIGALRM, &act, NULL);
}
-#elif PJ_LINUX || PJ_DARWINOS
+#elif (defined(PJ_LINUX) && PJ_LINUX!=0 && defined(__GLIBC__)) || PJ_DARWINOS
#include <execinfo.h>
#include <signal.h>
--- a/pjmedia/src/test/main.c
+++ b/pjmedia/src/test/main.c
@@ -32,7 +32,7 @@
#endif
-#if PJ_LINUX || PJ_DARWINOS
+#if (defined(PJ_LINUX) && PJ_LINUX!=0 && defined(__GLIBC__)) || PJ_DARWINOS
#include <execinfo.h>
#include <signal.h>
--- a/pjnath/src/pjnath-test/main.c
+++ b/pjnath/src/pjnath-test/main.c
@@ -32,7 +32,7 @@ static void init_signals()
sigaction(SIGALRM, &act, NULL);
}
-#elif PJ_LINUX || PJ_DARWINOS
+#elif (defined(PJ_LINUX) && PJ_LINUX!=0 && defined(__GLIBC__)) || PJ_DARWINOS
#include <execinfo.h>
#include <signal.h>
--- a/pjsip-apps/src/pjsua/main.c
+++ b/pjsip-apps/src/pjsua/main.c
@@ -80,7 +80,7 @@ static void setup_signal_handler(void)
SetConsoleCtrlHandler(&CtrlHandler, TRUE);
}
-#elif PJ_LINUX || PJ_DARWINOS
+#elif (defined(PJ_LINUX) && PJ_LINUX!=0 && defined(__GLIBC__)) || PJ_DARWINOS
#include <execinfo.h>
#include <signal.h>
--- a/pjsip/src/test/main.c
+++ b/pjsip/src/test/main.c
@@ -36,7 +36,7 @@ static void usage(void)
list_tests();
}
-#if PJ_LINUX || PJ_DARWINOS
+#if (defined(PJ_LINUX) && PJ_LINUX!=0 && defined(__GLIBC__)) || PJ_DARWINOS
#include <execinfo.h>
#include <signal.h>
From ac685b30c17be461b2bf5b46a772ed9742b8e985 Mon Sep 17 00:00:00 2001
From: Riza Sulistyo <trengginas@users.noreply.github.com>
Date: Thu, 9 Feb 2023 13:19:23 +0700
Subject: [PATCH] Make sure that NOTIFY tdata is set before sending it.
---
pjsip/src/pjsip-simple/evsub.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
--- a/pjsip/src/pjsip-simple/evsub.c
+++ b/pjsip/src/pjsip-simple/evsub.c
@@ -2224,9 +2224,12 @@ static void on_tsx_state_uas( pjsip_evsu
/* Send the pending NOTIFY sent by app from inside
* on_rx_refresh() callback.
*/
- pj_assert(sub->pending_notify);
- status = pjsip_evsub_send_request(sub, sub->pending_notify);
- sub->pending_notify = NULL;
+ //pj_assert(sub->pending_notify);
+ /* Make sure that pending_notify is set. */
+ if (sub->pending_notify) {
+ status = pjsip_evsub_send_request(sub, sub->pending_notify);
+ sub->pending_notify = NULL;
+ }
} else if (pjsip_method_cmp(&tsx->method, &pjsip_notify_method)==0) {
commit 8e95490e37938f45d9d812905246036c3185b94f
Author: Riza Sulistyo <trengginas@users.noreply.github.com>
Date: Thu Mar 24 12:53:03 2022 +0700
Add compile time option to allow multiple Authorization header (#3010)
--- a/pjsip/include/pjsip/sip_config.h
+++ b/pjsip/include/pjsip/sip_config.h
@@ -1280,6 +1280,18 @@ PJ_INLINE(pjsip_cfg_t*) pjsip_cfg(void)
# define PJSIP_AUTH_CNONCE_USE_DIGITS_ONLY 1
#endif
+/**
+ * Allow client to send multiple Authorization header when receiving multiple
+ * WWW-Authenticate header fields. If this is disabled, the stack will send
+ * Authorization header field containing credentials that match the
+ * topmost header field.
+ *
+ * Default is 0
+ */
+#ifndef PJSIP_AUTH_ALLOW_MULTIPLE_AUTH_HEADER
+# define PJSIP_AUTH_ALLOW_MULTIPLE_AUTH_HEADER 0
+#endif
+
/*****************************************************************************
* SIP Event framework and presence settings.
*/
@@ -1458,6 +1470,11 @@ PJ_INLINE(pjsip_cfg_t*) pjsip_cfg(void)
# define PJSIP_INV_ACCEPT_UNKNOWN_BODY PJ_FALSE
#endif
+/**
+ * Dump configuration to log with verbosity equal to info(3).
+ */
+PJ_DECL(void) pjsip_dump_config(void);
+
PJ_END_DECL
/**
--- a/pjsip/src/pjsip/sip_auth_client.c
+++ b/pjsip/src/pjsip/sip_auth_client.c
@@ -1367,7 +1367,7 @@ PJ_DEF(pj_status_t) pjsip_auth_clt_reini
chal_cnt = 0;
auth_cnt = 0;
last_auth_err = PJSIP_EAUTHNOAUTH;
- while (hdr != &rdata->msg_info.msg->hdr && auth_cnt == 0) {
+ while (hdr != &rdata->msg_info.msg->hdr) {
pjsip_cached_auth *cached_auth;
const pjsip_www_authenticate_hdr *hchal;
pjsip_authorization_hdr *hauth;
@@ -1431,6 +1431,11 @@ PJ_DEF(pj_status_t) pjsip_auth_clt_reini
/* Process next header. */
hdr = hdr->next;
auth_cnt++;
+
+#if defined(PJSIP_AUTH_ALLOW_MULTIPLE_AUTH_HEADER) && \
+ PJSIP_AUTH_ALLOW_MULTIPLE_AUTH_HEADER==0
+ break;
+#endif
}
/* Check if challenge is present */
--- a/pjsip/src/pjsip/sip_config.c
+++ b/pjsip/src/pjsip/sip_config.c
@@ -19,6 +19,9 @@
*/
#include <pjsip/sip_config.h>
+#include <pj/log.h>
+
+static const char *id = "sip_config.c";
/* pjsip configuration instance, initialized with default values */
pjsip_cfg_t pjsip_sip_cfg_var =
@@ -65,6 +68,195 @@ pjsip_cfg_t pjsip_sip_cfg_var =
}
};
+PJ_DEF(void) pjsip_dump_config(void)
+{
+ PJ_LOG(3, (id, "Dumping PJSIP configurations:"));
+ PJ_LOG(3, (id, " PJSIP_MAX_DIALOG_COUNT : %d",
+ PJSIP_MAX_DIALOG_COUNT));
+ PJ_LOG(3, (id, " PJSIP_MAX_TRANSPORTS : %d",
+ PJSIP_MAX_TRANSPORTS));
+ PJ_LOG(3, (id, " PJSIP_TPMGR_HTABLE_SIZE : %d",
+ PJSIP_TPMGR_HTABLE_SIZE));
+ PJ_LOG(3, (id, " PJSIP_MAX_URL_SIZE : %d",
+ PJSIP_MAX_URL_SIZE));
+ PJ_LOG(3, (id, " PJSIP_MAX_MODULE : %d",
+ PJSIP_MAX_MODULE));
+ PJ_LOG(3, (id, " PJSIP_MAX_PKT_LEN : %d",
+ PJSIP_MAX_PKT_LEN));
+ PJ_LOG(3, (id, " PJSIP_HANDLE_EVENTS_HAS_SLEEP_ON_ERR : %d",
+ PJSIP_HANDLE_EVENTS_HAS_SLEEP_ON_ERR));
+ PJ_LOG(3, (id, " PJSIP_ACCEPT_MULTIPLE_SDP_ANSWERS : %d",
+ PJSIP_ACCEPT_MULTIPLE_SDP_ANSWERS));
+ PJ_LOG(3, (id, " PJSIP_UDP_SIZE_THRESHOLD : %d",
+ PJSIP_UDP_SIZE_THRESHOLD));
+ PJ_LOG(3, (id, " PJSIP_INCLUDE_ALLOW_HDR_IN_DLG : %d",
+ PJSIP_INCLUDE_ALLOW_HDR_IN_DLG));
+ PJ_LOG(3, (id, " PJSIP_SAFE_MODULE : %d",
+ PJSIP_SAFE_MODULE));
+ PJ_LOG(3, (id, " PJSIP_CHECK_VIA_SENT_BY : %d",
+ PJSIP_CHECK_VIA_SENT_BY));
+ PJ_LOG(3, (id, " PJSIP_UNESCAPE_IN_PLACE : %d",
+ PJSIP_UNESCAPE_IN_PLACE));
+ PJ_LOG(3, (id, " PJSIP_MAX_NET_EVENTS : %d",
+ PJSIP_MAX_NET_EVENTS));
+ PJ_LOG(3, (id, " PJSIP_MAX_TIMED_OUT_ENTRIES : %d",
+ PJSIP_MAX_TIMED_OUT_ENTRIES));
+ PJ_LOG(3, (id, " PJSIP_TRANSPORT_IDLE_TIME : %d",
+ PJSIP_TRANSPORT_IDLE_TIME));
+ PJ_LOG(3, (id, " PJSIP_TRANSPORT_SERVER_IDLE_TIME : %d",
+ PJSIP_TRANSPORT_SERVER_IDLE_TIME));
+ PJ_LOG(3, (id, " PJSIP_MAX_TRANSPORT_USAGE : %d",
+ PJSIP_MAX_TRANSPORT_USAGE));
+ PJ_LOG(3, (id, " PJSIP_TCP_TRANSPORT_BACKLOG : %d",
+ PJSIP_TCP_TRANSPORT_BACKLOG));
+ PJ_LOG(3, (id, " PJSIP_TCP_TRANSPORT_REUSEADDR : %d",
+ PJSIP_TCP_TRANSPORT_REUSEADDR));
+ PJ_LOG(3, (id, " PJSIP_TCP_TRANSPORT_DONT_CREATE_LISTENER : %d",
+ PJSIP_TCP_TRANSPORT_DONT_CREATE_LISTENER));
+ PJ_LOG(3, (id, " PJSIP_TLS_TRANSPORT_DONT_CREATE_LISTENER : %d",
+ PJSIP_TLS_TRANSPORT_DONT_CREATE_LISTENER));
+ PJ_LOG(3, (id, " PJSIP_TCP_KEEP_ALIVE_INTERVAL : %d",
+ PJSIP_TCP_KEEP_ALIVE_INTERVAL));
+ PJ_LOG(3, (id, " PJSIP_POOL_INC_TRANSPORT : %d",
+ PJSIP_POOL_INC_TRANSPORT));
+ PJ_LOG(3, (id, " PJSIP_POOL_LEN_TDATA : %d",
+ PJSIP_POOL_LEN_TDATA));
+ PJ_LOG(3, (id, " PJSIP_POOL_INC_TDATA : %d",
+ PJSIP_POOL_INC_TDATA));
+ PJ_LOG(3, (id, " PJSIP_POOL_LEN_UA : %d",
+ PJSIP_POOL_LEN_UA));
+ PJ_LOG(3, (id, " PJSIP_POOL_INC_UA : %d",
+ PJSIP_POOL_INC_UA));
+ PJ_LOG(3, (id, " PJSIP_POOL_EVSUB_LEN : %d",
+ PJSIP_POOL_EVSUB_LEN));
+ PJ_LOG(3, (id, " PJSIP_POOL_EVSUB_INC : %d",
+ PJSIP_POOL_EVSUB_INC));
+ PJ_LOG(3, (id, " PJSIP_MAX_FORWARDS_VALUE : %d",
+ PJSIP_MAX_FORWARDS_VALUE));
+ PJ_LOG(3, (id, " PJSIP_RFC3261_BRANCH_ID : %s",
+ PJSIP_RFC3261_BRANCH_ID));
+ PJ_LOG(3, (id, " PJSIP_RFC3261_BRANCH_LEN : %d",
+ PJSIP_RFC3261_BRANCH_LEN));
+ PJ_LOG(3, (id, " PJSIP_POOL_TSX_LAYER_LEN : %d",
+ PJSIP_POOL_TSX_LAYER_LEN));
+ PJ_LOG(3, (id, " PJSIP_POOL_TSX_LAYER_INC : %d",
+ PJSIP_POOL_TSX_LAYER_INC));
+ PJ_LOG(3, (id, " PJSIP_POOL_TSX_LEN : %d",
+ PJSIP_POOL_TSX_LEN));
+ PJ_LOG(3, (id, " PJSIP_POOL_TSX_INC : %d",
+ PJSIP_POOL_TSX_INC));
+ PJ_LOG(3, (id, " PJSIP_TSX_1XX_RETRANS_DELAY : %d",
+ PJSIP_TSX_1XX_RETRANS_DELAY));
+ PJ_LOG(3, (id, " PJSIP_TSX_UAS_CONTINUE_ON_TP_ERROR : %d",
+ PJSIP_TSX_UAS_CONTINUE_ON_TP_ERROR));
+ PJ_LOG(3, (id, " PJSIP_MAX_TSX_KEY_LEN : %d",
+ PJSIP_MAX_TSX_KEY_LEN));
+ PJ_LOG(3, (id, " PJSIP_POOL_LEN_USER_AGENT : %d",
+ PJSIP_POOL_LEN_USER_AGENT));
+ PJ_LOG(3, (id, " PJSIP_POOL_INC_USER_AGENT : %d",
+ PJSIP_POOL_INC_USER_AGENT));
+ PJ_LOG(3, (id, " PJSIP_MAX_BRANCH_LEN : %d",
+ PJSIP_MAX_HNAME_LEN));
+ PJ_LOG(3, (id, " PJSIP_POOL_LEN_DIALOG : %d",
+ PJSIP_POOL_LEN_DIALOG));
+ PJ_LOG(3, (id, " PJSIP_POOL_INC_DIALOG : %d",
+ PJSIP_POOL_INC_DIALOG));
+ PJ_LOG(3, (id, " PJSIP_MAX_HEADER_TYPES : %d",
+ PJSIP_MAX_HEADER_TYPES));
+ PJ_LOG(3, (id, " PJSIP_MAX_URI_TYPES : %d",
+ PJSIP_MAX_URI_TYPES));
+ PJ_LOG(3, (id, " PJSIP_AUTH_HEADER_CACHING : %d",
+ PJSIP_AUTH_HEADER_CACHING));
+ PJ_LOG(3, (id, " PJSIP_AUTH_AUTO_SEND_NEXT : %d",
+ PJSIP_AUTH_AUTO_SEND_NEXT));
+ PJ_LOG(3, (id, " PJSIP_AUTH_QOP_SUPPORT : %d",
+ PJSIP_AUTH_QOP_SUPPORT));
+ PJ_LOG(3, (id, " PJSIP_MAX_STALE_COUNT : %d",
+ PJSIP_MAX_STALE_COUNT));
+ PJ_LOG(3, (id, " PJSIP_HAS_DIGEST_AKA_AUTH : %d",
+ PJSIP_HAS_DIGEST_AKA_AUTH));
+ PJ_LOG(3, (id, " PJSIP_REGISTER_CLIENT_DELAY_BEFORE_REFRESH : %d",
+ PJSIP_REGISTER_CLIENT_DELAY_BEFORE_REFRESH));
+ PJ_LOG(3, (id, " PJSIP_REGISTER_ALLOW_EXP_REFRESH : %d",
+ PJSIP_REGISTER_ALLOW_EXP_REFRESH));
+ PJ_LOG(3, (id, " PJSIP_AUTH_CACHED_POOL_MAX_SIZE : %d",
+ PJSIP_AUTH_CACHED_POOL_MAX_SIZE));
+ PJ_LOG(3, (id, " PJSIP_AUTH_CNONCE_USE_DIGITS_ONLY : %d",
+ PJSIP_AUTH_CNONCE_USE_DIGITS_ONLY));
+ PJ_LOG(3, (id, " PJSIP_AUTH_ALLOW_MULTIPLE_AUTH_HEADER : %d",
+ PJSIP_AUTH_ALLOW_MULTIPLE_AUTH_HEADER));
+ PJ_LOG(3, (id, " PJSIP_EVSUB_TIME_UAC_REFRESH : %d",
+ PJSIP_EVSUB_TIME_UAC_REFRESH));
+ PJ_LOG(3, (id, " PJSIP_PUBLISHC_DELAY_BEFORE_REFRESH : %d",
+ PJSIP_PUBLISHC_DELAY_BEFORE_REFRESH));
+ PJ_LOG(3, (id, " PJSIP_EVSUB_TIME_UAC_TERMINATE : %d",
+ PJSIP_EVSUB_TIME_UAC_TERMINATE));
+ PJ_LOG(3, (id, " PJSIP_EVSUB_TIME_UAC_WAIT_NOTIFY : %d",
+ PJSIP_EVSUB_TIME_UAC_WAIT_NOTIFY));
+ PJ_LOG(3, (id, " PJSIP_PRES_DEFAULT_EXPIRES : %d",
+ PJSIP_PRES_DEFAULT_EXPIRES));
+ PJ_LOG(3, (id, " PJSIP_PRES_BAD_CONTENT_RESPONSE : %d",
+ PJSIP_PRES_BAD_CONTENT_RESPONSE));
+ PJ_LOG(3, (id, " PJSIP_PRES_PIDF_ADD_TIMESTAMP : %d",
+ PJSIP_PRES_PIDF_ADD_TIMESTAMP));
+ PJ_LOG(3, (id, " PJSIP_SESS_TIMER_DEF_SE : %d",
+ PJSIP_SESS_TIMER_DEF_SE));
+ PJ_LOG(3, (id, " PJSIP_SESS_TIMER_RETRY_DELAY : %d",
+ PJSIP_SESS_TIMER_RETRY_DELAY));
+ PJ_LOG(3, (id, " PJSIP_PUBLISHC_QUEUE_REQUEST : %d",
+ PJSIP_PUBLISHC_QUEUE_REQUEST));
+ PJ_LOG(3, (id, " PJSIP_MWI_DEFAULT_EXPIRES : %d",
+ PJSIP_MWI_DEFAULT_EXPIRES));
+ PJ_LOG(3, (id, " PJSIP_HAS_TX_DATA_LIST : %d",
+ PJSIP_HAS_TX_DATA_LIST));
+ PJ_LOG(3, (id, " PJSIP_INV_ACCEPT_UNKNOWN_BODY : %d",
+ PJSIP_INV_ACCEPT_UNKNOWN_BODY));
+ PJ_LOG(3, (id, " pjsip_cfg()->endpt.allow_port_in_fromto_hdr : %d",
+ pjsip_cfg()->endpt.allow_port_in_fromto_hdr));
+ PJ_LOG(3, (id, " pjsip_cfg()->endpt.accept_replace_in_early_state : %d",
+ pjsip_cfg()->endpt.accept_replace_in_early_state));
+ PJ_LOG(3, (id, " pjsip_cfg()->endpt.allow_tx_hash_in_uri : %d",
+ pjsip_cfg()->endpt.allow_tx_hash_in_uri));
+ PJ_LOG(3, (id, " pjsip_cfg()->endpt.disable_rport : %d",
+ pjsip_cfg()->endpt.disable_rport));
+ PJ_LOG(3, (id, " pjsip_cfg()->endpt.disable_tcp_switch : %d",
+ pjsip_cfg()->endpt.disable_tcp_switch));
+ PJ_LOG(3, (id, " pjsip_cfg()->endpt.disable_tls_switch : %d",
+ pjsip_cfg()->endpt.disable_tls_switch));
+ PJ_LOG(3, (id, " pjsip_cfg()->endpt.follow_early_media_fork : %d",
+ pjsip_cfg()->endpt.follow_early_media_fork));
+ PJ_LOG(3, (id, " pjsip_cfg()->endpt.req_has_via_alias : %d",
+ pjsip_cfg()->endpt.req_has_via_alias));
+ PJ_LOG(3, (id, " pjsip_cfg()->endpt.resolve_hostname_to_get_interface:%d",
+ pjsip_cfg()->endpt.resolve_hostname_to_get_interface));
+ PJ_LOG(3, (id, " pjsip_cfg()->endpt.disable_secure_dlg_check : %d",
+ pjsip_cfg()->endpt.disable_secure_dlg_check));
+ PJ_LOG(3, (id, " pjsip_cfg()->endpt.use_compact_form : %d",
+ pjsip_cfg()->endpt.use_compact_form));
+ PJ_LOG(3, (id, " pjsip_cfg()->endpt.accept_multiple_sdp_answers : %d",
+ pjsip_cfg()->endpt.accept_multiple_sdp_answers));
+ PJ_LOG(3, (id, " pjsip_cfg()->endpt.keep_inv_after_tsx_timeout : %d",
+ pjsip_cfg()->endpt.keep_inv_after_tsx_timeout));
+ PJ_LOG(3, (id, " pjsip_cfg()->tsx.max_count : %d",
+ pjsip_cfg()->tsx.max_count));
+ PJ_LOG(3, (id, " pjsip_cfg()->tsx.t1 : %d",
+ pjsip_cfg()->tsx.t1));
+ PJ_LOG(3, (id, " pjsip_cfg()->tsx.t2 : %d",
+ pjsip_cfg()->tsx.t2));
+ PJ_LOG(3, (id, " pjsip_cfg()->tsx.t4 : %d",
+ pjsip_cfg()->tsx.t4));
+ PJ_LOG(3, (id, " pjsip_cfg()->td : %d",
+ pjsip_cfg()->tsx.td));
+ PJ_LOG(3, (id, " pjsip_cfg()->regc.check_contact : %d",
+ pjsip_cfg()->regc.check_contact));
+ PJ_LOG(3, (id, " pjsip_cfg()->regc.add_xuid_param : %d",
+ pjsip_cfg()->regc.add_xuid_param));
+ PJ_LOG(3, (id, " pjsip_cfg()->tcp.keep_alive_interval : %d",
+ pjsip_cfg()->tcp.keep_alive_interval));
+ PJ_LOG(3, (id, " pjsip_cfg()->tls.keep_alive_interval : %d",
+ pjsip_cfg()->tls.keep_alive_interval));
+}
+
#ifdef PJ_DLL
PJ_DEF(pjsip_cfg_t*) pjsip_cfg(void)
--- a/pjsip/src/pjsua-lib/pjsua_core.c
+++ b/pjsip/src/pjsua-lib/pjsua_core.c
@@ -3443,8 +3443,10 @@ PJ_DEF(void) pjsua_dump(pj_bool_t detail
old_decor = pj_log_get_decor();
pj_log_set_decor(old_decor & (PJ_LOG_HAS_NEWLINE | PJ_LOG_HAS_CR));
- if (detail)
+ if (detail) {
pj_dump_config();
+ pjsip_dump_config();
+ }
pjsip_endpt_dump(pjsua_get_pjsip_endpt(), detail);
--- a/tests/pjsua/inc_sip.py
+++ b/tests/pjsua/inc_sip.py
@@ -306,9 +306,11 @@ class RecvfromTransaction:
body = None
# Pattern to be expected on pjsua when receiving the response
expect = ""
+ # Required config
+ pj_config = ""
def __init__(self, title, resp_code, check_cseq=True,
- include=[], exclude=[], cmds=[], resp_hdr=[], resp_body=None, expect=""):
+ include=[], exclude=[], cmds=[], resp_hdr=[], resp_body=None, expect="", pj_config=""):
self.title = title
self.cmds = cmds
self.include = include
@@ -317,6 +319,7 @@ class RecvfromTransaction:
self.resp_hdr = resp_hdr
self.body = resp_body
self.expect = expect
+ self.pj_config=pj_config
class RecvfromCfg:
@@ -328,15 +331,18 @@ class RecvfromCfg:
transaction = None
# Use TCP?
tcp = False
+ # Required config
+ pj_config = ""
# Note:
# Any "$PORT" string in the pjsua_args will be replaced
# by server port
- def __init__(self, name, pjsua_args, transaction, tcp=False):
+ def __init__(self, name, pjsua_args, transaction, tcp=False, pj_config=""):
self.name = name
self.inst_param = cfg.InstanceParam("pjsua", pjsua_args)
self.transaction = transaction
self.tcp=tcp
+ self.pj_config=pj_config
--- a/tests/pjsua/mod_recvfrom.py
+++ b/tests/pjsua/mod_recvfrom.py
@@ -18,10 +18,20 @@ def test_func(test):
local_port=srv_port,
tcp=cfg_file.recvfrom_cfg.tcp)
+ config = pjsua.get_config(cfg_file.recvfrom_cfg.pj_config)
+ print "Config : " + config
+
last_cseq = 0
last_method = ""
last_call_id = ""
for t in cfg_file.recvfrom_cfg.transaction:
+ # Check if transaction requires configuration
+ if t.pj_config != "":
+ r = re.compile(t.pj_config, re.I)
+ if r.search(config) == None:
+ print "Configuration : " + t.pj_config + " not found, skipping"
+ continue
+
# Print transaction title
if t.title != "":
dlg.trace(t.title)
--- a/tests/pjsua/run.py
+++ b/tests/pjsua/run.py
@@ -249,6 +249,10 @@ class Expect(threading.Thread):
time.sleep(0.01)
return None
+ def get_config(self, key_config):
+ self.send("dd")
+ line = self.expect(key_config);
+ return line
def sync_stdout(self):
if not self.use_telnet:
--- a/tests/pjsua/scripts-recvfrom/215_reg_good_multi_ok.py
+++ b/tests/pjsua/scripts-recvfrom/215_reg_good_multi_ok.py
@@ -14,16 +14,27 @@ req1 = sip.RecvfromTransaction("Initial
expect="SIP/2.0 401"
)
-req2 = sip.RecvfromTransaction("Registration retry with auth", 200,
+req2 = sip.RecvfromTransaction("Registration retry with auth (not allowed multiple auth)", 200,
include=["REGISTER sip",
- # Must only have 1 Auth hdr since #2887
"Authorization:", # [\\s\\S]+Authorization:"
"realm=\"python1\"", # "realm=\"python2\"",
"username=\"theuser1\"", # "username=\"theuser2\"",
"nonce=\"1234\"", # "nonce=\"6789\"",
"response="],
- expect="registration success"
+ expect="registration success",
+ pj_config="PJSIP_AUTH_ALLOW_MULTIPLE_AUTH_HEADER.*: 0"
)
+req3 = sip.RecvfromTransaction("Registration retry with auth (allowed multiple auth)", 200,
+ include=["REGISTER sip",
+ "Authorization:[\\s\\S]+Authorization:", # Must have 2 Auth hdrs
+ "realm=\"python1\"", "realm=\"python2\"",
+ "username=\"theuser1\"", "username=\"theuser2\"",
+ "nonce=\"1234\"", "nonce=\"6789\"",
+ "response="],
+ expect="registration success",
+ pj_config="PJSIP_AUTH_ALLOW_MULTIPLE_AUTH_HEADER.*: 1"
+ )
+
recvfrom_cfg = sip.RecvfromCfg("Multiple authentication challenges",
- pjsua, [req1, req2])
+ pjsua, [req1, req2, req3], pj_config="PJSIP_AUTH_ALLOW_MULTIPLE_AUTH_HEADER")
From c4d34984ec92b3d5252a7d5cddd85a1d3a8001ae Mon Sep 17 00:00:00 2001
From: sauwming <ming@teluu.com>
Date: Mon, 3 Oct 2022 08:07:22 +0800
Subject: [PATCH] Merge pull request from GHSA-fq45-m3f7-3mhj
* Initial patch
* Use 'pj_scan_is_eof(scanner)'
Co-authored-by: Aaron Lichtman <aaronlichtman@gmail.com>
* Use 'pj_scan_is_eof(scanner)'
Co-authored-by: Aaron Lichtman <aaronlichtman@gmail.com>
* Use 'pj_scan_is_eof(scanner)'
Co-authored-by: Aaron Lichtman <aaronlichtman@gmail.com>
* Use `!pj_scan_is_eof` instead of manually checking `scanner->curptr < scanner->end`
Co-authored-by: Maksim Mukosey <mmukosey@gmail.com>
* Update pjlib-util/src/pjlib-util/scanner.c
Co-authored-by: Aaron Lichtman <aaronlichtman@gmail.com>
* Update pjlib-util/src/pjlib-util/scanner.c
Co-authored-by: Aaron Lichtman <aaronlichtman@gmail.com>
* Update pjlib-util/src/pjlib-util/scanner.c
Co-authored-by: Aaron Lichtman <aaronlichtman@gmail.com>
* Revert '>=' back to '>' in pj_scan_stricmp_alnum()
* Fix error compiles.
Co-authored-by: Nanang Izzuddin <nanang@teluu.com>
Co-authored-by: Aaron Lichtman <aaronlichtman@gmail.com>
Co-authored-by: Maksim Mukosey <mmukosey@gmail.com>
---
pjlib-util/src/pjlib-util/scanner.c | 41 +++++++++++++++++++----------
pjmedia/src/pjmedia/rtp.c | 11 +++++---
pjmedia/src/pjmedia/sdp.c | 24 ++++++++++-------
3 files changed, 48 insertions(+), 28 deletions(-)
--- a/pjlib-util/src/pjlib-util/scanner.c
+++ b/pjlib-util/src/pjlib-util/scanner.c
@@ -195,7 +195,13 @@ PJ_DEF(void) pj_scan_skip_whitespace( pj
PJ_DEF(void) pj_scan_skip_line( pj_scanner *scanner )
{
- char *s = pj_memchr(scanner->curptr, '\n', scanner->end - scanner->curptr);
+ char *s;
+
+ if (pj_scan_is_eof(scanner)) {
+ return;
+ }
+
+ s = pj_memchr(scanner->curptr, '\n', scanner->end - scanner->curptr);
if (!s) {
scanner->curptr = scanner->end;
} else {
@@ -264,8 +270,7 @@ PJ_DEF(void) pj_scan_get( pj_scanner *sc
pj_assert(pj_cis_match(spec,0)==0);
- /* EOF is detected implicitly */
- if (!pj_cis_match(spec, *s)) {
+ if (pj_scan_is_eof(scanner) || !pj_cis_match(spec, *s)) {
pj_scan_syntax_err(scanner);
return;
}
@@ -299,8 +304,7 @@ PJ_DEF(void) pj_scan_get_unescape( pj_sc
/* Must not match character '%' */
pj_assert(pj_cis_match(spec,'%')==0);
- /* EOF is detected implicitly */
- if (!pj_cis_match(spec, *s) && *s != '%') {
+ if (pj_scan_is_eof(scanner) || !pj_cis_match(spec, *s) && *s != '%') {
pj_scan_syntax_err(scanner);
return;
}
@@ -436,7 +440,9 @@ PJ_DEF(void) pj_scan_get_n( pj_scanner *
scanner->curptr += N;
- if (PJ_SCAN_IS_PROBABLY_SPACE(*scanner->curptr) && scanner->skip_ws) {
+ if (!pj_scan_is_eof(scanner) &&
+ PJ_SCAN_IS_PROBABLY_SPACE(*scanner->curptr) && scanner->skip_ws)
+ {
pj_scan_skip_whitespace(scanner);
}
}
@@ -467,15 +473,16 @@ PJ_DEF(int) pj_scan_get_char( pj_scanner
PJ_DEF(void) pj_scan_get_newline( pj_scanner *scanner )
{
- if (!PJ_SCAN_IS_NEWLINE(*scanner->curptr)) {
+ if (pj_scan_is_eof(scanner) || !PJ_SCAN_IS_NEWLINE(*scanner->curptr)) {
pj_scan_syntax_err(scanner);
return;
}
+ /* We have checked scanner->curptr validity above */
if (*scanner->curptr == '\r') {
++scanner->curptr;
}
- if (*scanner->curptr == '\n') {
+ if (!pj_scan_is_eof(scanner) && *scanner->curptr == '\n') {
++scanner->curptr;
}
@@ -520,7 +527,9 @@ PJ_DEF(void) pj_scan_get_until( pj_scann
scanner->curptr = s;
- if (PJ_SCAN_IS_PROBABLY_SPACE(*s) && scanner->skip_ws) {
+ if (!pj_scan_is_eof(scanner) && PJ_SCAN_IS_PROBABLY_SPACE(*s) &&
+ scanner->skip_ws)
+ {
pj_scan_skip_whitespace(scanner);
}
}
@@ -544,7 +553,9 @@ PJ_DEF(void) pj_scan_get_until_ch( pj_sc
scanner->curptr = s;
- if (PJ_SCAN_IS_PROBABLY_SPACE(*s) && scanner->skip_ws) {
+ if (!pj_scan_is_eof(scanner) && PJ_SCAN_IS_PROBABLY_SPACE(*s) &&
+ scanner->skip_ws)
+ {
pj_scan_skip_whitespace(scanner);
}
}
@@ -570,7 +581,9 @@ PJ_DEF(void) pj_scan_get_until_chr( pj_s
scanner->curptr = s;
- if (PJ_SCAN_IS_PROBABLY_SPACE(*s) && scanner->skip_ws) {
+ if (!pj_scan_is_eof(scanner) && PJ_SCAN_IS_PROBABLY_SPACE(*s) &&
+ scanner->skip_ws)
+ {
pj_scan_skip_whitespace(scanner);
}
}
@@ -585,7 +598,9 @@ PJ_DEF(void) pj_scan_advance_n( pj_scann
scanner->curptr += N;
- if (PJ_SCAN_IS_PROBABLY_SPACE(*scanner->curptr) && skip_ws) {
+ if (!pj_scan_is_eof(scanner) &&
+ PJ_SCAN_IS_PROBABLY_SPACE(*scanner->curptr) && skip_ws)
+ {
pj_scan_skip_whitespace(scanner);
}
}
@@ -636,5 +651,3 @@ PJ_DEF(void) pj_scan_restore_state( pj_s
scanner->line = state->line;
scanner->start_line = state->start_line;
}
-
-
--- a/pjmedia/src/pjmedia/rtp.c
+++ b/pjmedia/src/pjmedia/rtp.c
@@ -188,6 +188,11 @@ PJ_DEF(pj_status_t) pjmedia_rtp_decode_r
/* Payload is located right after header plus CSRC */
offset = sizeof(pjmedia_rtp_hdr) + ((*hdr)->cc * sizeof(pj_uint32_t));
+ /* Check that offset is less than packet size */
+ if (offset >= pkt_len) {
+ return PJMEDIA_RTP_EINLEN;
+ }
+
/* Decode RTP extension. */
if ((*hdr)->x) {
if (offset + sizeof (pjmedia_rtp_ext_hdr) > (unsigned)pkt_len)
@@ -202,8 +207,8 @@ PJ_DEF(pj_status_t) pjmedia_rtp_decode_r
dec_hdr->ext_len = 0;
}
- /* Check that offset is less than packet size */
- if (offset > pkt_len)
+ /* Check again that offset is still less than packet size */
+ if (offset >= pkt_len)
return PJMEDIA_RTP_EINLEN;
/* Find and set payload. */
@@ -393,5 +398,3 @@ void pjmedia_rtp_seq_update( pjmedia_rtp
seq_status->status.value = st.status.value;
}
}
-
-
--- a/pjmedia/src/pjmedia/sdp.c
+++ b/pjmedia/src/pjmedia/sdp.c
@@ -983,13 +983,13 @@ static void parse_version(pj_scanner *sc
ctx->last_error = PJMEDIA_SDP_EINVER;
/* check equal sign */
- if (*(scanner->curptr+1) != '=') {
+ if (scanner->curptr+1 >= scanner->end || *(scanner->curptr+1) != '=') {
on_scanner_error(scanner);
return;
}
/* check version is 0 */
- if (*(scanner->curptr+2) != '0') {
+ if (scanner->curptr+2 >= scanner->end || *(scanner->curptr+2) != '0') {
on_scanner_error(scanner);
return;
}
@@ -1006,7 +1006,7 @@ static void parse_origin(pj_scanner *sca
ctx->last_error = PJMEDIA_SDP_EINORIGIN;
/* check equal sign */
- if (*(scanner->curptr+1) != '=') {
+ if (scanner->curptr+1 >= scanner->end || *(scanner->curptr+1) != '=') {
on_scanner_error(scanner);
return;
}
@@ -1052,7 +1052,7 @@ static void parse_time(pj_scanner *scann
ctx->last_error = PJMEDIA_SDP_EINTIME;
/* check equal sign */
- if (*(scanner->curptr+1) != '=') {
+ if (scanner->curptr+1 >= scanner->end || *(scanner->curptr+1) != '=') {
on_scanner_error(scanner);
return;
}
@@ -1080,7 +1080,7 @@ static void parse_generic_line(pj_scanne
ctx->last_error = PJMEDIA_SDP_EINSDP;
/* check equal sign */
- if (*(scanner->curptr+1) != '=') {
+ if ((scanner->curptr+1 >= scanner->end) || *(scanner->curptr+1) != '=') {
on_scanner_error(scanner);
return;
}
@@ -1149,7 +1149,7 @@ static void parse_media(pj_scanner *scan
ctx->last_error = PJMEDIA_SDP_EINMEDIA;
/* check the equal sign */
- if (*(scanner->curptr+1) != '=') {
+ if (scanner->curptr+1 >= scanner->end || *(scanner->curptr+1) != '=') {
on_scanner_error(scanner);
return;
}
@@ -1164,6 +1164,10 @@ static void parse_media(pj_scanner *scan
/* port */
pj_scan_get(scanner, &cs_token, &str);
med->desc.port = (unsigned short)pj_strtoul(&str);
+ if (pj_scan_is_eof(scanner)) {
+ on_scanner_error(scanner);
+ return;
+ }
if (*scanner->curptr == '/') {
/* port count */
pj_scan_get_char(scanner);
@@ -1175,7 +1179,7 @@ static void parse_media(pj_scanner *scan
}
if (pj_scan_get_char(scanner) != ' ') {
- PJ_THROW(SYNTAX_ERROR);
+ on_scanner_error(scanner);
}
/* transport */
@@ -1183,7 +1187,7 @@ static void parse_media(pj_scanner *scan
/* format list */
med->desc.fmt_count = 0;
- while (*scanner->curptr == ' ') {
+ while (scanner->curptr < scanner->end && *scanner->curptr == ' ') {
pj_str_t fmt;
pj_scan_get_char(scanner);
@@ -1223,7 +1227,7 @@ static pjmedia_sdp_attr *parse_attr( pj_
attr = PJ_POOL_ALLOC_T(pool, pjmedia_sdp_attr);
/* check equal sign */
- if (*(scanner->curptr+1) != '=') {
+ if (scanner->curptr+1 >= scanner->end || *(scanner->curptr+1) != '=') {
on_scanner_error(scanner);
return NULL;
}
@@ -1242,7 +1246,7 @@ static pjmedia_sdp_attr *parse_attr( pj_
pj_scan_get_char(scanner);
/* get value */
- if (*scanner->curptr != '\r' && *scanner->curptr != '\n') {
+ if (!pj_scan_is_eof(scanner) && *scanner->curptr != '\r' && *scanner->curptr != '\n') {
pj_scan_get_until_chr(scanner, "\r\n", &attr->value);
} else {
attr->value.ptr = NULL;
From 450baca94f475345542c6953832650c390889202 Mon Sep 17 00:00:00 2001
From: sauwming <ming@teluu.com>
Date: Tue, 7 Jun 2022 12:00:13 +0800
Subject: [PATCH] Merge pull request from GHSA-26j7-ww69-c4qj
---
pjlib-util/src/pjlib-util/stun_simple.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
--- a/pjlib-util/src/pjlib-util/stun_simple.c
+++ b/pjlib-util/src/pjlib-util/stun_simple.c
@@ -54,6 +54,7 @@ PJ_DEF(pj_status_t) pjstun_parse_msg( vo
{
pj_uint16_t msg_type, msg_len;
char *p_attr;
+ int attr_max_cnt = PJ_ARRAY_SIZE(msg->attr);
PJ_CHECK_STACK();
@@ -83,7 +84,7 @@ PJ_DEF(pj_status_t) pjstun_parse_msg( vo
msg->attr_count = 0;
p_attr = (char*)buf + sizeof(pjstun_msg_hdr);
- while (msg_len > 0) {
+ while (msg_len > 0 && msg->attr_count < attr_max_cnt) {
pjstun_attr_hdr **attr = &msg->attr[msg->attr_count];
pj_uint32_t len;
pj_uint16_t attr_type;
@@ -111,6 +112,10 @@ PJ_DEF(pj_status_t) pjstun_parse_msg( vo
p_attr += len;
++msg->attr_count;
}
+ if (msg->attr_count == attr_max_cnt) {
+ PJ_LOG(4, (THIS_FILE, "Warning: max number attribute %d reached.",
+ attr_max_cnt));
+ }
return PJ_SUCCESS;
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册