summaryrefslogtreecommitdiff
path: root/net-libs/pjproject
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2021-03-12 21:55:15 +0000
committerV3n3RiX <venerix@redcorelinux.org>2021-03-12 21:55:15 +0000
commit7218e1b46bceac05841e90472501742d905fb3fc (patch)
tree56fae051db521b8fce8014cbc8b11484885b14b3 /net-libs/pjproject
parent6d691ad5b6239929063441bbd14c489e92e7396e (diff)
gentoo resync : 12.03.2021
Diffstat (limited to 'net-libs/pjproject')
-rw-r--r--net-libs/pjproject/Manifest4
-rw-r--r--net-libs/pjproject/files/pjproject-2.10-CVE-2020-15260-tls-hostname-check.patch125
-rw-r--r--net-libs/pjproject/files/pjproject-2.10-CVE-2021-21375-negotiation-failure-crash.patch45
-rw-r--r--net-libs/pjproject/files/pjproject-2.10-race-condition-between-transport-destroy-and-acquire.patch108
-rw-r--r--net-libs/pjproject/pjproject-2.10-r1.ebuild125
5 files changed, 407 insertions, 0 deletions
diff --git a/net-libs/pjproject/Manifest b/net-libs/pjproject/Manifest
index 0d5b57b90fb0..0b39c015b73a 100644
--- a/net-libs/pjproject/Manifest
+++ b/net-libs/pjproject/Manifest
@@ -1,3 +1,6 @@
+AUX pjproject-2.10-CVE-2020-15260-tls-hostname-check.patch 4724 BLAKE2B a098969ca78f538848a6616d6168dc74dc4d6c09f348e0e6436089341827346f52c3feb43a4de13453df940cad65b02f650c9e3cdfae4b449da0a5140e0fda54 SHA512 49846fd649f664ce29098800d4f9acee95ac4c06ff5499495b5bcc78269a33e9e66e9df126755aba9c48481c3a87040ff0a6bf1e4fc64bdf0492c55d428978f0
+AUX pjproject-2.10-CVE-2021-21375-negotiation-failure-crash.patch 1564 BLAKE2B 30f7af19ae18c071b62e31a6a049e4e67f7b391a65ab52ef8d5270ef504a4057b35679c580ba056c9b1b3e5813fde5ccc8ca863bead4f62156e39f8c2947e4d2 SHA512 9fb5b8961e7c69cf8a902eaa28cb2147faf8f0809467911454758b793832831240992a3c27ecb722a4ea066df909c0cf12b4b1bf139037f647828eb4cc16fee0
+AUX pjproject-2.10-race-condition-between-transport-destroy-and-acquire.patch 3929 BLAKE2B fc7e12b7e8e9ff35556aa153496c2f7decd13bc78493d8c6f24449f063fe9c76b1772f6dc2b6cfc279c9731cc08735b27cd990ac6c4648c18e7f08c2c9fc3810 SHA512 e230041cff87d97947ad8caeb80c4858b8a1d435251d79b281fc0035da04aab549d1d5dc085681d98410da7e37359bb2ed721d132b321cce9a7326e4ff52c40f
AUX pjproject-2.7.2-libressl.patch 3446 BLAKE2B 47b21f621ffd1990e276459d9692ed7e8a083b93fc8dd0f44225af7cbf8f8390f9790efd61c8c790a0f20da64cb7f47db4fd83a8f0604de9a1bce30d54b3079f SHA512 173fc80e85673c4036b433cbf8152c58862d4716d4d98688cfaebf4c5ed3df76b8d4893709577c1dfff82a02baeeb0220dcae1dafc2e69ea9472056727b0d0fc
AUX pjproject-2.7.2-ssl-flipflop.patch 4336 BLAKE2B 999150475bd24989f64bb718d082ff1c40d5ba383103371550d2c682578a9c57d58b4029e512ac5a064fae3a526bd6e62fb645ba45b4067c47fd148bcce668aa SHA512 438a61353c0200d3f230b81cc13f565a178d078b4580aa468a9241b5b95f5a2336d039f4aaf99cd57e7b1042f4c0a1cafd00c29191e36c08f2194d984811b8d6
AUX pjproject-2.9-config_site.h 2168 BLAKE2B 39d526e7a2ca79ea2c1e453d95d420a6245e7a93641227a908660fea553a8b66d5dfb6b7108b49dc0686de6522c2485b72a6e7511096cbfe50bdb2800d559e6f SHA512 d6456b7fa36b3256613eea515b78f0884fa6b56705817cd421a962f3c3302bf0efa69006432dffca49400ef75dc99ebc7639d270aebe5bc2d4a9a9515cc56408
@@ -5,6 +8,7 @@ AUX pjproject-2.9-ssl-enable.patch 3515 BLAKE2B d68479ba509513828d8488b60358ba00
DIST pjproject-2.10.tar.gz 8768705 BLAKE2B 42d70867e2e0474313426f1e188586d203d6165c28a133a62dedacd2deb2899215212824d9402a48fcc66bb08a17b796d3625e1d51a8aedc9aa4b3a3bf1cb8fa SHA512 a67f083df175b536b4e6a7b7fe39e07d3ee805d6917ec64a50694542a7455c33a100889191044ab3fa679b6656774a6be045621aa53510b5f04cdde9ddd59893
DIST pjproject-2.7.2.tar.bz2 4994233 BLAKE2B 44ecaf0997d5dd9b18e0b811cead7c9104e63894fa06fb1d64e79b60fa4210968fd90ef47e5f5be3629675363c8756ce3bc1834caa9700654ab4c53efe676ee7 SHA512 3d355ffcbbeed62cfc711e574a987dc06043ccf4f2625820adffa89167022b8306fcee3fada71d3d45e7b902fc9c65ac8221de101cbafed25362a3921f702afd
DIST pjproject-2.9.tar.bz2 5009546 BLAKE2B 853f86e57c0f58943e977856bebc7dc20684ac4a6a16a55f3fe4ddf58ca58187bdc1011c5df2bc72de690f1695484012b582e56dd0e88a624ef319a5f3623772 SHA512 a65823a86ad0cd76890cf7dd2485f7547fd90aea2ef631c5420c009b35f39eda3b78551a42fc2816c2470de9eb728c26497774a8494824472ecaa1d2889cc20b
+EBUILD pjproject-2.10-r1.ebuild 3401 BLAKE2B 8b5cfd130ae21d8fd48c0365c8e4848255dd36f748552911047c53e38ca0f691bcbe13f810fd56f6310d59fb1c095aa2fb6e5dcb8c4d2ec22a24fb2c212cf69a SHA512 0ff637daf4776ba9520b8c6c7f585791336377ce2126ec757f660733ade933a8f189b405010c92909fc9c1e8c664ea6fdf5e4b438e8b56abc4ac82b27100dfe1
EBUILD pjproject-2.10.ebuild 3159 BLAKE2B 5ece2e1494f3c116db79c04c687cee76c629d91784f8056c7056edc9989fded215464b59e4f4a93ed57433708715820ea4c475c1bcf6922134cb04b81e88ee4c SHA512 81d0eae10cff044d40fbdc2d7caa41d121ded8c7a1b29e8ab4698a724b9a73366442eb3652c7a234dd5cea65e43a8c2636ad862d8f1dc1493786489ee994570a
EBUILD pjproject-2.7.2-r2.ebuild 2754 BLAKE2B e26d384028d5a0211c48963100f55daa7df626b39d4d64d25d7c60adc33b2925c1f4c61af822699977a8c07cb437c227990e33a53f98eabeb058cfc111b37557 SHA512 1c1b9856f09f6bae89f3da0ed8b5a622a84402bb3f663b8fc1e9d4f435700e157511ae120fb074fa7bf02df6b031cce138c1c288649751bbc84263e39cf36361
EBUILD pjproject-2.9-r2.ebuild 3139 BLAKE2B a99817e6681eb3afdef894148d8f864839c92042219d7c4c7ecee832b77de2f59c0f2c2412f1508e2572ed1b0d665d304386bd9e99ee7de9e4cd34c7a085ec88 SHA512 ca61e9530f5a5ce630aa31b1d077236a9fb565bb9c70ab0171f3663a2ad7a2813e967c1581e07b0f18945587c34da061aae6504e390b2b472c9e58775b913621
diff --git a/net-libs/pjproject/files/pjproject-2.10-CVE-2020-15260-tls-hostname-check.patch b/net-libs/pjproject/files/pjproject-2.10-CVE-2020-15260-tls-hostname-check.patch
new file mode 100644
index 000000000000..0d7df686a157
--- /dev/null
+++ b/net-libs/pjproject/files/pjproject-2.10-CVE-2020-15260-tls-hostname-check.patch
@@ -0,0 +1,125 @@
+From 67e46c1ac45ad784db5b9080f5ed8b133c122872 Mon Sep 17 00:00:00 2001
+From: sauwming <ming@teluu.com>
+Date: Mon, 8 Mar 2021 17:39:36 +0800
+Subject: [PATCH] Merge pull request from GHSA-8hcp-hm38-mfph
+
+* Check hostname during TLS transport selection
+
+* revision based on feedback
+
+* remove the code in create_request that has been moved
+---
+ pjsip/include/pjsip/sip_dialog.h | 1 +
+ pjsip/src/pjsip/sip_dialog.c | 15 +++++++++++++++
+ pjsip/src/pjsip/sip_transport.c | 13 +++++++++++++
+ pjsip/src/pjsip/sip_util.c | 11 ++++++++---
+ 4 files changed, 37 insertions(+), 3 deletions(-)
+
+diff --git a/pjsip/include/pjsip/sip_dialog.h b/pjsip/include/pjsip/sip_dialog.h
+index a0214d28c..e314c2ece 100644
+--- a/pjsip/include/pjsip/sip_dialog.h
++++ b/pjsip/include/pjsip/sip_dialog.h
+@@ -165,6 +165,7 @@ struct pjsip_dialog
+ pjsip_route_hdr route_set; /**< Route set. */
+ pj_bool_t route_set_frozen; /**< Route set has been set. */
+ pjsip_auth_clt_sess auth_sess; /**< Client authentication session. */
++ pj_str_t initial_dest;/**< Initial destination host. */
+
+ /** Session counter. */
+ int sess_count; /**< Number of sessions. */
+diff --git a/pjsip/src/pjsip/sip_dialog.c b/pjsip/src/pjsip/sip_dialog.c
+index 27530e4f2..9571b5a35 100644
+--- a/pjsip/src/pjsip/sip_dialog.c
++++ b/pjsip/src/pjsip/sip_dialog.c
+@@ -467,6 +467,10 @@ pj_status_t create_uas_dialog( pjsip_user_agent *ua,
+
+ /* Save the remote info. */
+ pj_strdup(dlg->pool, &dlg->remote.info_str, &tmp);
++
++ /* Save initial destination host from transport's info */
++ pj_strdup(dlg->pool, &dlg->initial_dest,
++ &rdata->tp_info.transport->remote_name.host);
+
+
+ /* Init remote's contact from Contact header.
+@@ -1192,6 +1196,12 @@ static pj_status_t dlg_create_request_throw( pjsip_dialog *dlg,
+ return status;
+ }
+
++ /* Copy the initial destination host to tdata. This information can be
++ * used later by transport for transport selection.
++ */
++ if (dlg->initial_dest.slen)
++ pj_strdup(tdata->pool, &tdata->dest_info.name, &dlg->initial_dest);
++
+ /* Done. */
+ *p_tdata = tdata;
+
+@@ -1822,6 +1832,11 @@ static void dlg_update_routeset(pjsip_dialog *dlg, const pjsip_rx_data *rdata)
+ * transaction as the initial transaction that establishes dialog.
+ */
+ if (dlg->role == PJSIP_ROLE_UAC) {
++ /* Save initial destination host from transport's info. */
++ if (!dlg->initial_dest.slen) {
++ pj_strdup(dlg->pool, &dlg->initial_dest,
++ &rdata->tp_info.transport->remote_name.host);
++ }
+
+ /* Ignore subsequent request from remote */
+ if (msg->type != PJSIP_RESPONSE_MSG)
+diff --git a/pjsip/src/pjsip/sip_transport.c b/pjsip/src/pjsip/sip_transport.c
+index bef6d24fe..177274b08 100644
+--- a/pjsip/src/pjsip/sip_transport.c
++++ b/pjsip/src/pjsip/sip_transport.c
+@@ -2335,6 +2335,19 @@ PJ_DEF(pj_status_t) pjsip_tpmgr_acquire_transport2(pjsip_tpmgr *mgr,
+ if (!tp_iter->tp->is_shutdown &&
+ !tp_iter->tp->is_destroying)
+ {
++ if ((type & PJSIP_TRANSPORT_SECURE) && tdata) {
++ /* For secure transport, make sure tdata's
++ * destination host matches the transport's
++ * remote host.
++ */
++ if (pj_stricmp(&tdata->dest_info.name,
++ &tp_iter->tp->remote_name.host))
++ {
++ tp_iter = tp_iter->next;
++ continue;
++ }
++ }
++
+ if (sel && sel->type == PJSIP_TPSELECTOR_LISTENER &&
+ sel->u.listener)
+ {
+diff --git a/pjsip/src/pjsip/sip_util.c b/pjsip/src/pjsip/sip_util.c
+index a1bf878ea..cf916805d 100644
+--- a/pjsip/src/pjsip/sip_util.c
++++ b/pjsip/src/pjsip/sip_util.c
+@@ -1417,7 +1417,10 @@ PJ_DEF(pj_status_t) pjsip_endpt_send_request_stateless(pjsip_endpoint *endpt,
+ */
+ if (tdata->dest_info.addr.count == 0) {
+ /* Copy the destination host name to TX data */
+- pj_strdup(tdata->pool, &tdata->dest_info.name, &dest_info.addr.host);
++ if (!tdata->dest_info.name.slen) {
++ pj_strdup(tdata->pool, &tdata->dest_info.name,
++ &dest_info.addr.host);
++ }
+
+ pjsip_endpt_resolve( endpt, tdata->pool, &dest_info, stateless_data,
+ &stateless_send_resolver_callback);
+@@ -1810,8 +1813,10 @@ PJ_DEF(pj_status_t) pjsip_endpt_send_response( pjsip_endpoint *endpt,
+ }
+ } else {
+ /* Copy the destination host name to TX data */
+- pj_strdup(tdata->pool, &tdata->dest_info.name,
+- &res_addr->dst_host.addr.host);
++ if (!tdata->dest_info.name.slen) {
++ pj_strdup(tdata->pool, &tdata->dest_info.name,
++ &res_addr->dst_host.addr.host);
++ }
+
+ pjsip_endpt_resolve(endpt, tdata->pool, &res_addr->dst_host,
+ send_state, &send_response_resolver_cb);
+--
+2.26.2
+
diff --git a/net-libs/pjproject/files/pjproject-2.10-CVE-2021-21375-negotiation-failure-crash.patch b/net-libs/pjproject/files/pjproject-2.10-CVE-2021-21375-negotiation-failure-crash.patch
new file mode 100644
index 000000000000..9dc9016e491a
--- /dev/null
+++ b/net-libs/pjproject/files/pjproject-2.10-CVE-2021-21375-negotiation-failure-crash.patch
@@ -0,0 +1,45 @@
+From 97b3d7addbaa720b7ddb0af9bf6f3e443e664365 Mon Sep 17 00:00:00 2001
+From: Nanang Izzuddin <nanang@teluu.com>
+Date: Mon, 8 Mar 2021 16:09:34 +0700
+Subject: [PATCH] Merge pull request from GHSA-hvq6-f89p-frvp
+
+---
+ pjmedia/src/pjmedia/sdp_neg.c | 14 ++++++++++++--
+ 1 file changed, 12 insertions(+), 2 deletions(-)
+
+diff --git a/pjmedia/src/pjmedia/sdp_neg.c b/pjmedia/src/pjmedia/sdp_neg.c
+index f4838f75d..9f76b5200 100644
+--- a/pjmedia/src/pjmedia/sdp_neg.c
++++ b/pjmedia/src/pjmedia/sdp_neg.c
+@@ -304,7 +304,6 @@ PJ_DEF(pj_status_t) pjmedia_sdp_neg_modify_local_offer2(
+ {
+ pjmedia_sdp_session *new_offer;
+ pjmedia_sdp_session *old_offer;
+- char media_used[PJMEDIA_MAX_SDP_MEDIA];
+ unsigned oi; /* old offer media index */
+ pj_status_t status;
+
+@@ -323,8 +322,19 @@ PJ_DEF(pj_status_t) pjmedia_sdp_neg_modify_local_offer2(
+ /* Change state to STATE_LOCAL_OFFER */
+ neg->state = PJMEDIA_SDP_NEG_STATE_LOCAL_OFFER;
+
++ /* When there is no active local SDP in state PJMEDIA_SDP_NEG_STATE_DONE,
++ * it means that the previous initial SDP nego must have been failed,
++ * so we'll just set the local SDP offer here.
++ */
++ if (!neg->active_local_sdp) {
++ neg->initial_sdp_tmp = NULL;
++ neg->initial_sdp = pjmedia_sdp_session_clone(pool, local);
++ neg->neg_local_sdp = pjmedia_sdp_session_clone(pool, local);
++
++ return PJ_SUCCESS;
++ }
++
+ /* Init vars */
+- pj_bzero(media_used, sizeof(media_used));
+ old_offer = neg->active_local_sdp;
+ new_offer = pjmedia_sdp_session_clone(pool, local);
+
+--
+2.26.2
+
diff --git a/net-libs/pjproject/files/pjproject-2.10-race-condition-between-transport-destroy-and-acquire.patch b/net-libs/pjproject/files/pjproject-2.10-race-condition-between-transport-destroy-and-acquire.patch
new file mode 100644
index 000000000000..b036951d9edd
--- /dev/null
+++ b/net-libs/pjproject/files/pjproject-2.10-race-condition-between-transport-destroy-and-acquire.patch
@@ -0,0 +1,108 @@
+From 90a16c523bfdf4d43c10506c972c5fd4250b2856 Mon Sep 17 00:00:00 2001
+From: Nanang Izzuddin <nanang@teluu.com>
+Date: Fri, 20 Nov 2020 10:52:22 +0700
+Subject: [PATCH] Race condition between transport destroy and acquire (#2470)
+
+* Handle race condition between transport_idle_callback() and pjsip_tpmgr_acquire_transport2().
+* Add transport destroy state check as additional of transport shutdown state check
+---
+ pjsip/src/pjsip/sip_transaction.c | 2 +-
+ pjsip/src/pjsip/sip_transport.c | 34 +++++++++++++++++++++++++------
+ 2 files changed, 29 insertions(+), 7 deletions(-)
+
+diff --git a/pjsip/src/pjsip/sip_transaction.c b/pjsip/src/pjsip/sip_transaction.c
+index 2b4ece7df..f663c7f4b 100644
+--- a/pjsip/src/pjsip/sip_transaction.c
++++ b/pjsip/src/pjsip/sip_transaction.c
+@@ -2443,7 +2443,7 @@ static void tsx_update_transport( pjsip_transaction *tsx,
+ pjsip_transport_add_ref(tp);
+ pjsip_transport_add_state_listener(tp, &tsx_tp_state_callback, tsx,
+ &tsx->tp_st_key);
+- if (tp->is_shutdown) {
++ if (tp->is_shutdown || tp->is_destroying) {
+ pjsip_transport_state_info info;
+
+ pj_bzero(&info, sizeof(info));
+diff --git a/pjsip/src/pjsip/sip_transport.c b/pjsip/src/pjsip/sip_transport.c
+index 06fce358c..bef6d24fe 100644
+--- a/pjsip/src/pjsip/sip_transport.c
++++ b/pjsip/src/pjsip/sip_transport.c
+@@ -1071,6 +1071,19 @@ static void transport_idle_callback(pj_timer_heap_t *timer_heap,
+ return;
+
+ entry->id = PJ_FALSE;
++
++ /* Set is_destroying flag under transport manager mutex to avoid
++ * race condition with pjsip_tpmgr_acquire_transport2().
++ */
++ pj_lock_acquire(tp->tpmgr->lock);
++ if (pj_atomic_get(tp->ref_cnt) == 0) {
++ tp->is_destroying = PJ_TRUE;
++ } else {
++ pj_lock_release(tp->tpmgr->lock);
++ return;
++ }
++ pj_lock_release(tp->tpmgr->lock);
++
+ pjsip_transport_destroy(tp);
+ }
+
+@@ -1392,8 +1405,8 @@ PJ_DEF(pj_status_t) pjsip_transport_shutdown2(pjsip_transport *tp,
+ mgr = tp->tpmgr;
+ pj_lock_acquire(mgr->lock);
+
+- /* Do nothing if transport is being shutdown already */
+- if (tp->is_shutdown) {
++ /* Do nothing if transport is being shutdown/destroyed already */
++ if (tp->is_shutdown || tp->is_destroying) {
+ pj_lock_release(mgr->lock);
+ pj_lock_release(tp->lock);
+ return PJ_SUCCESS;
+@@ -2256,6 +2269,13 @@ PJ_DEF(pj_status_t) pjsip_tpmgr_acquire_transport2(pjsip_tpmgr *mgr,
+ return PJSIP_ETPNOTSUITABLE;
+ }
+
++ /* Make sure the transport is not being destroyed */
++ if (seltp->is_destroying) {
++ pj_lock_release(mgr->lock);
++ TRACE_((THIS_FILE,"Transport to be acquired is being destroyed"));
++ return PJ_ENOTFOUND;
++ }
++
+ /* We could also verify that the destination address is reachable
+ * from this transport (i.e. both are equal), but if application
+ * has requested a specific transport to be used, assume that
+@@ -2311,8 +2331,10 @@ PJ_DEF(pj_status_t) pjsip_tpmgr_acquire_transport2(pjsip_tpmgr *mgr,
+ if (tp_entry) {
+ transport *tp_iter = tp_entry;
+ do {
+- /* Don't use transport being shutdown */
+- if (!tp_iter->tp->is_shutdown) {
++ /* Don't use transport being shutdown/destroyed */
++ if (!tp_iter->tp->is_shutdown &&
++ !tp_iter->tp->is_destroying)
++ {
+ if (sel && sel->type == PJSIP_TPSELECTOR_LISTENER &&
+ sel->u.listener)
+ {
+@@ -2382,7 +2404,7 @@ PJ_DEF(pj_status_t) pjsip_tpmgr_acquire_transport2(pjsip_tpmgr *mgr,
+ TRACE_((THIS_FILE, "Transport found but from different listener"));
+ }
+
+- if (tp_ref!=NULL && !tp_ref->is_shutdown) {
++ if (tp_ref!=NULL && !tp_ref->is_shutdown && !tp_ref->is_destroying) {
+ /*
+ * Transport found!
+ */
+@@ -2624,7 +2646,7 @@ PJ_DEF(pj_status_t) pjsip_transport_add_state_listener (
+
+ PJ_ASSERT_RETURN(tp && cb && key, PJ_EINVAL);
+
+- if (tp->is_shutdown) {
++ if (tp->is_shutdown || tp->is_destroying) {
+ *key = NULL;
+ return PJ_EINVALIDOP;
+ }
+--
+2.26.2
+
diff --git a/net-libs/pjproject/pjproject-2.10-r1.ebuild b/net-libs/pjproject/pjproject-2.10-r1.ebuild
new file mode 100644
index 000000000000..ec03d01c4a60
--- /dev/null
+++ b/net-libs/pjproject/pjproject-2.10-r1.ebuild
@@ -0,0 +1,125 @@
+# Copyright 1999-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+inherit autotools flag-o-matic toolchain-funcs
+
+DESCRIPTION="Open source SIP, Media, and NAT Traversal Library"
+HOMEPAGE="https://www.pjsip.org/"
+SRC_URI="https://github.com/pjsip/${PN}/archive/${PV}.tar.gz -> ${P}.tar.gz"
+KEYWORDS="amd64 ~arm ~arm64 ~ppc ~ppc64 ~x86"
+
+LICENSE="GPL-2"
+SLOT="0/${PV}"
+
+# g729 not included due to special bcg729 handling.
+CODEC_FLAGS="g711 g722 g7221 gsm ilbc speex l16"
+VIDEO_FLAGS="sdl ffmpeg v4l2 openh264 libyuv vpx"
+SOUND_FLAGS="alsa portaudio"
+IUSE="amr debug epoll examples ipv6 libressl opus resample silk ssl static-libs webrtc
+ ${CODEC_FLAGS} g729
+ ${VIDEO_FLAGS}
+ ${SOUND_FLAGS}"
+
+PATCHES=(
+ "${FILESDIR}/pjproject-2.9-ssl-enable.patch"
+ "${FILESDIR}/pjproject-2.10-race-condition-between-transport-destroy-and-acquire.patch"
+ "${FILESDIR}/pjproject-2.10-CVE-2020-15260-tls-hostname-check.patch"
+ "${FILESDIR}/pjproject-2.10-CVE-2021-21375-negotiation-failure-crash.patch"
+)
+
+RDEPEND="net-libs/libsrtp:=
+ alsa? ( media-libs/alsa-lib )
+ amr? ( media-libs/opencore-amr )
+ ffmpeg? ( media-video/ffmpeg:= )
+ g729? ( media-libs/bcg729 )
+ gsm? ( media-sound/gsm )
+ ilbc? ( media-libs/libilbc )
+ openh264? ( media-libs/openh264 )
+ opus? ( media-libs/opus )
+ portaudio? ( media-libs/portaudio )
+ resample? ( media-libs/libsamplerate )
+ sdl? ( media-libs/libsdl )
+ speex? (
+ media-libs/speex
+ media-libs/speexdsp
+ )
+ ssl? (
+ !libressl? ( dev-libs/openssl:0= )
+ libressl? ( dev-libs/libressl:0= )
+ )
+"
+DEPEND="${RDEPEND}"
+BDEPEND="virtual/pkgconfig"
+
+src_prepare() {
+ default
+ rm configure || die "Unable to remove unwanted wrapper"
+ mv aconfigure.ac configure.ac || die "Unable to rename configure script source"
+ eautoreconf
+
+ cp "${FILESDIR}/pjproject-2.9-config_site.h" "${S}/pjlib/include/pj/config_site.h" || die "Unable to create config_site.h"
+}
+
+src_configure() {
+ local myconf=()
+ local videnable="--disable-video"
+ local t
+
+ use debug || append-cflags -DNDEBUG=1
+ use ipv6 && append-cflags -DPJ_HAS_IPV6=1
+ append-cflags -DPJMEDIA_HAS_SRTP=1
+
+ for t in ${CODEC_FLAGS}; do
+ myconf+=( $(use_enable ${t} ${t}-codec) )
+ done
+ myconf+=( $(use_enable g729 bcg729) )
+
+ for t in ${VIDEO_FLAGS}; do
+ myconf+=( $(use_enable ${t}) )
+ use "${t}" && videnable="--enable-video"
+ done
+
+ [ "${videnable}" = "--enable-video" ] && append-cflags -DPJMEDIA_HAS_VIDEO=1
+
+ LD="$(tc-getCC)" econf \
+ --enable-shared \
+ --with-external-srtp \
+ ${videnable} \
+ $(use_enable alsa sound) \
+ $(use_enable amr opencore-amr) \
+ $(use_enable epoll) \
+ $(use_enable opus) \
+ $(use_enable portaudio ext-sound) \
+ $(use_enable resample libsamplerate) \
+ $(use_enable resample resample-dll) \
+ $(use_enable resample) \
+ $(use_enable silk) \
+ $(use_enable speex speex-aec) \
+ $(use_enable ssl) \
+ $(use_with gsm external-gsm) \
+ $(use_with portaudio external-pa) \
+ $(use_with speex external-speex) \
+ $(usex webrtc '' --disable-libwebrtc) \
+ "${myconf[@]}"
+}
+
+src_compile() {
+ emake dep LD="$(tc-getCC)"
+ emake LD="$(tc-getCC)"
+}
+
+src_install() {
+ default
+
+ newbin pjsip-apps/bin/pjsua-${CHOST} pjsua
+ newbin pjsip-apps/bin/pjsystest-${CHOST} pjsystest
+
+ if use examples; then
+ insinto "/usr/share/doc/${PF}/examples"
+ doins -r pjsip-apps/src/samples
+ fi
+
+ use static-libs || rm "${ED}/usr/$(get_libdir)"/*.a || die "Error removing static archives"
+}