]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/commitdiff
Added patch for https://issues.asterisk.org/jira/browse/ASTERISK-18345
authorDirk Wagner <dirk.wagner@ipfire.org>
Mon, 9 Jun 2014 10:20:21 +0000 (12:20 +0200)
committerDirk Wagner <dirk.wagner@ipfire.org>
Mon, 9 Jun 2014 10:20:21 +0000 (12:20 +0200)
lfs/asterisk
src/patches/asterisk-ssl-reader-should-block.patch [new file with mode: 0644]

index 54c3d5df139bd2f898d6588679bcf7ccfd1a5f78..5743c18862071b5799babe3f13c63e838d70abfa 100755 (executable)
@@ -37,19 +37,19 @@ DEPS       = "sqlite"
 ###############################################################################
 
 objects = $(DL_FILE) \
-       srtp-1.4.2.tar.gz \
+       libsrtp-1.4.5-99426a54.tar.gz \
        asterisk-1.4-de-prompts.tar.gz \
        asterisk-extra-sounds-en-gsm-1.4.14.tar.gz \
        asterisk-moh-opsound-gsm-2.03.tar.gz 
 
 $(DL_FILE) = $(DL_FROM)/$(DL_FILE)
-srtp-1.4.2.tar.gz = $(URL_IPFIRE)/srtp-1.4.2.tar.gz
+libsrtp-1.4.5-99426a54.tar.gz = $(URL_IPFIRE)/libsrtp-1.4.5-99426a54.tar.gz
 asterisk-extra-sounds-en-gsm-1.4.14.tar.gz = $(URL_IPFIRE)/asterisk-extra-sounds-en-gsm-1.4.14.tar.gz
 asterisk-moh-opsound-gsm-2.03.tar.gz = $(URL_IPFIRE)/asterisk-moh-opsound-gsm-2.03.tar.gz
 asterisk-1.4-de-prompts.tar.gz = $(URL_IPFIRE)/asterisk-1.4-de-prompts.tar.gz
 
 $(DL_FILE)_MD5 = 743e7dc0112e24f794453443b17ce42b
-srtp-1.4.2.tar.gz_MD5 = 7b0ffbfad9bbaf33d397027e031cb35a
+libsrtp-1.4.5-99426a54.tar.gz_MD5 = 05bfbe63a2a27343889c2436c836110a
 asterisk-extra-sounds-en-gsm-1.4.14.tar.gz_MD5 = ffc2e0ffd783c03fef5b75277dba0896
 asterisk-moh-opsound-gsm-2.03.tar.gz_MD5 = 09066f55f1358f298bc1a6e4678a3ddf
 asterisk-1.4-de-prompts.tar.gz_MD5 = 626a2b95071a5505851e43874dfbfd5c
@@ -86,15 +86,16 @@ $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
        @$(PREBUILD)
 
        # build srtp
-       @rm -rf $(DIR_SRC)/srtp && cd $(DIR_SRC) && tar zxf $(DIR_DL)/srtp-1.4.2.tar.gz
-       cd $(DIR_SRC)/srtp && ./configure --prefix=/usr && make uninstall && make && make install
+       @rm -rf $(DIR_SRC)/srtp && cd $(DIR_SRC) && tar zxf $(DIR_DL)/libsrtp-1.4.5-99426a54.tar.gz
+       cd $(DIR_SRC)/libsrtp-1.4.5 && ./configure --prefix=/usr && make uninstall && make && make install
 
        # remove old directories and extract asterisk
        @rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar zxf $(DIR_DL)/$(DL_FILE)
 
        # patch asterisk
        cd $(DIR_APP) && patch -p4 < $(DIR_SRC)/src/patches/asterisk-no-ffmpeg.patch
-       
+       cd $(DIR_APP) && patch -p1 < $(DIR_SRC)/src/patches/asterisk-ssl-reader-should-block.patch      
+
        # configure asterisk
        cd $(DIR_APP) && ./configure --prefix=/usr --sysconfdir=/var/ipfire \
                --without-oss \
@@ -148,7 +149,7 @@ $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
        ln -f -s /var/ipfire/asterisk/wakeup/wakeup.sh /etc/fcron.minutely/wakeup.sh
 
        # be sure all source is removed
-       @rm -rf $(DIR_APP) $(DIR_SRC)/asterisk-*
+       @rm -rf $(DIR_APP) $(DIR_SRC)/asterisk-* $(DIR_SRC)/libsrtp*
 
        # remember backup-location
        install -v -m 644 $(DIR_SRC)/config/backup/includes/asterisk /var/ipfire/backup/addons/includes/asterisk
diff --git a/src/patches/asterisk-ssl-reader-should-block.patch b/src/patches/asterisk-ssl-reader-should-block.patch
new file mode 100644 (file)
index 0000000..3b2f0ed
--- /dev/null
@@ -0,0 +1,28 @@
+Upstream issue 18345
+Link: https://issues.asterisk.org/jira/browse/ASTERISK-18345
+Patch-By: Filip Jenicek
+
+Submitted upstream:   2012-05-31 09:12
+For Asterisk version: 1.8.4
+
+The HOOK_T ssl_read function should behave the same way as the system read function 
+by blocking and waiting for (more) data from the SSL subsystem. Failure to do this 
+will drop data on the floor and ultimately disconnect SSL clients.
+
+--- asterisk/main/tcptls.c
++++ asterisk/main/tcptls.c
+@@ -55,6 +55,14 @@
+ static HOOK_T ssl_read(void *cookie, char *buf, LEN_T len)
+ {
+       int i = SSL_read(cookie, buf, len-1);
++
++      /* ssl_read should block and wait for the SSL layer to provide all data */
++      while (i < 0 && SSL_get_error(cookie, i) == SSL_ERROR_WANT_READ) {
++              ast_debug(1, "SSL_read - data not ready.\n");
++              if (ast_wait_for_input(SSL_get_fd(cookie), 5000) <= 0) return 0;
++              i = SSL_read(cookie, buf, len-1);
++      }
++
+ #if 0
+       if (i >= 0)
+               buf[i] = '\0';