1 |
commit: 7d58a9bedd50b381637d0434afd06c0d1911db46 |
2 |
Author: Jaco Kroon <jaco <AT> uls <DOT> co <DOT> za> |
3 |
AuthorDate: Tue Aug 23 08:26:05 2022 +0000 |
4 |
Commit: Matthew Smith <matthew <AT> gentoo <DOT> org> |
5 |
CommitDate: Tue Aug 23 08:49:17 2022 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7d58a9be |
7 |
|
8 |
net-misc/asterisk: remove :13 (security) |
9 |
|
10 |
Bug: https://bugs.gentoo.org/838391 |
11 |
Package-Manager: Portage-3.0.30, Repoman-3.0.3 |
12 |
Signed-off-by: Jaco Kroon <jaco <AT> uls.co.za> |
13 |
Signed-off-by: Matthew Smith <matthew <AT> gentoo.org> |
14 |
|
15 |
net-misc/asterisk/Manifest | 1 - |
16 |
net-misc/asterisk/asterisk-13.38.3-r3.ebuild | 353 ----------------- |
17 |
.../files/asterisk-13.18.1-r2-autoconf-2.70.patch | 10 - |
18 |
.../asterisk-13.38.1-r1-autoconf-lua-version.patch | 56 --- |
19 |
.../asterisk-13.38.2-r1-menuselect-exitcodes.patch | 67 ---- |
20 |
...sterisk-13.38.2-r2-func_odbc_minargs-ARGC.patch | 180 --------- |
21 |
.../asterisk-13.38.2-r3-func_lock-fix-races.patch | 421 --------------------- |
22 |
.../asterisk-historic-no-var-run-install.patch | 14 - |
23 |
.../files/asterisk.tmpfiles-13.38.3-r2.conf | 1 - |
24 |
net-misc/asterisk/files/confd-13.32.0 | 160 -------- |
25 |
net-misc/asterisk/files/initd-13.38.3-r2 | 362 ------------------ |
26 |
11 files changed, 1625 deletions(-) |
27 |
|
28 |
diff --git a/net-misc/asterisk/Manifest b/net-misc/asterisk/Manifest |
29 |
index 1f0bd3611e8d..c0d412e23a98 100644 |
30 |
--- a/net-misc/asterisk/Manifest |
31 |
+++ b/net-misc/asterisk/Manifest |
32 |
@@ -1,4 +1,3 @@ |
33 |
-DIST asterisk-13.38.3.tar.gz 33711458 BLAKE2B a1f37c210e7e95962665310b542d9a3b682ecc5e90188e8272a0cd6e22ebfa963ed5af46f0f85c2074bc0bbe34d72473343ff3437d80b58e5383eb80385d0b89 SHA512 dd67f73704f1c68639313852ba1508165c7b525f0f4156c776258e27ee19a0ee87293ae7805178b0f37188fca91b861c52b5206cbba754a6181492d0efb7e895 |
34 |
DIST asterisk-16.22.0.tar.gz 27925083 BLAKE2B ce700f8924fb2c7c8fc521879c0768595eb7462bb3aa78dd8b64c8a268b357e522ece17c6c4a02a4e17c16bad5141d5c2c15b602d335567be5a3df49f67300ca SHA512 7032da647f4063320fb2ea9c3cd7b0079fbb907e5c8f9d5cdc4197c82d07c99c75bfdcace5c74a593573cd0d9a1b9eb73b2030dc0b13604abb481a311a742173 |
35 |
DIST asterisk-16.23.0.tar.gz 27960909 BLAKE2B 60aa12e41c199da7c052555f5716fd7325de66d0821c8f285635c8ad01435a182c670b12c9d3959ce8206b1bad255e61eeea199bf23b9dd49915da84487e2ce2 SHA512 d9f6cc083afb858ce48b090bea6a8479679ff840eb35dbc6af7d88ded17539c6e906547a7d936de31b3a50d692df1ccce2fe40b81bba1dc6a82a78c94e1198c4 |
36 |
DIST asterisk-16.24.0.tar.gz 27987904 BLAKE2B 2a179366d3853afd6528b7b61c33b6683e924ae62bb4cbfd04b3e6717b4d73345b893632164396a5587d633d60338615f69a02d1f8b7f7ac3903131e209825ea SHA512 0c770264fad5a5f4c8cc6572b524349337635f0a8def26391897776d7ba4ec8f0cf595f588abc75f9f37ba941a56b7d3704b3ef3ddb4b67d3e4e341992e8f815 |
37 |
|
38 |
diff --git a/net-misc/asterisk/asterisk-13.38.3-r3.ebuild b/net-misc/asterisk/asterisk-13.38.3-r3.ebuild |
39 |
deleted file mode 100644 |
40 |
index 2bd6004948b9..000000000000 |
41 |
--- a/net-misc/asterisk/asterisk-13.38.3-r3.ebuild |
42 |
+++ /dev/null |
43 |
@@ -1,353 +0,0 @@ |
44 |
-# Copyright 1999-2022 Gentoo Authors |
45 |
-# Distributed under the terms of the GNU General Public License v2 |
46 |
- |
47 |
-EAPI=7 |
48 |
- |
49 |
-LUA_COMPAT=( lua5-{1..4} ) |
50 |
- |
51 |
-inherit autotools linux-info lua-single systemd toolchain-funcs tmpfiles |
52 |
- |
53 |
-DESCRIPTION="Asterisk: A Modular Open Source PBX System" |
54 |
-HOMEPAGE="https://www.asterisk.org/" |
55 |
-SRC_URI="https://downloads.asterisk.org/pub/telephony/asterisk/releases/${P}.tar.gz" |
56 |
-LICENSE="GPL-2" |
57 |
-SLOT="0/${PV%%.*}" |
58 |
-KEYWORDS="amd64 ~arm ~arm64 ~ppc ~ppc64 x86" |
59 |
- |
60 |
-IUSE_VOICEMAIL_STORAGE=( |
61 |
- +voicemail_storage_file |
62 |
- voicemail_storage_odbc |
63 |
- voicemail_storage_imap |
64 |
-) |
65 |
-IUSE="${IUSE_VOICEMAIL_STORAGE[*]} alsa blocks bluetooth calendar +caps cluster curl dahdi debug doc freetds gtalk http iconv ilbc ldap lua mysql newt odbc oss pjproject portaudio postgres radius selinux snmp span speex srtp +ssl static statsd syslog systemd vorbis xmpp" |
66 |
-REQUIRED_USE="gtalk? ( xmpp ) |
67 |
- lua? ( ${LUA_REQUIRED_USE} ) |
68 |
- ^^ ( ${IUSE_VOICEMAIL_STORAGE[*]//+/} ) |
69 |
- voicemail_storage_odbc? ( odbc ) |
70 |
-" |
71 |
- |
72 |
-PATCHES=( |
73 |
- "${FILESDIR}/${PN}-historic-no-var-run-install.patch" |
74 |
- "${FILESDIR}/${PN}-13.38.1-r1-autoconf-lua-version.patch" |
75 |
- "${FILESDIR}/${PN}-13.38.2-r3-func_lock-fix-races.patch" |
76 |
- "${FILESDIR}/${PN}-13.18.1-r2-autoconf-2.70.patch" |
77 |
- "${FILESDIR}/${PN}-13.38.2-r1-menuselect-exitcodes.patch" |
78 |
- "${FILESDIR}/${PN}-13.38.2-r2-func_odbc_minargs-ARGC.patch" |
79 |
-) |
80 |
- |
81 |
-DEPEND="acct-user/asterisk |
82 |
- acct-group/asterisk |
83 |
- dev-db/sqlite:3 |
84 |
- dev-libs/popt |
85 |
- dev-libs/jansson:= |
86 |
- dev-libs/libedit |
87 |
- dev-libs/libxml2:2 |
88 |
- dev-libs/libxslt |
89 |
- virtual/libcrypt:= |
90 |
- sys-libs/zlib |
91 |
- alsa? ( media-libs/alsa-lib ) |
92 |
- bluetooth? ( net-wireless/bluez:= ) |
93 |
- calendar? ( |
94 |
- net-libs/neon:= |
95 |
- dev-libs/libical:= |
96 |
- dev-libs/iksemel |
97 |
- ) |
98 |
- caps? ( sys-libs/libcap ) |
99 |
- blocks? ( sys-libs/blocksruntime ) |
100 |
- cluster? ( sys-cluster/corosync ) |
101 |
- curl? ( net-misc/curl ) |
102 |
- dahdi? ( |
103 |
- net-libs/libpri |
104 |
- net-misc/dahdi-tools |
105 |
- ) |
106 |
- freetds? ( dev-db/freetds ) |
107 |
- gtalk? ( dev-libs/iksemel ) |
108 |
- http? ( dev-libs/gmime:2.6 ) |
109 |
- iconv? ( virtual/libiconv ) |
110 |
- ilbc? ( media-libs/libilbc ) |
111 |
- ldap? ( net-nds/openldap:= ) |
112 |
- lua? ( ${LUA_DEPS} ) |
113 |
- mysql? ( dev-db/mysql-connector-c:= ) |
114 |
- newt? ( dev-libs/newt ) |
115 |
- odbc? ( dev-db/unixODBC ) |
116 |
- pjproject? ( net-libs/pjproject:= ) |
117 |
- portaudio? ( media-libs/portaudio ) |
118 |
- postgres? ( dev-db/postgresql:* ) |
119 |
- radius? ( net-dialup/freeradius-client ) |
120 |
- snmp? ( net-analyzer/net-snmp:= ) |
121 |
- span? ( media-libs/spandsp ) |
122 |
- speex? ( |
123 |
- media-libs/speex |
124 |
- media-libs/speexdsp |
125 |
- ) |
126 |
- srtp? ( net-libs/libsrtp:0 ) |
127 |
- ssl? ( |
128 |
- dev-libs/openssl:0= |
129 |
- ) |
130 |
- systemd? ( sys-apps/systemd ) |
131 |
- !systemd? ( !sys-apps/systemd ) |
132 |
- vorbis? ( |
133 |
- media-libs/libogg |
134 |
- media-libs/libvorbis |
135 |
- ) |
136 |
- voicemail_storage_imap? ( virtual/imap-c-client ) |
137 |
- xmpp? ( dev-libs/iksemel ) |
138 |
-" |
139 |
- |
140 |
-RDEPEND="${DEPEND} |
141 |
- net-misc/asterisk-core-sounds |
142 |
- net-misc/asterisk-extra-sounds |
143 |
- net-misc/asterisk-moh-opsound |
144 |
- selinux? ( sec-policy/selinux-asterisk ) |
145 |
- syslog? ( virtual/logger )" |
146 |
- |
147 |
-BDEPEND="dev-libs/libxml2:2 |
148 |
- virtual/pkgconfig" |
149 |
- |
150 |
-QA_DT_NEEDED="/usr/lib.*/libasteriskssl[.]so[.][0-9]\+" |
151 |
- |
152 |
-_make_args=( |
153 |
- "NOISY_BUILD=yes" |
154 |
- "ASTDBDIR=\$(ASTDATADIR)/astdb" |
155 |
- "ASTVARRUNDIR=/run/asterisk" |
156 |
- "OPTIMIZE=" |
157 |
- "DEBUG=" |
158 |
- "DESTDIR=${D}" |
159 |
- "CONFIG_SRC=configs/samples" |
160 |
- "CONFIG_EXTEN=.sample" |
161 |
-) |
162 |
- |
163 |
-pkg_pretend() { |
164 |
- CONFIG_CHECK="~!NF_CONNTRACK_SIP" |
165 |
- local WARNING_NF_CONNTRACK_SIP="SIP (NAT) connection tracking is enabled. Some users |
166 |
- have reported that this module dropped critical SIP packets in their deployments. You |
167 |
- may want to disable it if you see such problems." |
168 |
- check_extra_config |
169 |
- |
170 |
- [[ "${MERGE_TYPE}" == binary ]] && return |
171 |
- |
172 |
- if tc-is-clang; then |
173 |
- use blocks || die "CC=clang requires USE=blocks" |
174 |
- else |
175 |
- use blocks && die "USE=blocks can only be used with CC=clang" |
176 |
- fi |
177 |
-} |
178 |
- |
179 |
-pkg_setup() { |
180 |
- use lua && lua-single_pkg_setup |
181 |
-} |
182 |
- |
183 |
-src_prepare() { |
184 |
- default |
185 |
- AT_M4DIR="autoconf third-party third-party/pjproject third-party/jansson" \ |
186 |
- AC_CONFIG_SUBDIRS=menuselect eautoreconf |
187 |
-} |
188 |
- |
189 |
-src_configure() { |
190 |
- local vmst |
191 |
- local copt cstate |
192 |
- |
193 |
- econf \ |
194 |
- LUA_VERSION="${ELUA#lua}" \ |
195 |
- --libdir="/usr/$(get_libdir)" \ |
196 |
- --localstatedir="/var" \ |
197 |
- --with-crypto \ |
198 |
- --with-gsm=internal \ |
199 |
- --with-popt \ |
200 |
- --with-z \ |
201 |
- --with-libedit \ |
202 |
- $(use_with caps cap) \ |
203 |
- $(use_with lua lua) \ |
204 |
- $(use_with http gmime) \ |
205 |
- $(use_with newt) \ |
206 |
- $(use_with pjproject) \ |
207 |
- $(use_with portaudio) \ |
208 |
- $(use_with ssl) |
209 |
- |
210 |
- _menuselect() { |
211 |
- menuselect/menuselect "$@" || die "menuselect $* failed." |
212 |
- } |
213 |
- |
214 |
- _use_select() { |
215 |
- local state=$(usex "$1" enable disable) |
216 |
- shift # remove use from parameters |
217 |
- |
218 |
- while [[ -n $1 ]]; do |
219 |
- _menuselect --${state} "$1" menuselect.makeopts |
220 |
- shift |
221 |
- done |
222 |
- } |
223 |
- |
224 |
- # Blank out sounds/sounds.xml file to prevent |
225 |
- # asterisk from installing sounds files (we pull them in via |
226 |
- # asterisk-{core,extra}-sounds and asterisk-moh-opsound. |
227 |
- >"${S}"/sounds/sounds.xml |
228 |
- |
229 |
- # That NATIVE_ARCH chatter really is quite bothersome |
230 |
- sed -i 's/NATIVE_ARCH=/NATIVE_ARCH=0/' build_tools/menuselect-deps || die "Unable to squelch noisy build system" |
231 |
- |
232 |
- # Compile menuselect binary for optional components |
233 |
- emake "${_make_args[@]}" menuselect.makeopts |
234 |
- |
235 |
- # Disable BUILD_NATIVE (bug #667498) |
236 |
- _menuselect --disable build_native menuselect.makeopts |
237 |
- |
238 |
- # Broken functionality is forcibly disabled (bug #360143) |
239 |
- _menuselect --disable chan_misdn menuselect.makeopts |
240 |
- _menuselect --disable chan_ooh323 menuselect.makeopts |
241 |
- |
242 |
- # Utility set is forcibly enabled (bug #358001) |
243 |
- _menuselect --enable smsq menuselect.makeopts |
244 |
- _menuselect --enable streamplayer menuselect.makeopts |
245 |
- _menuselect --enable aelparse menuselect.makeopts |
246 |
- _menuselect --enable astman menuselect.makeopts |
247 |
- |
248 |
- # this is connected, otherwise it would not find |
249 |
- # ast_pktccops_gate_alloc symbol |
250 |
- _menuselect --enable chan_mgcp menuselect.makeopts |
251 |
- _menuselect --enable res_pktccops menuselect.makeopts |
252 |
- |
253 |
- # SSL is forcibly enabled, IAX2 & DUNDI are expected to be available |
254 |
- _menuselect --enable pbx_dundi menuselect.makeopts |
255 |
- _menuselect --enable func_aes menuselect.makeopts |
256 |
- _menuselect --enable chan_iax2 menuselect.makeopts |
257 |
- |
258 |
- # SQlite3 is now the main database backend, enable related features |
259 |
- _menuselect --enable cdr_sqlite3_custom menuselect.makeopts |
260 |
- _menuselect --enable cel_sqlite3_custom menuselect.makeopts |
261 |
- |
262 |
- # The others are based on USE-flag settings |
263 |
- _use_select alsa chan_alsa |
264 |
- _use_select bluetooth chan_mobile |
265 |
- _use_select calendar res_calendar res_calendar_{caldav,ews,exchange,icalendar} |
266 |
- _use_select cluster res_corosync |
267 |
- _use_select curl func_curl res_config_curl res_curl |
268 |
- _use_select dahdi app_dahdiras app_meetme chan_dahdi codec_dahdi res_timing_dahdi |
269 |
- _use_select freetds {cdr,cel}_tds |
270 |
- _use_select gtalk chan_motif |
271 |
- _use_select http res_http_post |
272 |
- _use_select iconv func_iconv |
273 |
- _use_select ilbc codec_ilbc format_ilbc |
274 |
- _use_select ldap res_config_ldap |
275 |
- _use_select lua pbx_lua |
276 |
- _use_select mysql app_mysql cdr_mysql res_config_mysql |
277 |
- _use_select odbc cdr_adaptive_odbc res_config_odbc {cdr,cel,res,func}_odbc |
278 |
- _use_select oss chan_oss |
279 |
- _use_select postgres {cdr,cel}_pgsql res_config_pgsql |
280 |
- _use_select radius {cdr,cel}_radius |
281 |
- _use_select snmp res_snmp |
282 |
- _use_select span res_fax_spandsp |
283 |
- _use_select speex {codec,func}_speex |
284 |
- _use_select srtp res_srtp |
285 |
- _use_select statsd res_statsd res_{endpoint,chan}_stats |
286 |
- _use_select syslog cdr_syslog |
287 |
- _use_select vorbis format_ogg_vorbis |
288 |
- _use_select xmpp res_xmpp |
289 |
- |
290 |
- # Voicemail storage ... |
291 |
- for vmst in "${IUSE_VOICEMAIL_STORAGE[@]}"; do |
292 |
- if use "${vmst#+}"; then |
293 |
- _menuselect --enable "$(echo "${vmst##*_}" | tr '[:lower:]' '[:upper:]')_STORAGE" menuselect.makeopts |
294 |
- fi |
295 |
- done |
296 |
- |
297 |
- if use debug; then |
298 |
- for o in DONT_OPTIMIZE DEBUG_FD_LEAKS MALLOC_DEBUG BETTER_BACKTRACES; do |
299 |
- _menuselect --enable $o menuselect.makeopts |
300 |
- done |
301 |
- fi |
302 |
- |
303 |
- if [[ -n "${GENTOO_ASTERISK_CUSTOM_MENUSELECT:+yes}" ]]; then |
304 |
- for copt in ${GENTOO_ASTERISK_CUSTOM_MENUSELECT}; do |
305 |
- cstate=--enable |
306 |
- [[ "${copt}" == -* ]] && cstate=--disable |
307 |
- ebegin "Custom option ${copt#[-+]} ${cstate:2}d" |
308 |
- _menuselect ${cstate} "${copt#[-+]}" |
309 |
- eend $? |
310 |
- done |
311 |
- fi |
312 |
-} |
313 |
- |
314 |
-src_compile() { |
315 |
- emake "${_make_args[@]}" |
316 |
-} |
317 |
- |
318 |
-src_install() { |
319 |
- local d |
320 |
- |
321 |
- dodir "/usr/$(get_libdir)/pkgconfig" |
322 |
- diropts -m 0750 -o root -g asterisk |
323 |
- dodir /etc/asterisk |
324 |
- |
325 |
- emake "${_make_args[@]}" install install-configs |
326 |
- |
327 |
- fowners asterisk: /var/lib/asterisk/astdb |
328 |
- |
329 |
- if use radius; then |
330 |
- insinto /etc/radiusclient/ |
331 |
- doins contrib/dictionary.digium |
332 |
- fi |
333 |
- |
334 |
- # keep directories |
335 |
- diropts -m 0750 -o asterisk -g root |
336 |
- keepdir /var/spool/asterisk/{system,tmp,meetme,monitor,dictate,voicemail,recording} |
337 |
- diropts -m 0750 -o asterisk -g asterisk |
338 |
- keepdir /var/log/asterisk/{cdr-csv,cdr-custom} |
339 |
- |
340 |
- newinitd "${FILESDIR}"/initd-13.38.3-r2 asterisk |
341 |
- newconfd "${FILESDIR}"/confd-13.32.0 asterisk |
342 |
- |
343 |
- systemd_dounit "${FILESDIR}"/asterisk.service |
344 |
- newtmpfiles "${FILESDIR}"/asterisk.tmpfiles-13.38.3-r2.conf asterisk.conf |
345 |
- systemd_install_serviced "${FILESDIR}"/asterisk.service.conf |
346 |
- |
347 |
- # Reset diropts else dodoc uses it for doc installations. |
348 |
- diropts -m0755 |
349 |
- |
350 |
- # install the upgrade documentation |
351 |
- dodoc UPGRADE* BUGS CREDITS |
352 |
- |
353 |
- # install extra documentation |
354 |
- use doc && dodoc doc/*.{txt,pdf} |
355 |
- |
356 |
- # install logrotate snippet; bug #329281 |
357 |
- # |
358 |
- insinto /etc/logrotate.d |
359 |
- newins "${FILESDIR}/1.6.2/asterisk.logrotate4" asterisk |
360 |
- |
361 |
- # Asterisk installs a few folders that's empty by design, |
362 |
- # but still required. This finds them, and marks them for |
363 |
- # portage. |
364 |
- while read d < <(find "${ED}"/var -type d -empty || die "Find failed."); do |
365 |
- keepdir "${d#${ED}}" |
366 |
- done |
367 |
-} |
368 |
- |
369 |
-pkg_postinst() { |
370 |
- tmpfiles_process asterisk.conf |
371 |
- |
372 |
- if [ -z "${REPLACING_VERSIONS}" ]; then |
373 |
- elog "Asterisk Wiki: https://wiki.asterisk.org/wiki/" |
374 |
- elog "Gentoo VoIP IRC Channel: #gentoo-voip @ irc.libera.chat" |
375 |
- elif [ "$(ver_cut 1 "${REPLACING_VERSIONS}")" != "$(ver_cut 1)" ]; then |
376 |
- elog "You are updating from Asterisk $(ver_cut 1 "${REPLACING_VERSIONS}") upgrade document:" |
377 |
- elog "https://wiki.asterisk.org/wiki/display/AST/Upgrading+to+Asterisk+$(ver_cut 1)" |
378 |
- elog "Gentoo VoIP IRC Channel: #gentoo-voip @ irc.libera.chat" |
379 |
- fi |
380 |
- |
381 |
- if [[ -n "${GENTOO_ASTERISK_CUSTOM_MENUSELECT:+yes}" ]]; then |
382 |
- ewarn "You are using GENTOO_ASTERISK_CUSTOM_MENUSELECT, this should only be used" |
383 |
- ewarn "for debugging, for anything else, please file a bug on https://bugs.gentoo.org" |
384 |
- fi |
385 |
- |
386 |
- if [[ -f /var/lib/asterisk/astdb.sqlite3 ]]; then |
387 |
- ewarn "Default astdb location has changed from /var/lib/asterisk to /var/lib/asterisk/astdb" |
388 |
- ewarn "You still have a /var/lib/asterisk/astdb.sqlite file. You need to either set" |
389 |
- ewarn "astdbdir in /etc/asterisk/asterisk.conf to /var/lib/asterisk or follow these" |
390 |
- ewarn "steps to migrate:" |
391 |
- ewarn "1. /etc/init.d/asterisk stop" |
392 |
- ewarn "2. mv /var/lib/asterisk/astdb.sqlite /var/lib/asterisk/astdb/" |
393 |
- ewarn "3. /etc/init.d/asterisk start" |
394 |
- ewarn "This update was done partly for security reasons so that /var/lib/asterisk can be root owned." |
395 |
- fi |
396 |
-} |
397 |
|
398 |
diff --git a/net-misc/asterisk/files/asterisk-13.18.1-r2-autoconf-2.70.patch b/net-misc/asterisk/files/asterisk-13.18.1-r2-autoconf-2.70.patch |
399 |
deleted file mode 100644 |
400 |
index 68a5604757b2..000000000000 |
401 |
--- a/net-misc/asterisk/files/asterisk-13.18.1-r2-autoconf-2.70.patch |
402 |
+++ /dev/null |
403 |
@@ -1,10 +0,0 @@ |
404 |
---- asterisk-13.38.1/configure.ac.o 2021-01-08 18:33:41.360112920 +0200 |
405 |
-+++ asterisk-13.38.1/configure.ac 2021-01-08 18:38:26.649995123 +0200 |
406 |
-@@ -605,7 +605,6 @@ |
407 |
- |
408 |
- AC_FUNC_ALLOCA |
409 |
- AC_HEADER_DIRENT |
410 |
--AC_HEADER_STDC |
411 |
- AC_HEADER_SYS_WAIT |
412 |
- AC_CHECK_HEADERS([arpa/inet.h fcntl.h inttypes.h libintl.h limits.h locale.h malloc.h netdb.h netinet/in.h stddef.h stdint.h stdlib.h string.h strings.h sys/event.h sys/file.h sys/ioctl.h sys/param.h sys/socket.h sys/time.h sys/types.h syslog.h termios.h unistd.h utime.h arpa/nameser.h sys/io.h]) |
413 |
- |
414 |
|
415 |
diff --git a/net-misc/asterisk/files/asterisk-13.38.1-r1-autoconf-lua-version.patch b/net-misc/asterisk/files/asterisk-13.38.1-r1-autoconf-lua-version.patch |
416 |
deleted file mode 100644 |
417 |
index 00a922ce0738..000000000000 |
418 |
--- a/net-misc/asterisk/files/asterisk-13.38.1-r1-autoconf-lua-version.patch |
419 |
+++ /dev/null |
420 |
@@ -1,56 +0,0 @@ |
421 |
-From 61ef1a71e312f846b08ec4307c449f03907610a6 Mon Sep 17 00:00:00 2001 |
422 |
-From: Jaco Kroon <jaco@××××××.za> |
423 |
-Date: Wed, 23 Dec 2020 19:41:10 +0200 |
424 |
-Subject: [PATCH] pbx_lua: Add LUA_VERSION environment variable to |
425 |
- ./configure. |
426 |
- |
427 |
-On Gentoo it's possible to have multiple lua versions installed, all |
428 |
-with a path of /usr, so it's not possible to use the current --with-lua |
429 |
-option to determisticly pin to a specific version as is required by the |
430 |
-Gentoo PMS standards. |
431 |
- |
432 |
-This environment variable allows to lock to specific versions, |
433 |
-unversioned check will be skipped if this variable is supplied. |
434 |
- |
435 |
-Change-Id: I8c403eda05df25ee0193960262ce849c7d2fd088 |
436 |
-Signed-off-by: Jaco Kroon <jaco@××××××.za> |
437 |
---- |
438 |
- configure | 7 ++++++- |
439 |
- configure.ac | 7 +++++-- |
440 |
- 2 files changed, 11 insertions(+), 3 deletions(-) |
441 |
- |
442 |
-diff --git a/configure.ac b/configure.ac |
443 |
-index 64a0a5ace5..b380759b2b 100644 |
444 |
---- a/configure.ac |
445 |
-+++ b/configure.ac |
446 |
-@@ -511,6 +511,7 @@ AST_EXT_LIB_SETUP([LIBXML2], [LibXML2], [libxml2]) |
447 |
- AST_EXT_LIB_SETUP([LIBXSLT], [LibXSLT], [libxslt]) |
448 |
- AST_EXT_LIB_SETUP_OPTIONAL([LIBXSLT_CLEANUP], [LibXSLT Library Cleanup Function], [LIBXSLT], [libxslt]) |
449 |
- AST_EXT_LIB_SETUP([LUA], [Lua], [lua]) |
450 |
-+AC_ARG_VAR([LUA_VERSION],[A space separated list of target lua versions to test.]) |
451 |
- AST_EXT_LIB_SETUP([MISDN], [mISDN user], [misdn]) |
452 |
- AST_EXT_LIB_SETUP([MYSQLCLIENT], [MySQL client], [mysqlclient]) |
453 |
- AST_EXT_LIB_SETUP([NBS], [Network Broadcast Sound], [nbs]) |
454 |
-@@ -2559,7 +2560,7 @@ if test -z "$__opus_include" -o x"$__opus_include" = x" " ; then |
455 |
- fi |
456 |
- AST_EXT_LIB_CHECK([OPUSFILE], [opusfile], [op_open_callbacks], [opus/opusfile.h], [], [$__opus_include]) |
457 |
- |
458 |
--for ver in 5.4 5.3 5.2 5.1; do |
459 |
-+for ver in ${LUA_VERSION:-5.4 5.3 5.2 5.1}; do |
460 |
- AST_EXT_LIB_CHECK([LUA], lua${ver}, [luaL_newstate], lua${ver}/lua.h, [-lm]) |
461 |
- if test "x${PBX_LUA}" = "x1" ; then |
462 |
- if test x"${LUA_DIR}" = x; then |
463 |
-@@ -2572,7 +2573,9 @@ for ver in 5.4 5.3 5.2 5.1; do |
464 |
- done |
465 |
- |
466 |
- # Some distributions (like openSUSE and NetBSD) remove the 5.x suffix. |
467 |
--AST_EXT_LIB_CHECK([LUA], [lua], [luaL_newstate], [lua.h], [-lm]) |
468 |
-+if test "x${LUA_VERSION}" = "x"; then |
469 |
-+ AST_EXT_LIB_CHECK([LUA], [lua], [luaL_newstate], [lua.h], [-lm]) |
470 |
-+fi |
471 |
- |
472 |
- # Accept either RADIUS client library, their APIs are fully compatible, |
473 |
- # just different header filenames and different SONAMEs |
474 |
--- |
475 |
-2.26.2 |
476 |
- |
477 |
|
478 |
diff --git a/net-misc/asterisk/files/asterisk-13.38.2-r1-menuselect-exitcodes.patch b/net-misc/asterisk/files/asterisk-13.38.2-r1-menuselect-exitcodes.patch |
479 |
deleted file mode 100644 |
480 |
index 90c97e9df5e3..000000000000 |
481 |
--- a/net-misc/asterisk/files/asterisk-13.38.2-r1-menuselect-exitcodes.patch |
482 |
+++ /dev/null |
483 |
@@ -1,67 +0,0 @@ |
484 |
-From 840eaa67e1ee0d10aa6bfb1e34659efa3095b772 Mon Sep 17 00:00:00 2001 |
485 |
-From: Jaco Kroon <jaco@××××××.za> |
486 |
-Date: Sat, 13 Mar 2021 13:01:50 +0200 |
487 |
-Subject: [PATCH] menuselect: exit non-zero in case of failure on |
488 |
- --enable|disable options. |
489 |
- |
490 |
-Change-Id: I77e3466435f5a51a57538b29addb68d811af238d |
491 |
-Signed-off-by: Jaco Kroon <jaco@××××××.za> |
492 |
---- |
493 |
- menuselect/menuselect.c | 6 +++++- |
494 |
- 1 file changed, 5 insertions(+), 1 deletion(-) |
495 |
- |
496 |
-diff --git a/menuselect/menuselect.c b/menuselect/menuselect.c |
497 |
-index 2eea3f09eb..adb6fa1777 100644 |
498 |
---- a/menuselect/menuselect.c |
499 |
-+++ b/menuselect/menuselect.c |
500 |
-@@ -2090,6 +2090,7 @@ int main(int argc, char *argv[]) |
501 |
- /* Reset options processing */ |
502 |
- option_index = 0; |
503 |
- optind = 1; |
504 |
-+ res = 0; |
505 |
- |
506 |
- while ((c = getopt_long(argc, argv, "", long_options, &option_index)) != -1) { |
507 |
- print_debug("Got option %c\n", c); |
508 |
-@@ -2100,6 +2101,7 @@ int main(int argc, char *argv[]) |
509 |
- set_member_enabled(mem); |
510 |
- } else { |
511 |
- fprintf(stderr, "'%s' not found\n", optarg); |
512 |
-+ res = 1; |
513 |
- } |
514 |
- } |
515 |
- break; |
516 |
-@@ -2109,6 +2111,7 @@ int main(int argc, char *argv[]) |
517 |
- set_all(cat, 1); |
518 |
- } else { |
519 |
- fprintf(stderr, "'%s' not found\n", optarg); |
520 |
-+ res = 1; |
521 |
- } |
522 |
- } |
523 |
- break; |
524 |
-@@ -2123,6 +2126,7 @@ int main(int argc, char *argv[]) |
525 |
- clear_member_enabled(mem); |
526 |
- } else { |
527 |
- fprintf(stderr, "'%s' not found\n", optarg); |
528 |
-+ res = 1; |
529 |
- } |
530 |
- } |
531 |
- break; |
532 |
-@@ -2132,6 +2136,7 @@ int main(int argc, char *argv[]) |
533 |
- set_all(cat, 0); |
534 |
- } else { |
535 |
- fprintf(stderr, "'%s' not found\n", optarg); |
536 |
-+ res = 1; |
537 |
- } |
538 |
- } |
539 |
- break; |
540 |
-@@ -2146,7 +2151,6 @@ int main(int argc, char *argv[]) |
541 |
- break; |
542 |
- } |
543 |
- } |
544 |
-- res = 0; |
545 |
- } |
546 |
- |
547 |
- if (!res) { |
548 |
--- |
549 |
-2.26.2 |
550 |
- |
551 |
|
552 |
diff --git a/net-misc/asterisk/files/asterisk-13.38.2-r2-func_odbc_minargs-ARGC.patch b/net-misc/asterisk/files/asterisk-13.38.2-r2-func_odbc_minargs-ARGC.patch |
553 |
deleted file mode 100644 |
554 |
index db3817b5242b..000000000000 |
555 |
--- a/net-misc/asterisk/files/asterisk-13.38.2-r2-func_odbc_minargs-ARGC.patch |
556 |
+++ /dev/null |
557 |
@@ -1,180 +0,0 @@ |
558 |
-From d847f7e8f8736e5f51fd11df2992fac87131c1d8 Mon Sep 17 00:00:00 2001 |
559 |
-From: Jaco Kroon <jaco@××××××.za> |
560 |
-Date: Wed, 17 Feb 2021 22:51:17 +0200 |
561 |
-Subject: [PATCH] func_odbc: Introduce minargs config and expose ARGC in |
562 |
- addition to ARGn. |
563 |
- |
564 |
-minargs enables enforcing of minimum count of arguments to pass to |
565 |
-func_odbc, so if you're unconditionally using ARG1 through ARG4 then |
566 |
-this should be set to 4. func_odbc will generate an error in this case, |
567 |
-so for example |
568 |
- |
569 |
-[FOO] |
570 |
-minargs = 4 |
571 |
- |
572 |
-and ODBC_FOO(a,b,c) in dialplan will now error out instead of using a |
573 |
-potentially leaked ARG4 from Gosub(). |
574 |
- |
575 |
-ARGC is needed if you're using optional argument, to verify whether or |
576 |
-not an argument has been passed, else it's possible to use a leaked ARGn |
577 |
-from Gosub (app_stack). So now you can safely do |
578 |
-${IF($[${ARGC}>3]?${ARGV}:default value)} kind of thing. |
579 |
- |
580 |
-Change-Id: I6ca0b137d90b03f6aa9c496991f6cbf1518f6c24 |
581 |
-Signed-off-by: Jaco Kroon <jaco@××××××.za> |
582 |
---- |
583 |
- configs/samples/func_odbc.conf.sample | 11 +++++++ |
584 |
- .../func_odbc_ARGC_minargs.txt | 20 ++++++++++++ |
585 |
- funcs/func_odbc.c | 31 +++++++++++++++++-- |
586 |
- 3 files changed, 60 insertions(+), 2 deletions(-) |
587 |
- create mode 100644 doc/CHANGES-staging/func_odbc_ARGC_minargs.txt |
588 |
- |
589 |
-diff --git a/configs/samples/func_odbc.conf.sample b/configs/samples/func_odbc.conf.sample |
590 |
-index c467f7ec06..b825974ea7 100644 |
591 |
---- a/configs/samples/func_odbc.conf.sample |
592 |
-+++ b/configs/samples/func_odbc.conf.sample |
593 |
-@@ -23,6 +23,10 @@ |
594 |
- ; For substitution, you have ${ARG1}, ${ARG2} ... ${ARGn} |
595 |
- ; for the arguments to each SQL statement. |
596 |
- ; |
597 |
-+; Additionally you can use ${ARGC} to determine the number of arguments that |
598 |
-+; was actually passed (or risk using leaked ARGn variables from the channel). |
599 |
-+; Also reference the minargs configuration option. |
600 |
-+; |
601 |
- ; In addition, for write statements, you have ${VAL1}, ${VAL2} ... ${VALn} |
602 |
- ; parsed, just like arguments, for the values. In addition, if you want the |
603 |
- ; whole value, never mind the parsing, you can get that with ${VALUE}. |
604 |
-@@ -87,6 +91,13 @@ |
605 |
- ; These additional rows can be returned by using the name of the |
606 |
- ; function which was called to retrieve the first row as an |
607 |
- ; argument to ODBC_FETCH(). |
608 |
-+; minargs The minimum number of ARGUMENTS that has to be passed to the |
609 |
-+; function. If fewer arguments than this is passed, then the call |
610 |
-+; will fail. It is important to note that unlike Gosub() and friends, |
611 |
-+; func_odbc will not mask out ARGn variables that it's not actively |
612 |
-+; using, as such, without this, it's entirely possible to use say |
613 |
-+; ARG2 from the Gosub() inside func_odbc when the intent was to |
614 |
-+; use an argument passed to func_odbc, but it simply was never passed. |
615 |
- |
616 |
- |
617 |
- ; ODBC_SQL - Allow an SQL statement to be built entirely in the dialplan |
618 |
-diff --git a/doc/CHANGES-staging/func_odbc_ARGC_minargs.txt b/doc/CHANGES-staging/func_odbc_ARGC_minargs.txt |
619 |
-new file mode 100644 |
620 |
-index 0000000000..0984b5022d |
621 |
---- /dev/null |
622 |
-+++ b/doc/CHANGES-staging/func_odbc_ARGC_minargs.txt |
623 |
-@@ -0,0 +1,20 @@ |
624 |
-+Subject: func_odbc |
625 |
-+ |
626 |
-+Introduce an ARGC variable for func_odbc functions, along with a minargs |
627 |
-+per-function configuration option. |
628 |
-+ |
629 |
-+minargs enables enforcing of minimum count of arguments to pass to |
630 |
-+func_odbc, so if you're unconditionally using ARG1 through ARG4 then |
631 |
-+this should be set to 4. func_odbc will generate an error in this case, |
632 |
-+so for example |
633 |
-+ |
634 |
-+[FOO] |
635 |
-+minargs = 4 |
636 |
-+ |
637 |
-+and ODBC_FOO(a,b,c) in dialplan will now error out instead of using a |
638 |
-+potentially leaked ARG4 from Gosub(). |
639 |
-+ |
640 |
-+ARGC is needed if you're using optional argument, to verify whether or |
641 |
-+not an argument has been passed, else it's possible to use a leaked ARGn |
642 |
-+from Gosub (app_stack). So now you can safely do |
643 |
-+${IF($[${ARGC}>3]?${ARGV}:default value)} kind of thing. |
644 |
-diff --git a/funcs/func_odbc.c b/funcs/func_odbc.c |
645 |
-index 5cc0faaa98..9d6d0fc304 100644 |
646 |
---- a/funcs/func_odbc.c |
647 |
-+++ b/funcs/func_odbc.c |
648 |
-@@ -120,6 +120,7 @@ struct acf_odbc_query { |
649 |
- char *sql_insert; |
650 |
- unsigned int flags; |
651 |
- int rowlimit; |
652 |
-+ int minargs; |
653 |
- struct ast_custom_function *acf; |
654 |
- }; |
655 |
- |
656 |
-@@ -545,6 +546,14 @@ static int acf_odbc_write(struct ast_channel *chan, const char *cmd, char *s, co |
657 |
- return -1; |
658 |
- } |
659 |
- |
660 |
-+ AST_STANDARD_APP_ARGS(args, s); |
661 |
-+ if (args.argc < query->minargs) { |
662 |
-+ ast_log(LOG_ERROR, "%d arguments supplied to '%s' requiring minimum %d\n", |
663 |
-+ args.argc, cmd, query->minargs); |
664 |
-+ AST_RWLIST_UNLOCK(&queries); |
665 |
-+ return -1; |
666 |
-+ } |
667 |
-+ |
668 |
- if (!chan) { |
669 |
- if (!(chan = ast_dummy_channel_alloc())) { |
670 |
- AST_RWLIST_UNLOCK(&queries); |
671 |
-@@ -578,7 +587,8 @@ static int acf_odbc_write(struct ast_channel *chan, const char *cmd, char *s, co |
672 |
- return -1; |
673 |
- } |
674 |
- |
675 |
-- AST_STANDARD_APP_ARGS(args, s); |
676 |
-+ snprintf(varname, sizeof(varname), "%u", args.argc); |
677 |
-+ pbx_builtin_pushvar_helper(chan, "ARGC", varname); |
678 |
- for (i = 0; i < args.argc; i++) { |
679 |
- snprintf(varname, sizeof(varname), "ARG%d", i + 1); |
680 |
- pbx_builtin_pushvar_helper(chan, varname, args.field[i]); |
681 |
-@@ -603,6 +613,8 @@ static int acf_odbc_write(struct ast_channel *chan, const char *cmd, char *s, co |
682 |
- chan = ast_channel_unref(chan); |
683 |
- } else { |
684 |
- /* Restore prior values */ |
685 |
-+ pbx_builtin_setvar_helper(chan, "ARGC", NULL); |
686 |
-+ |
687 |
- for (i = 0; i < args.argc; i++) { |
688 |
- snprintf(varname, sizeof(varname), "ARG%d", i + 1); |
689 |
- pbx_builtin_setvar_helper(chan, varname, NULL); |
690 |
-@@ -756,6 +768,14 @@ static int acf_odbc_read(struct ast_channel *chan, const char *cmd, char *s, cha |
691 |
- return -1; |
692 |
- } |
693 |
- |
694 |
-+ AST_STANDARD_APP_ARGS(args, s); |
695 |
-+ if (args.argc < query->minargs) { |
696 |
-+ ast_log(LOG_ERROR, "%d arguments supplied to '%s' requiring minimum %d\n", |
697 |
-+ args.argc, cmd, query->minargs); |
698 |
-+ AST_RWLIST_UNLOCK(&queries); |
699 |
-+ return -1; |
700 |
-+ } |
701 |
-+ |
702 |
- if (!chan) { |
703 |
- if (!(chan = ast_dummy_channel_alloc())) { |
704 |
- AST_RWLIST_UNLOCK(&queries); |
705 |
-@@ -768,7 +788,8 @@ static int acf_odbc_read(struct ast_channel *chan, const char *cmd, char *s, cha |
706 |
- ast_autoservice_start(chan); |
707 |
- } |
708 |
- |
709 |
-- AST_STANDARD_APP_ARGS(args, s); |
710 |
-+ snprintf(varname, sizeof(varname), "%u", args.argc); |
711 |
-+ pbx_builtin_pushvar_helper(chan, "ARGC", varname); |
712 |
- for (x = 0; x < args.argc; x++) { |
713 |
- snprintf(varname, sizeof(varname), "ARG%d", x + 1); |
714 |
- pbx_builtin_pushvar_helper(chan, varname, args.field[x]); |
715 |
-@@ -780,6 +801,8 @@ static int acf_odbc_read(struct ast_channel *chan, const char *cmd, char *s, cha |
716 |
- chan = ast_channel_unref(chan); |
717 |
- } else { |
718 |
- /* Restore prior values */ |
719 |
-+ pbx_builtin_setvar_helper(chan, "ARGC", NULL); |
720 |
-+ |
721 |
- for (x = 0; x < args.argc; x++) { |
722 |
- snprintf(varname, sizeof(varname), "ARG%d", x + 1); |
723 |
- pbx_builtin_setvar_helper(chan, varname, NULL); |
724 |
-@@ -1290,6 +1313,10 @@ static int init_acf_query(struct ast_config *cfg, char *catg, struct acf_odbc_qu |
725 |
- sscanf(tmp, "%30d", &((*query)->rowlimit)); |
726 |
- } |
727 |
- |
728 |
-+ if ((tmp = ast_variable_retrieve(cfg, catg, "minargs"))) { |
729 |
-+ sscanf(tmp, "%30d", &((*query)->minargs)); |
730 |
-+ } |
731 |
-+ |
732 |
- (*query)->acf = ast_calloc(1, sizeof(struct ast_custom_function)); |
733 |
- if (!(*query)->acf) { |
734 |
- free_acf_query(*query); |
735 |
--- |
736 |
-2.26.3 |
737 |
- |
738 |
|
739 |
diff --git a/net-misc/asterisk/files/asterisk-13.38.2-r3-func_lock-fix-races.patch b/net-misc/asterisk/files/asterisk-13.38.2-r3-func_lock-fix-races.patch |
740 |
deleted file mode 100644 |
741 |
index 3d3c7b101d47..000000000000 |
742 |
--- a/net-misc/asterisk/files/asterisk-13.38.2-r3-func_lock-fix-races.patch |
743 |
+++ /dev/null |
744 |
@@ -1,421 +0,0 @@ |
745 |
-From b35211fd58afcf430a0d95a243dc7a086d72b2b8 Mon Sep 17 00:00:00 2001 |
746 |
-From: Jaco Kroon <jaco@××××××.za> |
747 |
-Date: Fri, 21 May 2021 20:11:59 +0200 |
748 |
-Subject: [PATCH] Replacement patch for v13. |
749 |
- |
750 |
-Change-Id: I30236d7d7229f317c681fb7c6d7944d6108acd08 |
751 |
---- |
752 |
- funcs/func_lock.c | 234 +++++++++++++++++++++++++--------------------- |
753 |
- 1 file changed, 126 insertions(+), 108 deletions(-) |
754 |
- |
755 |
-diff --git a/funcs/func_lock.c b/funcs/func_lock.c |
756 |
-index a006a574eb..c472504f52 100644 |
757 |
---- a/funcs/func_lock.c |
758 |
-+++ b/funcs/func_lock.c |
759 |
-@@ -44,6 +44,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") |
760 |
- #include "asterisk/linkedlists.h" |
761 |
- #include "asterisk/astobj2.h" |
762 |
- #include "asterisk/utils.h" |
763 |
-+#include "asterisk/cli.h" |
764 |
- |
765 |
- /*** DOCUMENTATION |
766 |
- <function name="LOCK" language="en_US"> |
767 |
-@@ -112,7 +113,6 @@ static AST_LIST_HEAD_STATIC(locklist, lock_frame); |
768 |
- static void lock_free(void *data); |
769 |
- static void lock_fixup(void *data, struct ast_channel *oldchan, struct ast_channel *newchan); |
770 |
- static int unloading = 0; |
771 |
--static pthread_t broker_tid = AST_PTHREADT_NULL; |
772 |
- |
773 |
- static const struct ast_datastore_info lock_info = { |
774 |
- .type = "MUTEX", |
775 |
-@@ -126,8 +126,8 @@ struct lock_frame { |
776 |
- ast_cond_t cond; |
777 |
- /*! count is needed so if a recursive mutex exits early, we know how many times to unlock it. */ |
778 |
- unsigned int count; |
779 |
-- /*! Container of requesters for the named lock */ |
780 |
-- struct ao2_container *requesters; |
781 |
-+ /*! Count of waiting of requesters for the named lock */ |
782 |
-+ unsigned int requesters; |
783 |
- /*! who owns us */ |
784 |
- struct ast_channel *owner; |
785 |
- /*! name of the lock */ |
786 |
-@@ -149,14 +149,19 @@ static void lock_free(void *data) |
787 |
- while ((clframe = AST_LIST_REMOVE_HEAD(oldlist, list))) { |
788 |
- /* Only unlock if we own the lock */ |
789 |
- if (clframe->channel == clframe->lock_frame->owner) { |
790 |
-+ ast_mutex_lock(&clframe->lock_frame->mutex); |
791 |
- clframe->lock_frame->count = 0; |
792 |
- clframe->lock_frame->owner = NULL; |
793 |
-+ ast_cond_signal(&clframe->lock_frame->cond); |
794 |
-+ ast_mutex_unlock(&clframe->lock_frame->mutex); |
795 |
- } |
796 |
- ast_free(clframe); |
797 |
- } |
798 |
- AST_LIST_UNLOCK(oldlist); |
799 |
- AST_LIST_HEAD_DESTROY(oldlist); |
800 |
- ast_free(oldlist); |
801 |
-+ |
802 |
-+ ast_module_unref(ast_module_info->self); |
803 |
- } |
804 |
- |
805 |
- static void lock_fixup(void *data, struct ast_channel *oldchan, struct ast_channel *newchan) |
806 |
-@@ -175,54 +180,11 @@ static void lock_fixup(void *data, struct ast_channel *oldchan, struct ast_chann |
807 |
- if (clframe->lock_frame->owner == oldchan) { |
808 |
- clframe->lock_frame->owner = newchan; |
809 |
- } |
810 |
-- /* We don't move requesters, because the thread stack is different */ |
811 |
- clframe->channel = newchan; |
812 |
- } |
813 |
- AST_LIST_UNLOCK(list); |
814 |
- } |
815 |
- |
816 |
--static void *lock_broker(void *unused) |
817 |
--{ |
818 |
-- struct lock_frame *frame; |
819 |
-- struct timespec forever = { 1000000, 0 }; |
820 |
-- for (;;) { |
821 |
-- int found_requester = 0; |
822 |
-- |
823 |
-- /* Test for cancel outside of the lock */ |
824 |
-- pthread_testcancel(); |
825 |
-- AST_LIST_LOCK(&locklist); |
826 |
-- |
827 |
-- AST_LIST_TRAVERSE(&locklist, frame, entries) { |
828 |
-- if (ao2_container_count(frame->requesters)) { |
829 |
-- found_requester++; |
830 |
-- ast_mutex_lock(&frame->mutex); |
831 |
-- if (!frame->owner) { |
832 |
-- ast_cond_signal(&frame->cond); |
833 |
-- } |
834 |
-- ast_mutex_unlock(&frame->mutex); |
835 |
-- } |
836 |
-- } |
837 |
-- |
838 |
-- AST_LIST_UNLOCK(&locklist); |
839 |
-- pthread_testcancel(); |
840 |
-- |
841 |
-- /* If there are no requesters, then wait for a signal */ |
842 |
-- if (!found_requester) { |
843 |
-- nanosleep(&forever, NULL); |
844 |
-- } else { |
845 |
-- sched_yield(); |
846 |
-- } |
847 |
-- } |
848 |
-- /* Not reached */ |
849 |
-- return NULL; |
850 |
--} |
851 |
-- |
852 |
--static int ast_channel_cmp_cb(void *obj, void *arg, int flags) |
853 |
--{ |
854 |
-- struct ast_channel *chan = obj, *cmp_args = arg; |
855 |
-- return strcasecmp(ast_channel_name(chan), ast_channel_name(cmp_args)) ? 0 : CMP_MATCH; |
856 |
--} |
857 |
-- |
858 |
- static int get_lock(struct ast_channel *chan, char *lockname, int trylock) |
859 |
- { |
860 |
- struct ast_datastore *lock_store = ast_channel_datastore_find(chan, &lock_info, NULL); |
861 |
-@@ -234,7 +196,12 @@ static int get_lock(struct ast_channel *chan, char *lockname, int trylock) |
862 |
- struct timeval now; |
863 |
- |
864 |
- if (!lock_store) { |
865 |
-- ast_debug(1, "Channel %s has no lock datastore, so we're allocating one.\n", ast_channel_name(chan)); |
866 |
-+ if (unloading) { |
867 |
-+ ast_log(LOG_ERROR, "%sLOCK has no datastore and func_lock is unloading, failing.\n", |
868 |
-+ trylock ? "TRY" : ""); |
869 |
-+ return -1; |
870 |
-+ } |
871 |
-+ |
872 |
- lock_store = ast_datastore_alloc(&lock_info, NULL); |
873 |
- if (!lock_store) { |
874 |
- ast_log(LOG_ERROR, "Unable to allocate new datastore. No locks will be obtained.\n"); |
875 |
-@@ -253,6 +220,9 @@ static int get_lock(struct ast_channel *chan, char *lockname, int trylock) |
876 |
- lock_store->data = list; |
877 |
- AST_LIST_HEAD_INIT(list); |
878 |
- ast_channel_datastore_add(chan, lock_store); |
879 |
-+ |
880 |
-+ /* We cannot unload until this channel has released the lock_store */ |
881 |
-+ ast_module_ref(ast_module_info->self); |
882 |
- } else |
883 |
- list = lock_store->data; |
884 |
- |
885 |
-@@ -266,6 +236,9 @@ static int get_lock(struct ast_channel *chan, char *lockname, int trylock) |
886 |
- |
887 |
- if (!current) { |
888 |
- if (unloading) { |
889 |
-+ ast_log(LOG_ERROR, |
890 |
-+ "Lock doesn't exist whilst unloading. %sLOCK will fail.\n", |
891 |
-+ trylock ? "TRY" : ""); |
892 |
- /* Don't bother */ |
893 |
- AST_LIST_UNLOCK(&locklist); |
894 |
- return -1; |
895 |
-@@ -292,17 +265,12 @@ static int get_lock(struct ast_channel *chan, char *lockname, int trylock) |
896 |
- AST_LIST_UNLOCK(&locklist); |
897 |
- return -1; |
898 |
- } |
899 |
-- current->requesters = ao2_container_alloc_list(AO2_ALLOC_OPT_LOCK_MUTEX, 0, |
900 |
-- NULL, ast_channel_cmp_cb); |
901 |
-- if (!current->requesters) { |
902 |
-- ast_mutex_destroy(¤t->mutex); |
903 |
-- ast_cond_destroy(¤t->cond); |
904 |
-- ast_free(current); |
905 |
-- AST_LIST_UNLOCK(&locklist); |
906 |
-- return -1; |
907 |
-- } |
908 |
- AST_LIST_INSERT_TAIL(&locklist, current, entries); |
909 |
- } |
910 |
-+ /* Add to requester list */ |
911 |
-+ ast_mutex_lock(¤t->mutex); |
912 |
-+ current->requesters++; |
913 |
-+ ast_mutex_unlock(¤t->mutex); |
914 |
- AST_LIST_UNLOCK(&locklist); |
915 |
- |
916 |
- /* Found lock or created one - now find or create the corresponding link in the channel */ |
917 |
-@@ -315,7 +283,13 @@ static int get_lock(struct ast_channel *chan, char *lockname, int trylock) |
918 |
- |
919 |
- if (!clframe) { |
920 |
- if (unloading) { |
921 |
-+ ast_log(LOG_ERROR, |
922 |
-+ "Busy unloading. %sLOCK will fail.\n", |
923 |
-+ trylock ? "TRY" : ""); |
924 |
- /* Don't bother */ |
925 |
-+ ast_mutex_lock(¤t->mutex); |
926 |
-+ current->requesters--; |
927 |
-+ ast_mutex_unlock(¤t->mutex); |
928 |
- AST_LIST_UNLOCK(list); |
929 |
- return -1; |
930 |
- } |
931 |
-@@ -324,6 +298,9 @@ static int get_lock(struct ast_channel *chan, char *lockname, int trylock) |
932 |
- ast_log(LOG_ERROR, |
933 |
- "Unable to allocate channel lock frame. %sLOCK will fail.\n", |
934 |
- trylock ? "TRY" : ""); |
935 |
-+ ast_mutex_lock(¤t->mutex); |
936 |
-+ current->requesters--; |
937 |
-+ ast_mutex_unlock(¤t->mutex); |
938 |
- AST_LIST_UNLOCK(list); |
939 |
- return -1; |
940 |
- } |
941 |
-@@ -339,44 +316,44 @@ static int get_lock(struct ast_channel *chan, char *lockname, int trylock) |
942 |
- * the same amount, before we'll release this one. |
943 |
- */ |
944 |
- if (current->owner == chan) { |
945 |
-+ /* We're not a requester, we already have it */ |
946 |
-+ ast_mutex_lock(¤t->mutex); |
947 |
-+ current->requesters--; |
948 |
-+ ast_mutex_unlock(¤t->mutex); |
949 |
- current->count++; |
950 |
- return 0; |
951 |
- } |
952 |
- |
953 |
-- /* Okay, we have both frames, so now we need to try to lock. |
954 |
-- * |
955 |
-- * Locking order: always lock locklist first. We need the |
956 |
-- * locklist lock because the broker thread counts whether |
957 |
-- * there are requesters with the locklist lock held, and we |
958 |
-- * need to hold it, so that when we send our signal, below, |
959 |
-- * to wake up the broker thread, it definitely will see that |
960 |
-- * a requester exists at that point in time. Otherwise, we |
961 |
-- * could add to the requesters after it has already seen that |
962 |
-- * that lock is unoccupied and wait forever for another signal. |
963 |
-- */ |
964 |
-- AST_LIST_LOCK(&locklist); |
965 |
-- ast_mutex_lock(¤t->mutex); |
966 |
-- /* Add to requester list */ |
967 |
-- ao2_link(current->requesters, chan); |
968 |
-- pthread_kill(broker_tid, SIGURG); |
969 |
-- AST_LIST_UNLOCK(&locklist); |
970 |
-- |
971 |
- /* Wait up to three seconds from now for LOCK. */ |
972 |
- now = ast_tvnow(); |
973 |
- timeout.tv_sec = now.tv_sec + 3; |
974 |
- timeout.tv_nsec = now.tv_usec * 1000; |
975 |
- |
976 |
-- if (!current->owner |
977 |
-- || (!trylock |
978 |
-- && !(res = ast_cond_timedwait(¤t->cond, ¤t->mutex, &timeout)))) { |
979 |
-- res = 0; |
980 |
-+ ast_mutex_lock(¤t->mutex); |
981 |
-+ |
982 |
-+ res = 0; |
983 |
-+ while (!trylock && !res && current->owner) { |
984 |
-+ res = ast_cond_timedwait(¤t->cond, ¤t->mutex, &timeout); |
985 |
-+ } |
986 |
-+ if (current->owner) { |
987 |
-+ ast_log(LOG_ERROR, "%sLOCK failed to obtain lock %s.\n", trylock ? "TRY" : "", |
988 |
-+ lockname); |
989 |
-+ /* timeout; |
990 |
-+ * trylock; or |
991 |
-+ * cond_timedwait failed. |
992 |
-+ * |
993 |
-+ * either way, we fail to obtain the lock. |
994 |
-+ */ |
995 |
-+ res = -1; |
996 |
-+ } else { |
997 |
- current->owner = chan; |
998 |
- current->count++; |
999 |
-- } else { |
1000 |
-- res = -1; |
1001 |
-+ res = 0; |
1002 |
- } |
1003 |
- /* Remove from requester list */ |
1004 |
-- ao2_unlink(current->requesters, chan); |
1005 |
-+ current->requesters--; |
1006 |
-+ if (res && unloading) |
1007 |
-+ ast_cond_signal(¤t->cond); |
1008 |
- ast_mutex_unlock(¤t->mutex); |
1009 |
- |
1010 |
- return res; |
1011 |
-@@ -400,7 +377,7 @@ static int unlock_read(struct ast_channel *chan, const char *cmd, char *data, ch |
1012 |
- } |
1013 |
- |
1014 |
- if (!(list = lock_store->data)) { |
1015 |
-- ast_debug(1, "This should NEVER happen\n"); |
1016 |
-+ ast_log(LOG_ERROR, "Datastore's data member is NULL ... this should be impossible."); |
1017 |
- ast_copy_string(buf, "0", len); |
1018 |
- return 0; |
1019 |
- } |
1020 |
-@@ -419,12 +396,17 @@ static int unlock_read(struct ast_channel *chan, const char *cmd, char *data, ch |
1021 |
- |
1022 |
- if (!clframe) { |
1023 |
- /* We didn't have this lock in the first place */ |
1024 |
-+ ast_log(LOG_WARNING, "Attempting to UNLOCK(%s) - a lock this channel never owned.\n", |
1025 |
-+ data); |
1026 |
- ast_copy_string(buf, "0", len); |
1027 |
- return 0; |
1028 |
- } |
1029 |
- |
1030 |
- if (--clframe->lock_frame->count == 0) { |
1031 |
-+ ast_mutex_lock(&clframe->lock_frame->mutex); |
1032 |
- clframe->lock_frame->owner = NULL; |
1033 |
-+ ast_cond_signal(&clframe->lock_frame->cond); |
1034 |
-+ ast_mutex_unlock(&clframe->lock_frame->mutex); |
1035 |
- } |
1036 |
- |
1037 |
- ast_copy_string(buf, "1", len); |
1038 |
-@@ -455,6 +437,37 @@ static int trylock_read(struct ast_channel *chan, const char *cmd, char *data, c |
1039 |
- return 0; |
1040 |
- } |
1041 |
- |
1042 |
-+static char *handle_cli_locks_show(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
1043 |
-+{ |
1044 |
-+ int c = 0; |
1045 |
-+ struct lock_frame* current; |
1046 |
-+ switch (cmd) { |
1047 |
-+ case CLI_INIT: |
1048 |
-+ e->command = "locks show"; |
1049 |
-+ e->usage = |
1050 |
-+ "Usage: locks show\n" |
1051 |
-+ " List all locks known to func_lock, along with their current status.\n"; |
1052 |
-+ return NULL; |
1053 |
-+ case CLI_GENERATE: |
1054 |
-+ return NULL; |
1055 |
-+ } |
1056 |
-+ |
1057 |
-+ ast_cli(a->fd, "func_lock locks:\n"); |
1058 |
-+ ast_cli(a->fd, "%-40s Requesters Owner\n", "Name"); |
1059 |
-+ AST_LIST_LOCK(&locklist); |
1060 |
-+ AST_LIST_TRAVERSE(&locklist, current, entries) { |
1061 |
-+ ast_mutex_lock(¤t->mutex); |
1062 |
-+ ast_cli(a->fd, "%-40s %-10d %s\n", current->name, current->requesters, |
1063 |
-+ current->owner ? ast_channel_name(current->owner) : "(unlocked)"); |
1064 |
-+ ast_mutex_unlock(¤t->mutex); |
1065 |
-+ c++; |
1066 |
-+ } |
1067 |
-+ AST_LIST_UNLOCK(&locklist); |
1068 |
-+ ast_cli(a->fd, "%d total locks listed.\n", c); |
1069 |
-+ |
1070 |
-+ return 0; |
1071 |
-+} |
1072 |
-+ |
1073 |
- static struct ast_custom_function lock_function = { |
1074 |
- .name = "LOCK", |
1075 |
- .read = lock_read, |
1076 |
-@@ -473,6 +486,8 @@ static struct ast_custom_function unlock_function = { |
1077 |
- .read_max = 2, |
1078 |
- }; |
1079 |
- |
1080 |
-+static struct ast_cli_entry cli_locks_show = AST_CLI_DEFINE(handle_cli_locks_show, "List func_lock locks."); |
1081 |
-+ |
1082 |
- static int unload_module(void) |
1083 |
- { |
1084 |
- struct lock_frame *current; |
1085 |
-@@ -480,34 +495,43 @@ static int unload_module(void) |
1086 |
- /* Module flag */ |
1087 |
- unloading = 1; |
1088 |
- |
1089 |
-+ /* Make it impossible for new requesters to be added |
1090 |
-+ * NOTE: channels could already be in get_lock() */ |
1091 |
-+ ast_custom_function_unregister(&lock_function); |
1092 |
-+ ast_custom_function_unregister(&trylock_function); |
1093 |
-+ |
1094 |
-+ ast_cli_unregister(&cli_locks_show); |
1095 |
-+ |
1096 |
- AST_LIST_LOCK(&locklist); |
1097 |
- while ((current = AST_LIST_REMOVE_HEAD(&locklist, entries))) { |
1098 |
-- /* If any locks are currently in use, then we cannot unload this module */ |
1099 |
-- if (current->owner || ao2_container_count(current->requesters)) { |
1100 |
-- /* Put it back */ |
1101 |
-- AST_LIST_INSERT_HEAD(&locklist, current, entries); |
1102 |
-- AST_LIST_UNLOCK(&locklist); |
1103 |
-- unloading = 0; |
1104 |
-- return -1; |
1105 |
-+ int warned = 0; |
1106 |
-+ ast_mutex_lock(¤t->mutex); |
1107 |
-+ while (current->owner || current->requesters) { |
1108 |
-+ if (!warned) { |
1109 |
-+ ast_log(LOG_WARNING, "Waiting for %d requesters for %s lock %s.\n", |
1110 |
-+ current->requesters, current->owner ? "locked" : "unlocked", |
1111 |
-+ current->name); |
1112 |
-+ warned = 1; |
1113 |
-+ } |
1114 |
-+ /* either the mutex is locked, or other parties are currently in get_lock, |
1115 |
-+ * we need to wait for all of those to clear first */ |
1116 |
-+ ast_cond_wait(¤t->cond, ¤t->mutex); |
1117 |
- } |
1118 |
-+ ast_mutex_unlock(¤t->mutex); |
1119 |
-+ /* At this point we know: |
1120 |
-+ * 1. the lock has been released, |
1121 |
-+ * 2. there are no requesters (nor should any be able to sneak in). |
1122 |
-+ */ |
1123 |
- ast_mutex_destroy(¤t->mutex); |
1124 |
-- ao2_ref(current->requesters, -1); |
1125 |
-+ ast_cond_destroy(¤t->cond); |
1126 |
- ast_free(current); |
1127 |
- } |
1128 |
-+ AST_LIST_UNLOCK(&locklist); |
1129 |
-+ AST_LIST_HEAD_DESTROY(&locklist); |
1130 |
- |
1131 |
-- /* No locks left, unregister functions */ |
1132 |
-- ast_custom_function_unregister(&lock_function); |
1133 |
-- ast_custom_function_unregister(&trylock_function); |
1134 |
-+ /* At this point we can safely stop access to UNLOCK */ |
1135 |
- ast_custom_function_unregister(&unlock_function); |
1136 |
- |
1137 |
-- if (broker_tid != AST_PTHREADT_NULL) { |
1138 |
-- pthread_cancel(broker_tid); |
1139 |
-- pthread_kill(broker_tid, SIGURG); |
1140 |
-- pthread_join(broker_tid, NULL); |
1141 |
-- } |
1142 |
-- |
1143 |
-- AST_LIST_UNLOCK(&locklist); |
1144 |
-- |
1145 |
- return 0; |
1146 |
- } |
1147 |
- |
1148 |
-@@ -516,13 +540,7 @@ static int load_module(void) |
1149 |
- int res = ast_custom_function_register_escalating(&lock_function, AST_CFE_READ); |
1150 |
- res |= ast_custom_function_register_escalating(&trylock_function, AST_CFE_READ); |
1151 |
- res |= ast_custom_function_register_escalating(&unlock_function, AST_CFE_READ); |
1152 |
-- |
1153 |
-- if (ast_pthread_create_background(&broker_tid, NULL, lock_broker, NULL)) { |
1154 |
-- ast_log(LOG_ERROR, "Failed to start lock broker thread. Unloading func_lock module.\n"); |
1155 |
-- broker_tid = AST_PTHREADT_NULL; |
1156 |
-- unload_module(); |
1157 |
-- return AST_MODULE_LOAD_DECLINE; |
1158 |
-- } |
1159 |
-+ res |= ast_cli_register(&cli_locks_show); |
1160 |
- |
1161 |
- return res; |
1162 |
- } |
1163 |
--- |
1164 |
-2.26.3 |
1165 |
- |
1166 |
|
1167 |
diff --git a/net-misc/asterisk/files/asterisk-historic-no-var-run-install.patch b/net-misc/asterisk/files/asterisk-historic-no-var-run-install.patch |
1168 |
deleted file mode 100644 |
1169 |
index aa9fb306831f..000000000000 |
1170 |
--- a/net-misc/asterisk/files/asterisk-historic-no-var-run-install.patch |
1171 |
+++ /dev/null |
1172 |
@@ -1,14 +0,0 @@ |
1173 |
-Patch by: Jaco Kroon <jkroon@××××××.za> |
1174 |
-Link: https://bugs.gentoo.org/show_bug.cgi?id=451808 |
1175 |
- |
1176 |
---- a/Makefile 2013-01-17 17:16:59.767081716 +0200 |
1177 |
-+++ b/Makefile 2013-01-17 17:17:45.897600655 +0200 |
1178 |
-@@ -541,7 +541,7 @@ |
1179 |
- |
1180 |
- NEWHEADERS=$(notdir $(wildcard include/asterisk/*.h)) |
1181 |
- OLDHEADERS=$(filter-out $(NEWHEADERS) $(notdir $(DESTDIR)$(ASTHEADERDIR)),$(notdir $(wildcard $(DESTDIR)$(ASTHEADERDIR)/*.h))) |
1182 |
--INSTALLDIRS="$(ASTLIBDIR)" "$(ASTMODDIR)" "$(ASTSBINDIR)" "$(ASTETCDIR)" "$(ASTVARRUNDIR)" \ |
1183 |
-+INSTALLDIRS="$(ASTLIBDIR)" "$(ASTMODDIR)" "$(ASTSBINDIR)" "$(ASTETCDIR)" \ |
1184 |
- "$(ASTSPOOLDIR)" "$(ASTSPOOLDIR)/dictate" "$(ASTSPOOLDIR)/meetme" \ |
1185 |
- "$(ASTSPOOLDIR)/monitor" "$(ASTSPOOLDIR)/system" "$(ASTSPOOLDIR)/tmp" \ |
1186 |
- "$(ASTSPOOLDIR)/voicemail" "$(ASTHEADERDIR)" "$(ASTHEADERDIR)/doxygen" \ |
1187 |
|
1188 |
diff --git a/net-misc/asterisk/files/asterisk.tmpfiles-13.38.3-r2.conf b/net-misc/asterisk/files/asterisk.tmpfiles-13.38.3-r2.conf |
1189 |
deleted file mode 100644 |
1190 |
index dc999ee65fc9..000000000000 |
1191 |
--- a/net-misc/asterisk/files/asterisk.tmpfiles-13.38.3-r2.conf |
1192 |
+++ /dev/null |
1193 |
@@ -1 +0,0 @@ |
1194 |
-d /run/asterisk 0750 asterisk asterisk |
1195 |
|
1196 |
diff --git a/net-misc/asterisk/files/confd-13.32.0 b/net-misc/asterisk/files/confd-13.32.0 |
1197 |
deleted file mode 100644 |
1198 |
index 20e8df4de21c..000000000000 |
1199 |
--- a/net-misc/asterisk/files/confd-13.32.0 |
1200 |
+++ /dev/null |
1201 |
@@ -1,160 +0,0 @@ |
1202 |
-# Copyright 1999-2020 Gentoo Authors |
1203 |
-# Distributed under the terms of the GNU General Public License v2 |
1204 |
- |
1205 |
-# |
1206 |
-# Additional options for asterisk |
1207 |
-# |
1208 |
-# see "asterisk -h" for a list of options |
1209 |
-# |
1210 |
-# No default. |
1211 |
-# |
1212 |
-#ASTERISK_OPTS="" |
1213 |
- |
1214 |
-# |
1215 |
-# User and group to run asterisk as |
1216 |
-# |
1217 |
-# Value: double-colon separated list of user and group, or empty to run as root: |
1218 |
-# |
1219 |
-# |
1220 |
-# "asterisk:asterisk" to run as user "asterisk" and group "asterisk" |
1221 |
-# "asterisk" to run as user "asterisk" and all groups that user "asterisk" is a member of |
1222 |
-# ":asterisk" to run as user "root" and group "asterisk" |
1223 |
-# |
1224 |
-# Default: asterisk |
1225 |
-# |
1226 |
-#ASTERISK_USER="asterisk" |
1227 |
- |
1228 |
-# |
1229 |
-# Nicelevel |
1230 |
-# |
1231 |
-# Set the priority of the asterisk process |
1232 |
-# |
1233 |
-# Value: (highest) -20..19 (lowest) |
1234 |
-# |
1235 |
-# No default (leave scheduling to be system default). |
1236 |
-# |
1237 |
-#ASTERISK_NICE="19" |
1238 |
- |
1239 |
-# Send crash notifications emails to this address |
1240 |
-# (needs a working mail service and /usr/sbin/sendmail to do so (e.g. ssmtp)) |
1241 |
-# |
1242 |
-# Value: Email address or empty to disable |
1243 |
-# |
1244 |
-# No default. |
1245 |
-# |
1246 |
-#ASTERISK_NOTIFY_EMAIL="root" |
1247 |
- |
1248 |
-# |
1249 |
-# Send asterisk's output to this terminal |
1250 |
-# |
1251 |
-# Value: Full path to device node or a number |
1252 |
-# |
1253 |
-# No default. |
1254 |
-# |
1255 |
-#ASTERISK_TTY="/dev/tty9" |
1256 |
- |
1257 |
-# |
1258 |
-# Start an asterisk console on the terminal specified by ASTERISK_TTY |
1259 |
-# |
1260 |
-# Warning! Use only for debugging, this is a potential security issue! |
1261 |
-# |
1262 |
-# Value: yes/no |
1263 |
-# |
1264 |
-# Default: no |
1265 |
-# |
1266 |
-#ASTERISK_CONSOLE="no" |
1267 |
- |
1268 |
-# |
1269 |
-# Maximum size of core files. |
1270 |
-# |
1271 |
-# Value: Size in bytes, unlimited for no limit or empty to disable. |
1272 |
-# |
1273 |
-# Default: do not generate core dumps |
1274 |
-# |
1275 |
-#ASTERISK_CORE_SIZE="unlimited" |
1276 |
- |
1277 |
-# |
1278 |
-# ASTERISK_CORE_DIR |
1279 |
-# |
1280 |
-# Value: Directory (will be created if non-existant). |
1281 |
-# |
1282 |
-# Default: /tmp |
1283 |
-# |
1284 |
-#ASTERISK_CORE_DIR="/var/lib/asterisk/core" |
1285 |
- |
1286 |
-# |
1287 |
-# Max number of filedescriptors. asterisk can trivially run out of |
1288 |
-# descriptors. In most (SIP) cases it uses at least four descriptors per call, |
1289 |
-# and this is a conservative value. |
1290 |
-# |
1291 |
-# Value: Number of descriptors |
1292 |
-# |
1293 |
-# Default: leave system default in place. |
1294 |
-# |
1295 |
-ASTERISK_MAX_FD="4096" |
1296 |
- |
1297 |
-# |
1298 |
-# Delay time before restarting asterisk after a crash. |
1299 |
-# |
1300 |
-# Value: Number of seconds to sleep after a crash before restarting. |
1301 |
-# |
1302 |
-# Default: 5 |
1303 |
-# |
1304 |
-#ASTERISK_RESTART_DELAY=5 |
1305 |
- |
1306 |
-# |
1307 |
-# The stop mechanism to use. Asterisk can do gracefully, when convenient or now. |
1308 |
-# By default we expect you to want to stop as soon as possible, so we default |
1309 |
-# |
1310 |
-# Default: gracefully |
1311 |
-# |
1312 |
-#ASTERISK_STOP_METHOD="when convenient" |
1313 |
- |
1314 |
-# |
1315 |
-# By default the init script waits two minutes for asterisk to stop. This allows |
1316 |
-# you to change that, or even completely disable and go into wait for ever mode (-1). |
1317 |
-# The value here is in seconds. |
1318 |
-# |
1319 |
-# Default: 120 |
1320 |
-# |
1321 |
-#ASTERISK_STOP_TIMEOUT=-1 |
1322 |
- |
1323 |
-# |
1324 |
-# Kill these tasks after asterisk crashed |
1325 |
-# |
1326 |
-# Warning! This will kill _ALL_ tasks with the specified names! |
1327 |
-# |
1328 |
-# Value: Space separated list of names in double quotes (e.g. "mpg123 mad") |
1329 |
-# |
1330 |
-# Default is to not do stupid things like killing random processes. |
1331 |
-# |
1332 |
-#ASTERISK_CLEANUP_ON_CRASH="mpg123 asterisk-mpg123 mad" |
1333 |
- |
1334 |
-# |
1335 |
-# If you'd like an alternative folder to /etc/${RC_SVCNAME} to be used |
1336 |
-# (typically /etc/asterisk) to be used for configuration. |
1337 |
-# |
1338 |
-# Default: /etc/${RC_SVCNAME} |
1339 |
-# |
1340 |
-#ASTERISK_CONFDIR="/etc/foo/bar" |
1341 |
- |
1342 |
-# |
1343 |
-# Normally the init script will not wait for asterisk to fully boot. With this |
1344 |
-# setting set to yes/true/1 it will issue a "core waitfullybooted" directly |
1345 |
-# after starting asterisk, and wait for asterisk to start up completely. This |
1346 |
-# is useful in certain conditions where other software requires asterisk to be |
1347 |
-# properly started before they themselves can be started. |
1348 |
-# |
1349 |
-# Default: no |
1350 |
-# |
1351 |
-#ASTERISK_WAITBOOTED=yes |
1352 |
- |
1353 |
-# |
1354 |
-# When core-dumping, the default was to generate core-$(date +%Y%m%d-%H%M%S). |
1355 |
-# In certain highly unusual configurations it's helpful to also get the |
1356 |
-# hostname into this filename. By enabling this option the wrapper loop will |
1357 |
-# adjust the core file to be named core-$(hostname)-$(date ...). |
1358 |
-# |
1359 |
-# Default: no |
1360 |
-# |
1361 |
-#ASTERISK_CORE_USEHOSTNAME=yes |
1362 |
|
1363 |
diff --git a/net-misc/asterisk/files/initd-13.38.3-r2 b/net-misc/asterisk/files/initd-13.38.3-r2 |
1364 |
deleted file mode 100644 |
1365 |
index 8a4555be7ecd..000000000000 |
1366 |
--- a/net-misc/asterisk/files/initd-13.38.3-r2 |
1367 |
+++ /dev/null |
1368 |
@@ -1,362 +0,0 @@ |
1369 |
-#!/sbin/openrc-run |
1370 |
-# Copyright 1999-2021 Gentoo Authors |
1371 |
-# Distributed under the terms of the GNU General Public License v2 |
1372 |
- |
1373 |
-extra_started_commands="forcestop reload" |
1374 |
- |
1375 |
-depend() { |
1376 |
- need net |
1377 |
- use nscd dns dahdi mysql postgresql slapd capi |
1378 |
-} |
1379 |
- |
1380 |
-is_running() { |
1381 |
- [ -r "${ast_rundir}/asterisk.pid" ] || return 1 |
1382 |
- PID="$(cat "${ast_rundir}/asterisk.pid")" |
1383 |
- [ -d "/proc/${PID}" ] || return 1 |
1384 |
- EXE="$(readlink -f /proc/${PID}/exe)" |
1385 |
- EXE="${EXE% (deleted)}" # in case asterisk got upgraded and we're still looking at an old one. |
1386 |
- [ "${EXE}" = /usr/sbin/asterisk ] || return 1 # pid got re-used for another process. |
1387 |
- |
1388 |
- # PID reported in pidfile is active, and is still an asterisk instance. |
1389 |
- return 0 |
1390 |
-} |
1391 |
- |
1392 |
-# Sets up a few variables for us for use |
1393 |
-# ast_instancename: eg, asterisk when RC_SVCNAME=asterisk, or asterisk(foo) when asterisk.foo. |
1394 |
-# ast_rundir: directory to be used as run folder (pid and ctl files). |
1395 |
-# ast_spooldir: |
1396 |
-setup_svc_variables() |
1397 |
-{ |
1398 |
- local t |
1399 |
- |
1400 |
- ast_instancename=asterisk |
1401 |
- ast_rundir=/run/${RC_SVCNAME} |
1402 |
- ast_logdir=/var/log/${RC_SVCNAME} |
1403 |
- ast_spooldir=/var/spool/${RC_SVCNAME} |
1404 |
- ast_confdir=/etc/${RC_SVCNAME/.//} |
1405 |
- ast_stop_timeout=120 |
1406 |
- ast_stop_method="gracefully" |
1407 |
- |
1408 |
- if [ "${RC_SVCNAME}" != "asterisk" ]; then |
1409 |
- t="${RC_SVCNAME#asterisk.}" |
1410 |
- if [ "${RC_SVCNAME}" = "${t}" ]; then |
1411 |
- eerror "Invalid SVCNAME of ${RC_SVCNAME}, must be of the format asterisk.name." |
1412 |
- return 1 |
1413 |
- fi |
1414 |
- ast_instancename+="(${t})" |
1415 |
- fi |
1416 |
- |
1417 |
- [ -n "${ASTERISK_RUNDIR}" ] && ast_rundir="${ASTERISK_RUNDIR}" |
1418 |
- [ -n "${ASTERISK_LOGDIR}" ] && ast_logdir="${ASTERISK_LOGDIR}" |
1419 |
- [ -n "${ASTERISK_SPOOLDIR}" ] && ast_spooldir="${ASTERISK_SPOOLDIR}" |
1420 |
- [ -n "${ASTERISK_CONFDIR}" ] && ast_confdir="${ASTERISK_CONFDIR}" |
1421 |
- [ -n "${ASTERISK_STOP_TIMEOUT}" ] && ast_stop_timeout="${ASTERISK_STOP_TIMEOUT}" |
1422 |
- case "${ASTERISK_STOP_METHOD}" in |
1423 |
- gracefully|when\ convenient|now) |
1424 |
- ast_stop_method="${ASTERISK_STOP_METHOD}" |
1425 |
- ;; |
1426 |
- esac |
1427 |
- ast_group= |
1428 |
- if [ -n "${ASTERISK_USER}" ]; then |
1429 |
- ast_user="${ASTERISK_USER%%:*}" |
1430 |
- if [ "${ast_user}" != "${ASTERISK_USER}" ]; then |
1431 |
- ast_group="${ASTERISK_USER#*:}" |
1432 |
- ast_group="${ast_group%%:*}" |
1433 |
- fi |
1434 |
- fi |
1435 |
- |
1436 |
- [ -z "${ast_user}" ] && ast_user=asterisk |
1437 |
- |
1438 |
- ast_pgroup="$(getent group $(getent passwd "${ast_user}" | awk -F: '{ print $4 }') | sed -re 's/:.*//')" |
1439 |
- |
1440 |
- return 0 |
1441 |
-} |
1442 |
- |
1443 |
-asterisk_run_loop() { |
1444 |
- local result=0 signal=0 |
1445 |
- |
1446 |
- echo "Initializing ${ast_instancename} wrapper" |
1447 |
- OPTS="$*" |
1448 |
- |
1449 |
- trap "rm -f '${ast_rundir}/wrapper_loop.running'" EXIT |
1450 |
- touch "${ast_rundir}/wrapper_loop.running" |
1451 |
- |
1452 |
- while [ -r "${ast_rundir}/wrapper_loop.running" ]; do |
1453 |
- if [ -n "${TTY}" ]; then |
1454 |
- /usr/bin/stty -F "${TTY}" sane |
1455 |
- ${NICE} /usr/sbin/asterisk -C "${ast_confdir}/asterisk.conf" ${OPTS} >"${TTY}" 2>&1 <"${TTY}" |
1456 |
- result=$? |
1457 |
- else |
1458 |
- ${NICE} /usr/sbin/asterisk -C "${ast_confdir}/asterisk.conf" ${OPTS} >/dev/null 2>&1 |
1459 |
- result=$? |
1460 |
- fi |
1461 |
- |
1462 |
- if [ "$result" -eq 0 ]; then |
1463 |
- echo "Asterisk terminated normally" |
1464 |
- break |
1465 |
- else |
1466 |
- if [ "$result" -gt 128 ]; then |
1467 |
- signal="$(expr "$result" - 128)" |
1468 |
- MSG="Asterisk terminated with Signal: $signal" |
1469 |
- |
1470 |
- CORE_TARGET="core-" |
1471 |
- yesno "${ASTERISK_CORE_USEHOSTNAME}" && CORE_TARGET+="$(hostname)-" |
1472 |
- CORE_TARGET+="$(date "+%Y%m%d-%H%M%S")" |
1473 |
- |
1474 |
- local CORE_DUMPED=0 |
1475 |
- if [ -f "${ASTERISK_CORE_DIR}/core" ]; then |
1476 |
- mv "${ASTERISK_CORE_DIR}/core" \ |
1477 |
- "${ASTERISK_CORE_DIR}/${CORE_TARGET}" |
1478 |
- CORE_DUMPED=1 |
1479 |
- |
1480 |
- elif [ -f "${ASTERISK_CORE_DIR}/core.${PID}" ]; then |
1481 |
- mv "${ASTERISK_CORE_DIR}/core.${PID}" \ |
1482 |
- "${ASTERISK_CORE_DIR}/${CORE_TARGET}" |
1483 |
- CORE_DUMPED=1 |
1484 |
- |
1485 |
- fi |
1486 |
- |
1487 |
- [ $CORE_DUMPED -eq 1 ] && \ |
1488 |
- MSG="${MSG}\n\rCore dumped: ${ASTERISK_CORE_DIR}/${CORE_TARGET}" |
1489 |
- else |
1490 |
- MSG="Asterisk terminated with return code: $result" |
1491 |
- fi |
1492 |
- |
1493 |
- # kill left-over tasks |
1494 |
- for X in ${ASTERISK_CLEANUP_ON_CRASH}; do |
1495 |
- kill -9 "$(pidof "${X}")"; |
1496 |
- done |
1497 |
- fi |
1498 |
- |
1499 |
- [ -n "${TTY}" ] \ |
1500 |
- && echo "${MSG}" >"${TTY}" \ |
1501 |
- || echo "${MSG}" |
1502 |
- |
1503 |
- |
1504 |
- if [ -n "${ASTERISK_NOTIFY_EMAIL}" ] && \ |
1505 |
- [ -x /usr/sbin/sendmail ]; then |
1506 |
- echo -e -n "Subject: Asterisk crashed\r\n${MSG}\r\n" |\ |
1507 |
- /usr/sbin/sendmail "${ASTERISK_NOTIFY_EMAIL}" |
1508 |
- fi |
1509 |
- sleep "${ASTERISK_RESTART_DELAY}" |
1510 |
- echo "Restarting Asterisk..." |
1511 |
- done |
1512 |
- |
1513 |
- echo "Terminating wrapper loop." |
1514 |
- return 0 |
1515 |
-} |
1516 |
- |
1517 |
-start() { |
1518 |
- local OPTS PID |
1519 |
- local tmp x |
1520 |
- |
1521 |
- local OPTS ARGS |
1522 |
- |
1523 |
- setup_svc_variables || return $? |
1524 |
- |
1525 |
- ebegin "Starting ${ast_instancename} PBX" |
1526 |
- |
1527 |
- eindent |
1528 |
- |
1529 |
- # filter (redundant) arguments |
1530 |
- OPTS="$(echo "${ASTERISK_OPTS}" | sed -re "s:-[cfF]::g")" |
1531 |
- |
1532 |
- # default options |
1533 |
- OPTS="${OPTS} -f" # don't fork / detach breaks wrapper script... |
1534 |
- |
1535 |
- # ensure that ASTERISK_RESTART_DELAY is integer. |
1536 |
- ASTERISK_RESTART_DELAY="$(echo "${ASTERISK_RESTART_DELAY}" | sed -re 's/^([0-9]*).*/\1/')" |
1537 |
- [ -z "${ASTERISK_RESTART_DELAY}" ] && ASTERISK_RESTART_DELAY=5 |
1538 |
- |
1539 |
- if [ -n "${ASTERISK_CORE_SIZE}" ] && |
1540 |
- [ "${ASTERISK_CORE_SIZE}" != "0" ]; then |
1541 |
- ulimit -c ${ASTERISK_CORE_SIZE} |
1542 |
- |
1543 |
- if [ -n "${ASTERISK_CORE_DIR}" ] && \ |
1544 |
- [ ! -d "${ASTERISK_CORE_DIR}" ] |
1545 |
- then |
1546 |
- checkpath -d -m 0755 -o ${ast_user}:${ast_group} "${ASTERISK_CORE_DIR}" |
1547 |
- fi |
1548 |
- ASTERISK_CORE_DIR="${ASTERISK_CORE_DIR:-/tmp}" |
1549 |
- |
1550 |
- cd "${ASTERISK_CORE_DIR}" |
1551 |
- einfo "Core dump size : ${ASTERISK_CORE_SIZE}" |
1552 |
- einfo "Core dump location : ${ASTERISK_CORE_DIR}" |
1553 |
- |
1554 |
- OPTS="${OPTS} -g" |
1555 |
- fi |
1556 |
- |
1557 |
- if [ -n "${ASTERISK_MAX_FD}" ]; then |
1558 |
- ulimit -n ${ASTERISK_MAX_FD} |
1559 |
- einfo "Max open filedescriptors : ${ASTERISK_MAX_FD}" |
1560 |
- fi |
1561 |
- |
1562 |
- if [ -n "${ASTERISK_NICE}" ]; then |
1563 |
- if [ ${ASTERISK_NICE} -ge -20 ] && \ |
1564 |
- [ ${ASTERISK_NICE} -le 19 ]; then |
1565 |
- einfo "Nice level : ${ASTERISK_NICE}" |
1566 |
- NICE="nice -n ${ASTERISK_NICE} --" |
1567 |
- else |
1568 |
- eerror "Nice value must be between -20 and 19" |
1569 |
- return 1 |
1570 |
- fi |
1571 |
- else |
1572 |
- NICE="" |
1573 |
- fi |
1574 |
- |
1575 |
- if [ -n "${ASTERISK_NOTIFY_EMAIL}" ]; then |
1576 |
- if [ -x /usr/sbin/sendmail ]; then |
1577 |
- einfo "Email notifications go to : ${ASTERISK_NOTIFY_EMAIL}" |
1578 |
- else |
1579 |
- ewarn "Notifications disabled, /usr/sbin/sendmail doesn't exist or is not executable!" |
1580 |
- unset ASTERISK_NOTIFY_EMAIL |
1581 |
- fi |
1582 |
- fi |
1583 |
- |
1584 |
- if [ -n "${ASTERISK_TTY}" ]; then |
1585 |
- for x in "${ASTERISK_TTY}" \ |
1586 |
- "/dev/tty${ASTERISK_TTY}" \ |
1587 |
- "/dev/vc/${ASTERISK_TTY}" |
1588 |
- do |
1589 |
- if [ -c "${x}" ]; then |
1590 |
- TTY="${x}" |
1591 |
- fi |
1592 |
- done |
1593 |
- [ -n "${TTY}" ] && \ |
1594 |
- einfo "Messages are sent to : ${TTY}" |
1595 |
- fi |
1596 |
- |
1597 |
- if yesno "${ASTERISK_CONSOLE}" && [ -n "${TTY}" ]; then |
1598 |
- einfo "Starting Asterisk console : Yes" |
1599 |
- OPTS="${OPTS} -c" |
1600 |
- fi |
1601 |
- |
1602 |
- if ! getent passwd "${ast_user}" &>/dev/null; then |
1603 |
- eerror "Requested to run asterisk as ${ast_user}, which doesn't exist." |
1604 |
- return 1 |
1605 |
- fi |
1606 |
- OPTS="${OPTS} -U ${ast_user}" |
1607 |
- |
1608 |
- if [ -n "${ast_group}" ] && ! getent group "${ast_group}" &>/dev/null; then |
1609 |
- eerror "Requested to run ${ast_instancename} with group ${ast_group}, which doesn't exist." |
1610 |
- return 1 |
1611 |
- fi |
1612 |
- [ -n "${ast_group}" ] && OPTS="${OPTS} -G ${ast_group}" |
1613 |
- |
1614 |
- if [ "${ast_user}" = root ]; then |
1615 |
- ewarn "Starting asterisk as root is not recommended (SERIOUS SECURITY CONSIDERATIONS)." |
1616 |
- elif [ "${ast_group}" = root ]; then |
1617 |
- ewarn "Starting asterisk with group root is not recommended (SERIOUS SECURITY CONSIDERATIONS)." |
1618 |
- fi |
1619 |
- |
1620 |
- checkpath -d -m 0755 -o "${ast_user}:${ast_group}" "${ast_logdir}" "${ast_rundir}" |
1621 |
- einfo "Starting asterisk as : ${ast_user}:${ast_group:-${ast_pgroup} (+supplementaries)}" |
1622 |
- asterisk_run_loop ${OPTS} 2>&1 | logger -t "wrapper:${ast_instancename}" &>/dev/null & |
1623 |
- result=$? |
1624 |
- |
1625 |
- if [ $result -eq 0 ]; then |
1626 |
- # 2 seconds should be enough for asterisk to start |
1627 |
- sleep 2 |
1628 |
- is_running |
1629 |
- result=$? |
1630 |
- |
1631 |
- [ $result -eq 0 ] || wrapperstop |
1632 |
- fi |
1633 |
- |
1634 |
- eoutdent |
1635 |
- eend $result |
1636 |
- |
1637 |
- if [ $result -eq 0 ] && yesno "${ASTERISK_WAITBOOTED}"; then |
1638 |
- if [ ! -r "${ast_rundir}/asterisk.ctl" ]; then |
1639 |
- # asterisk can crash during startup ... |
1640 |
- ebegin "Waiting for ctl file to appear" |
1641 |
- while is_running && [ ! -r "${ast_rundir}/asterisk.ctl" ]; do |
1642 |
- sleep 1 |
1643 |
- done |
1644 |
- is_running |
1645 |
- result=$? |
1646 |
- eend $result |
1647 |
- fi |
1648 |
- if [ $result -eq 0 ]; then |
1649 |
- ebegin "Waiting for ${ast_instancename} to fully boot" |
1650 |
- /usr/sbin/asterisk -C "${ast_confdir}/asterisk.conf" -r -x "core waitfullybooted" &>/dev/null |
1651 |
- eend $? |
1652 |
- fi |
1653 |
- fi |
1654 |
- |
1655 |
- return $result |
1656 |
-} |
1657 |
- |
1658 |
-wrapperstop() { |
1659 |
- # Accomodate system upgrades (so a previous version of the wrapper script that still uses a pid file may be running). |
1660 |
- if [ -r "${ast_rundir}/wrapper_loop.pid" ]; then |
1661 |
- ebegin "Killing ${ast_instancename} wrapper script" |
1662 |
- kill "$(cat /run/asterisk/wrapper_loop.pid)" |
1663 |
- eend $? |
1664 |
- fi |
1665 |
- |
1666 |
- # The new one (due to "hardened" requirements) uses a simpler |
1667 |
- # flag to indicate running or shutting down. |
1668 |
- if [ -r "${ast_rundir}/wrapper_loop.running" ]; then |
1669 |
- ebegin "Signalling ${ast_instancename} wrapper script to terminate" |
1670 |
- rm "${ast_rundir}/wrapper_loop.running" |
1671 |
- eend $? |
1672 |
- fi |
1673 |
- |
1674 |
- return 0 |
1675 |
-} |
1676 |
- |
1677 |
-forcestop() { |
1678 |
- setup_svc_variables || return $? |
1679 |
- |
1680 |
- # Just to be sure - when we want to forcestop we should make it all tear down. |
1681 |
- wrapperstop |
1682 |
- |
1683 |
- ebegin "Stopping ${ast_instancename} PBX" |
1684 |
- start-stop-daemon --stop --pidfile /run/asterisk/asterisk.pid |
1685 |
- eend $? |
1686 |
-} |
1687 |
- |
1688 |
-stop() { |
1689 |
- setup_svc_variables || return $? |
1690 |
- |
1691 |
- wrapperstop |
1692 |
- |
1693 |
- if ! is_running; then |
1694 |
- eerror "${ast_instancename} is not running!" |
1695 |
- return 0 |
1696 |
- fi |
1697 |
- |
1698 |
- ebegin "Stopping ${ast_instancename} PBX ${ast_stop_method}" |
1699 |
- /usr/sbin/asterisk -C "${ast_confdir}/asterisk.conf" -r -x "core stop ${ast_stop_method}" &>/dev/null |
1700 |
- # Now we have to wait until asterisk has _really_ stopped. |
1701 |
- sleep 1 |
1702 |
- if is_running; then |
1703 |
- einfon "Waiting for ${ast_instancename} to shutdown ." |
1704 |
- local cnt=0 |
1705 |
- while is_running; do |
1706 |
- cnt="$(expr $cnt + 2)" |
1707 |
- if [ ${ast_stop_timeout} -gt 0 -a $cnt -gt ${ast_stop_timeout} ] ; then |
1708 |
- echo |
1709 |
- eend 1 "Failed waiting for ${ast_instancename} to stop." |
1710 |
- return 1 |
1711 |
- fi |
1712 |
- sleep 2 |
1713 |
- echo -n "." |
1714 |
- done |
1715 |
- echo |
1716 |
- fi |
1717 |
- eend 0 |
1718 |
-} |
1719 |
- |
1720 |
-reload() { |
1721 |
- setup_svc_variables || return $? |
1722 |
- |
1723 |
- if is_running; then |
1724 |
- ebegin "Forcing ${ast_instancename} to reload configuration" |
1725 |
- /usr/sbin/asterisk -C "${ast_confdir}/asterisk.conf" -r -x "module reload" &>/dev/null |
1726 |
- eend $? |
1727 |
- else |
1728 |
- eerror "${ast_instancename} is not running!" |
1729 |
- fi |
1730 |
-} |