]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
lzma: make mandatory
authorVictor Julien <victor@inliniac.net>
Tue, 27 Aug 2019 08:48:50 +0000 (10:48 +0200)
committerVictor Julien <victor@inliniac.net>
Tue, 3 Sep 2019 11:25:20 +0000 (13:25 +0200)
Libhtp is starting to use it as well, so its safe to make it mandatory
here.

Remove guards for flash file decompression code.

configure.ac
src/tests/detect-http-server-body.c
src/util-file-decompression.c
src/util-file-swf-decompression.c
src/util-file-swf-decompression.h

index 61253e2e108d57ef8f1050b8b3ba9def8fd6fa47..4b0dbfd4aa3aa8e51d976ef3f14d64fe62548d73 100644 (file)
                 if test "$with_liblzma_libraries" != "no"; then
                     LDFLAGS="${LDFLAGS}  -L${with_liblzma_libraries}"
                     LIBS="${TMPLIBS} -llzma"
-               else
-                   LIBS="${TMPLIBS} -llzma"
+                else
+                    LIBS="${TMPLIBS} -llzma"
                 fi
             fi]),LIBLZMA="no")
 
     if test "$LIBLZMA" != "yes"; then
         echo
-        echo "   Warning! liblzma library not found, you will not be"
-        echo "   able to decompress flash file compressed with lzma."
+        echo "   Error! liblzma library not found."
         echo "   Debian/Ubuntu: apt install liblzma-dev"
         echo "   Fedora: dnf install xz-devel"
         echo "   CentOS/RHEL: yum install xz-devel"
         echo
-        enable_liblzma=no
-    else
-        enable_liblzma=yes
-        LIBS="${TMPLIBS} -llzma"
+        exit 1
     fi
+    enable_liblzma=yes
+    LIBS="${TMPLIBS} -llzma"
 
   #libpcre
     AC_ARG_WITH(libpcre_includes,
index 2c768e3a29a806afb2b614c3d5576ca7201cb836..3b63794930172f59ad48c3e80fe483367eb566a8 100644 (file)
@@ -4638,7 +4638,6 @@ libhtp:\n\
 
 static int DetectEngineHttpServerBodyFileDataTest24(void)
 {
-#ifdef HAVE_LIBLZMA
     char input[] = "\
 %YAML 1.1\n\
 ---\n\
@@ -4763,9 +4762,6 @@ libhtp:\n\
     UTHFreePackets(&p1, 1);
     UTHFreePackets(&p2, 1);
     PASS;
-#else
-    PASS;
-#endif /* HAVE_LIBLZMA */
 }
 
 static int DetectEngineHttpServerBodyFileDataTest25(void)
@@ -4895,7 +4891,6 @@ libhtp:\n\
 
 static int DetectEngineHttpServerBodyFileDataTest26(void)
 {
-#ifdef HAVE_LIBLZMA
     char input[] = "\
 %YAML 1.1\n\
 ---\n\
@@ -5019,9 +5014,6 @@ libhtp:\n\
     UTHFreePackets(&p1, 1);
     UTHFreePackets(&p2, 1);
     PASS;
-#else
-    PASS;
-#endif /* HAVE_LIBLZMA */
 }
 
 static int DetectEngineHttpServerBodyFileDataTest27(void)
index 43f323f5c0cc07e0d46bb595c87450cbd261f8d1..9009845a1012972d565e0a027499a81625df6bf7 100644 (file)
@@ -165,9 +165,6 @@ int FileSwfDecompression(const uint8_t *buffer, uint32_t buffer_len,
     } else if ((swf_type == HTTP_SWF_COMPRESSION_LZMA || swf_type == HTTP_SWF_COMPRESSION_BOTH) &&
                compression_type == FILE_SWF_LZMA_COMPRESSION)
     {
-#ifndef HAVE_LIBLZMA
-        goto error;
-#else
         /* we need to setup the lzma header */
         /*
          * | 5 bytes         | 8 bytes             | n bytes         |
@@ -190,7 +187,6 @@ int FileSwfDecompression(const uint8_t *buffer, uint32_t buffer_len,
                                      out_buffer->buf + 8, out_buffer->len - 8);
         if (r == 0)
             goto error;
-#endif
     } else {
         goto error;
     }
index 685f982097c3bdf5abd23f777e56bb4be6ff8aba..fbdc275e9f188eea7d2e34da72a15c77de9bb481 100644 (file)
@@ -34,9 +34,7 @@
 
 #include <zlib.h>
 
-#ifdef HAVE_LIBLZMA
 #include <lzma.h>
-#endif
 
 #define MAX_SWF_DECOMPRESSED_LEN 50000000
 /*
@@ -130,7 +128,6 @@ int FileSwfZlibDecompression(DetectEngineThreadCtx *det_ctx,
  * | 4 bytes         | 4 bytes    | 4 bytes        | 5 bytes    | n bytes   | 6 bytes         |
  * | 'ZWS' + version | script len | compressed len | LZMA props | LZMA data | LZMA end marker |
  */
-#ifdef HAVE_LIBLZMA
 int FileSwfLzmaDecompression(DetectEngineThreadCtx *det_ctx,
                              uint8_t *compressed_data, uint32_t compressed_data_len,
                              uint8_t *decompressed_data, uint32_t decompressed_data_len)
@@ -183,4 +180,3 @@ int FileSwfLzmaDecompression(DetectEngineThreadCtx *det_ctx,
     lzma_end(&strm);
     return ret;
 }
-#endif /* HAVE_LIBLZMA */
index 79034b89e47b0d324834c502f47ed9d9c280f3dc..aa2af4b10600823a69738c5bfdbc133e4c6aad51 100644 (file)
@@ -35,10 +35,8 @@ uint32_t FileGetSwfDecompressedLen(const uint8_t *buffer, uint32_t buffr_len);
 int FileSwfZlibDecompression(DetectEngineThreadCtx *det_ctx,
                              uint8_t *compressed_data, uint32_t compressed_data_len,
                              uint8_t *decompressed_data, uint32_t decompressed_data_len);
-#ifdef HAVE_LIBLZMA
 int FileSwfLzmaDecompression(DetectEngineThreadCtx *det_ctx,
                              uint8_t *compressed_data, uint32_t compressed_data_len,
                              uint8_t *decompressed_data, uint32_t decompressed_data_len);
-#endif
 
 #endif /* __UTIL_FILE_SWF_DECOMPRESSION_H__ */