aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2017-01-12 08:28:58 +0200
committerTimo Teräs <timo.teras@iki.fi>2017-01-12 08:28:58 +0200
commit74cb67a0f5c64a0b2d56a97e61edd436b3cf97dc (patch)
tree87c0af52ad7b0f9dd2c10ea6d5563d7d28a32433
parentefe30cbdc12299aa0b809bb92ddf68215dab313e (diff)
downloadaports-74cb67a0f5c64a0b2d56a97e61edd436b3cf97dc.tar.bz2
main/asterisk: cherry-pick upstream follow-up fixes for ASTERISK-24517
-rw-r--r--main/asterisk/APKBUILD8
-rw-r--r--main/asterisk/ASTERISK-24517.patch226
2 files changed, 230 insertions, 4 deletions
diff --git a/main/asterisk/APKBUILD b/main/asterisk/APKBUILD
index 1bbf81c..643e04e 100644
--- a/main/asterisk/APKBUILD
+++ b/main/asterisk/APKBUILD
@@ -3,7 +3,7 @@
# Maintainer: Timo Teras <timo.teras@iki.fi>
pkgname=asterisk
pkgver=14.2.1
-pkgrel=0
+pkgrel=1
pkgdesc="Asterisk: A Module Open Source PBX System"
pkgusers="asterisk"
pkggroups="asterisk"
@@ -239,7 +239,7 @@ sound_en() {
md5sums="e65daf9b1d65b8047b2117f21587ab35 asterisk-14.2.1.tar.gz
126dd4fba66f4cf9aa94dfd7034e0ec4 asterisk-addon-mp3-r201.patch.gz
-f94277819ef99d2f67654176e0752267 ASTERISK-24517.patch
+5f8eaac5d48c47033028abec56a881a5 ASTERISK-24517.patch
b562be4a764d275dad87682642b56ee3 fix-strerror_r.patch
1ca5e8326dc03c963a7ce5455d0f21ba musl-mutex-init.patch
4bdc82ba3d6bdfdedc71e5da2fde5ec2 asterisk.initd
@@ -247,7 +247,7 @@ ed31d7ba37bcf8b0346dcf8593c395f0 asterisk.confd
3e65172275684373e1a25c8a11224411 asterisk.logrotate"
sha256sums="b28b5131233db6c89bb3356c703033ec8a393ae378e4aae169993b60a5877ea4 asterisk-14.2.1.tar.gz
d32a5a695cee1699011d0e9ad02eb43af612def06f92017627194099edf98e3f asterisk-addon-mp3-r201.patch.gz
-909581915ce1c674a575212040cf94395eda90405aa0f327824e6a518dc94e43 ASTERISK-24517.patch
+98a49e7241e0c7a7dd814ed472aa1b3be9b1ee3f2966c286fd8a3e11c7c278ae ASTERISK-24517.patch
546c0d60e08a17e7b888baada693a08608c3d4f54709e2959305c4a772bb8158 fix-strerror_r.patch
a5205ed44b57a72934baf8cde543ddb179f277494181818905110bfdcccfe7d9 musl-mutex-init.patch
10454553733e6cc52c6e9db508768a638655d99c095c5b39fb043858c088f21f asterisk.initd
@@ -255,7 +255,7 @@ d221148583b57f9c37d7160f2493f0d204ad11f7abb17e3a3534e108ad5452d7 asterisk.confd
77b253b6db71460acf9a51e87ad4c8582027a46db01a4c50fb048bada58c19d1 asterisk.logrotate"
sha512sums="cac5b9cb94f72cd2d60723ecf3cba15b2d19cbc29a5df6678481699f4f0344aa41d60cbce8bed8c863d5be7d3264c30bac3a90978b5b66ffde5652fa681c842f asterisk-14.2.1.tar.gz
aacef3f4796fb1abd33266998b53909cb4b36e7cc5ad2f7bac68bdc43e9a9072d9a4e2e7e681bddfa31f3d04575eb248afe6ea95da780c67e4829c1e22adfe1b asterisk-addon-mp3-r201.patch.gz
-cbd936685657505bf95d5284d154d6d3e3ff59e01dffd3a88f8bf8284392281137258aa31ec071d7af297034301ab22583661cd8b88a7a8fcdf6cfaaa97d6cea ASTERISK-24517.patch
+e0b43c8a0a7e041d5853f7508ebff747616d9745449ab4a5d28788fbe076f0e9d49dc7f9e818f5b55fd430c625d1d5ec8d8f7fe6f7c56315f16180ce405cf282 ASTERISK-24517.patch
46f661b5056a571181adfd93a34c836e2df091e1bfd400e0c09794f43b097c4401f47bf8f4b620a1549fa90bf287b3018d803c102c6c7835a67c4c85ea5c2e76 fix-strerror_r.patch
f72c2e04de80d3ed9ce841308101383a1655e6da7a3c888ad31fffe63d1280993e08aefcf8e638316d439c68b38ee05362c87503fca1f36343976a01af9d6eb1 musl-mutex-init.patch
cd5bd1c1d7db0a44b14eb10e6d098af0c6474c8fe1a57395090d6795ac00e9243d004b7d24eba2cfd5bd6d6407c271913e794551a8dfcf3cf93e89fc91349e12 asterisk.initd
diff --git a/main/asterisk/ASTERISK-24517.patch b/main/asterisk/ASTERISK-24517.patch
index 607d1f8..271676b 100644
--- a/main/asterisk/ASTERISK-24517.patch
+++ b/main/asterisk/ASTERISK-24517.patch
@@ -3098,3 +3098,229 @@ index 2e4f873..1b77b9f 100644
--
2.10.2
+From e3dae763ee77485bcbcf8818d2b8c9570afe3013 Mon Sep 17 00:00:00 2001
+From: Joshua Colp <jcolp@digium.com>
+Date: Mon, 28 Nov 2016 13:36:18 +0000
+Subject: [PATCH] iostream: Move include of asterisk.h
+
+The asterisk.h header file needs to be included first or else
+some things go awry, such as:
+
+implicit declaration of function 'vasprintf'
+
+Change-Id: I981dc2a77a1ba791888e4f1726644d4656c0407c
+---
+ main/iostream.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/main/iostream.c b/main/iostream.c
+index 46abc18a5c..008888142b 100644
+--- a/main/iostream.c
++++ b/main/iostream.c
+@@ -16,10 +16,11 @@
+ * at the top of the source tree.
+ */
+
++#include "asterisk.h"
++
+ #include <fcntl.h>
+ #include <stdarg.h>
+
+-#include "asterisk.h"
+ #include "asterisk/utils.h"
+ #include "asterisk/astobj2.h"
+ #include "asterisk/iostream.h"
+--
+2.11.0
+
+From bf6423a33678d95896cfb6325572dab3a23e6d6a Mon Sep 17 00:00:00 2001
+From: Mark Michelson <mmichelson@digium.com>
+Date: Tue, 6 Dec 2016 10:56:06 -0600
+Subject: [PATCH] Iostreams: Correct off-by-one error.
+
+ast_iostream_printf() attempts first to use a fixed-size buffer to
+perform its printf-like operation. If the fixed-size buffer is too
+small, then a heap allocation is used instead. The heap allocation in
+this case was exactly the length of the string to print. The issue here
+is that the ensuing call to vsnprintf() will print a NULL byte in the
+final space of the string. This meant that the final character was being
+chopped off the string and replaced with a NULL byte. For HTTP in
+particular, this caused problems because HTTP publishes the expected
+Contact-Length. This meant HTTP was publishing a length one character
+larger than what was actually present in the message.
+
+This patch corrects the issue by adding one to the allocation length.
+
+ASTERISK-26629
+Reported by Joshua Colp
+
+Change-Id: Ib3c5f41e96833d0415cf000656ac368168add639
+---
+ main/iostream.c | 13 ++++++++-----
+ 1 file changed, 8 insertions(+), 5 deletions(-)
+
+diff --git a/main/iostream.c b/main/iostream.c
+index a20a048964..22cd5985c4 100644
+--- a/main/iostream.c
++++ b/main/iostream.c
+@@ -404,7 +404,7 @@ ssize_t ast_iostream_write(struct ast_iostream *stream, const void *buf, size_t
+
+ ssize_t ast_iostream_printf(struct ast_iostream *stream, const void *fmt, ...)
+ {
+- char sbuf[256], *buf = sbuf;
++ char sbuf[512], *buf = sbuf;
+ int len, len2, ret = -1;
+ va_list va;
+
+@@ -412,15 +412,18 @@ ssize_t ast_iostream_printf(struct ast_iostream *stream, const void *fmt, ...)
+ len = vsnprintf(buf, sizeof(sbuf), fmt, va);
+ va_end(va);
+
+- if (len > sizeof(sbuf)) {
+- buf = ast_malloc(len);
++ if (len > sizeof(sbuf) - 1) {
++ /* Add one to the string length to accommodate the NULL byte */
++ size_t buf_len = len + 1;
++
++ buf = ast_malloc(buf_len);
+ if (!buf) {
+ return -1;
+ }
+ va_start(va, fmt);
+- len2 = vsnprintf(buf, len, fmt, va);
++ len2 = vsnprintf(buf, buf_len, fmt, va);
+ va_end(va);
+- if (len2 > len) {
++ if (len2 != len) {
+ goto error;
+ }
+ }
+--
+2.11.0
+
+From 503006123a9eecdaedf74295367af99578f021b7 Mon Sep 17 00:00:00 2001
+From: Mark Michelson <mmichelson@digium.com>
+Date: Thu, 1 Dec 2016 16:49:03 -0600
+Subject: [PATCH] http: Send headers and body in one write.
+
+This is a semi-regression caused by the iostreams change. Prior to
+iostreams, HTTP headers were written to a FILE handle using fprintf.
+Then the body was written using a call to fwrite(). Because of internal
+buffering, the result was that the HTTP headers and body would be sent
+out in a single write to the socket.
+
+With the change to iostreams, the HTTP headers are written using
+ast_iostream_printf(), which under the hood calls write(). The HTTP body
+calls ast_iostream_write(), which also calls write() under the hood.
+This results in two separate writes to the socket.
+
+Most HTTP client libraries out there will handle this change just fine.
+However, a few of our testsuite tests started failing because of the
+change. As a result, in order to reduce frustration for users, this
+change alters the HTTP code to write the headers and body in a single
+write operation.
+
+ASTERISK-26629 #close
+Reported by Joshua Colp
+
+Change-Id: Idc2d2fb3d9b3db14b8631a1e302244fa18b0e518
+---
+ main/http.c | 29 ++++++++++++-----------------
+ 1 file changed, 12 insertions(+), 17 deletions(-)
+
+diff --git a/main/http.c b/main/http.c
+index 9aff4d1676..5f57b1eb01 100644
+--- a/main/http.c
++++ b/main/http.c
+@@ -454,6 +454,7 @@ void ast_http_send(struct ast_tcptls_session_instance *ser,
+ int content_length = 0;
+ int close_connection;
+ struct ast_str *server_header_field = ast_str_create(MAX_SERVER_NAME_LENGTH);
++ int send_content;
+
+ if (!ser || !server_header_field) {
+ /* The connection is not open. */
+@@ -504,6 +505,8 @@ void ast_http_send(struct ast_tcptls_session_instance *ser,
+ lseek(fd, 0, SEEK_SET);
+ }
+
++ send_content = method != AST_HTTP_HEAD || status_code >= 400;
++
+ /* send http header */
+ ast_iostream_printf(ser->stream,
+ "HTTP/1.1 %d %s\r\n"
+@@ -513,33 +516,25 @@ void ast_http_send(struct ast_tcptls_session_instance *ser,
+ "%s"
+ "%s"
+ "Content-Length: %d\r\n"
+- "\r\n",
++ "\r\n"
++ "%s",
+ status_code, status_title ? status_title : "OK",
+ ast_str_buffer(server_header_field),
+ timebuf,
+ close_connection ? "Connection: close\r\n" : "",
+ static_content ? "" : "Cache-Control: no-cache, no-store\r\n",
+ http_header ? ast_str_buffer(http_header) : "",
+- content_length
++ content_length,
++ send_content && out && ast_str_strlen(out) ? ast_str_buffer(out) : ""
+ );
+
+ /* send content */
+- if (method != AST_HTTP_HEAD || status_code >= 400) {
+- if (out && ast_str_strlen(out)) {
+- len = ast_str_strlen(out);
+- if (ast_iostream_write(ser->stream, ast_str_buffer(out), len) != len) {
+- ast_log(LOG_ERROR, "fwrite() failed: %s\n", strerror(errno));
++ if (send_content && fd) {
++ while ((len = read(fd, buf, sizeof(buf))) > 0) {
++ if (ast_iostream_write(ser->stream, buf, len) != len) {
++ ast_log(LOG_WARNING, "fwrite() failed: %s\n", strerror(errno));
+ close_connection = 1;
+- }
+- }
+-
+- if (fd) {
+- while ((len = read(fd, buf, sizeof(buf))) > 0) {
+- if (ast_iostream_write(ser->stream, buf, len) != len) {
+- ast_log(LOG_WARNING, "fwrite() failed: %s\n", strerror(errno));
+- close_connection = 1;
+- break;
+- }
++ break;
+ }
+ }
+ }
+--
+2.11.0
+
+From 149d8db96ce4390f52be84d5846b053e02e6b907 Mon Sep 17 00:00:00 2001
+From: Badalyan Vyacheslav <v.badalyan@open-bs.ru>
+Date: Thu, 8 Dec 2016 18:34:28 +0000
+Subject: [PATCH] Fix IO conversion bug
+
+Expression 'rlen < 0' is always false.
+Unsigned type value is never < 0.
+
+Change-Id: Id9f393ff25b009a6c4a6e40b95f561a9369e4585
+---
+ res/res_http_websocket.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/res/res_http_websocket.c b/res/res_http_websocket.c
+index 106ba488be..84138234eb 100644
+--- a/res/res_http_websocket.c
++++ b/res/res_http_websocket.c
+@@ -490,7 +490,7 @@ const char * AST_OPTIONAL_API_NAME(ast_websocket_session_id)(struct ast_websocke
+ */
+ static inline int ws_safe_read(struct ast_websocket *session, char *buf, int len, enum ast_websocket_opcode *opcode)
+ {
+- size_t rlen;
++ ssize_t rlen;
+ int xlen = len;
+ char *rbuf = buf;
+ int sanity = 10;
+--
+2.11.0
+