From aff7e250437aef90ad2f8e3d6f3f464de037bfad Mon Sep 17 00:00:00 2001 From: Alexey Sokolov Date: Tue, 19 Jul 2016 22:24:27 +0100 Subject: [PATCH 1/3] Fix cygwin build (cherry picked from commit f1ef8c79db7f8d04c5105eb817bd57a9c3ea0b4e) --- include/znc/Utils.h | 6 +++--- src/Utils.cpp | 12 +++++++++--- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/include/znc/Utils.h b/include/znc/Utils.h index 2322a8aa..bbab8eef 100644 --- a/include/znc/Utils.h +++ b/include/znc/Utils.h @@ -224,16 +224,16 @@ public: ~CBlowfish(); //! output must be freed - static unsigned char *MD5(const unsigned char *input, u_int ilen); + static unsigned char *MD5(const unsigned char *input, unsigned int ilen); //! returns an md5 of the CString (not hex encoded) static CString MD5(const CString & sInput, bool bHexEncode = false); //! output must be the same size as input - void Crypt(unsigned char *input, unsigned char *output, u_int ibytes); + void Crypt(unsigned char *input, unsigned char *output, unsigned int ibytes); //! must free result - unsigned char * Crypt(unsigned char *input, u_int ibytes); + unsigned char * Crypt(unsigned char *input, unsigned int ibytes); CString Crypt(const CString & sData); private: diff --git a/src/Utils.cpp b/src/Utils.cpp index 963a4e4d..2584c50a 100644 --- a/src/Utils.cpp +++ b/src/Utils.cpp @@ -14,6 +14,11 @@ * limitations under the License. */ +#ifndef _XOPEN_SOURCE +// strptime() wants this +#define _XOPEN_SOURCE 600 +#endif + #include #include #include @@ -21,6 +26,7 @@ #include #endif /* HAVE_LIBSSL */ #include +#include #ifdef HAVE_ICU #include @@ -792,7 +798,7 @@ CBlowfish::~CBlowfish() { } //! output must be freed -unsigned char *CBlowfish::MD5(const unsigned char *input, u_int ilen) { +unsigned char *CBlowfish::MD5(const unsigned char *input, unsigned int ilen) { unsigned char *output = (unsigned char *)malloc(MD5_DIGEST_LENGTH); ::MD5(input, ilen, output); return output; @@ -817,12 +823,12 @@ CString CBlowfish::MD5(const CString & sInput, bool bHexEncode) { } //! output must be the same size as input -void CBlowfish::Crypt(unsigned char *input, unsigned char *output, u_int uBytes) { +void CBlowfish::Crypt(unsigned char *input, unsigned char *output, unsigned int uBytes) { BF_cfb64_encrypt(input, output, uBytes, &m_bkey, m_ivec, &m_num, m_iEncrypt); } //! must free result -unsigned char * CBlowfish::Crypt(unsigned char *input, u_int uBytes) { +unsigned char * CBlowfish::Crypt(unsigned char *input, unsigned int uBytes) { unsigned char *buff = (unsigned char *)malloc(uBytes); Crypt(input, buff, uBytes); return buff; From f7d0f0ccb0618e34ad2562a23fa98fc5999a22dd Mon Sep 17 00:00:00 2001 From: William Elwood Date: Sun, 4 Sep 2016 12:08:29 +0100 Subject: [PATCH 2/3] Fix `make test` in 1.6.x since GoogleTest has moved to new hosting --- Makefile.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile.in b/Makefile.in index 4a5b521b..d362e24c 100644 --- a/Makefile.in +++ b/Makefile.in @@ -35,7 +35,7 @@ GTEST_DOWNLOAD := GTEST_DIR := @GTEST_DIR@ ifeq "$(GTEST_DIR)" "" GTEST_VER := 1.7.0 -GTEST_DIR := test/gtest-$(GTEST_VER) +GTEST_DIR := test/googletest-release-$(GTEST_VER) GTEST_DOWNLOAD := 1 endif @@ -136,7 +136,7 @@ ifneq "$(GTEST_DOWNLOAD)" "" test/gtest.zip: @mkdir -p .depend test $(E) Downloading GoogleTest $(GTEST_VER) - $(Q)wget http://googletest.googlecode.com/files/gtest-$(GTEST_VER).zip -O $@ + $(Q)wget https://github.com/google/googletest/archive/release-$(GTEST_VER).zip -O $@ $(GTEST_DIR)/src/gtest-all.cc $(GTEST_DIR)/src/gtest_main.cc $(GTEST_DIR)/include/gtest/gtest.h: test/gtest.zip $(E) Unpacking GoogleTest $(GTEST_VER) From 9974b6692b3e525311bc1e235731470b1f6dda2e Mon Sep 17 00:00:00 2001 From: Alexey Sokolov Date: Thu, 8 Sep 2016 22:19:25 +0100 Subject: [PATCH 3/3] Fix TSAN on Travis --- .travis.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 43bb0b0a..dfffbb38 100644 --- a/.travis.yml +++ b/.travis.yml @@ -29,7 +29,7 @@ before_install: - "echo os: [$TRAVIS_OS_NAME] build: [$BUILD_TYPE]" - if [[ "$BUILD_TYPE" == "normal" ]]; then export CFGFLAGS= MYCXXFLAGS= MYLDFLAGS=; fi - if [[ "$BUILD_TYPE" == "asan" ]]; then export CFGFLAGS=--enable-debug MYCXXFLAGS="-fsanitize=address -O1 -fno-omit-frame-pointer -fno-optimize-sibling-calls -fPIE" MYLDFLAGS="-fsanitize=address -pie"; fi - - if [[ "$BUILD_TYPE" == "tsan" ]]; then export CFGFLAGS=--enable-debug MYCXXFLAGS="-fsanitize=thread -O1 -fPIE" MYLDFLAGS="-fsanitize=thread -pie"; fi + - if [[ "$BUILD_TYPE" == "tsan" ]]; then export CFGFLAGS=--enable-debug MYCXXFLAGS="-fsanitize=thread -O1 -fPIE" MYLDFLAGS="-fsanitize=thread"; fi # UBSan randomly crashes clang, and very often :( # CFGFLAGS=--enable-debug MYCXXFLAGS="-fsanitize=undefined -O1 -fPIE -fno-sanitize-recover" MYLDFLAGS="-fsanitize=undefined -pie -fno-sanitize-recover" - if [[ "$TRAVIS_REPO_SLUG" == "znc/znc" && "$TRAVIS_PULL_REQUEST" == "false" && "$TRAVIS_BRANCH" == "master" ]]; then openssl aes-256-cbc -d -in .travis-github.enc -out ~/znc-docs-key -k ${SECRET_KEY}; fi @@ -41,6 +41,8 @@ install: - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get update; fi - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get -y install libperl-dev python3-dev tcl-dev libsasl2-dev libgtest-dev libicu-dev swig3.0 doxygen graphviz; fi - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then export CFGFLAGS="$CFGFLAGS --with-gtest=/usr/src/gtest"; fi + # Clang 3.5 TSan is broken on Travis Ubuntu 14.04. Clang 3.8 seems to work, but only without -pie (https://github.com/google/sanitizers/issues/503) + - if [[ "$TRAVIS_OS_NAME" == "linux" && "$BUILD_TYPE" == "tsan" ]]; then sudo apt-get install -y clang-3.8; export CC=clang-3.8 CXX=clang++-3.8; fi - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then sw_vers; fi - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then sysctl -a | grep cpu; fi - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then sysctl -a | grep mem; fi