diff --git a/.travis.yml b/.travis.yml index f440049..245c56d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,3 +4,4 @@ os: language: c before_script: travis/before-script.sh script: travis/script.sh +osx_image: xcode7 diff --git a/build-mac/dependencies/prepare-cyrus-sasl.sh b/build-mac/dependencies/prepare-cyrus-sasl.sh index 02af7e7..aea72e2 100755 --- a/build-mac/dependencies/prepare-cyrus-sasl.sh +++ b/build-mac/dependencies/prepare-cyrus-sasl.sh @@ -111,27 +111,27 @@ LIB_NAME=$ARCHIVE TARGETS="iPhoneOS iPhoneSimulator" SDK_IOS_MIN_VERSION=7.0 -SDK_IOS_VERSION="`xcodebuild -version -sdk 2>/dev/null | egrep SDKVersion | tail -n 1 | sed -E -n -e 's|SDKVersion: *(.*) *$|\1|p'`" +SDK_IOS_VERSION="`xcodebuild -showsdks 2>/dev/null | grep iphoneos | sed 's/.*iphoneos\(.*\)/\1/'`" BUILD_DIR="$tmpdir/build" INSTALL_PATH="${BUILD_DIR}/${LIB_NAME}/universal" for TARGET in $TARGETS; do DEVELOPER="$(xcode-select --print-path)" - SYSROOT="`xcodebuild -version -sdk 2>/dev/null | egrep $TARGET -B 3 | egrep '^Path: '| egrep $SDK_IOS_VERSION | sort -u | tail -n 1| cut -d ' ' -f 2`" + SDK_ID="$(echo "$TARGET$SDK_IOS_VERSION" | tr A-Z a-z)" + SYSROOT="$(xcodebuild -version -sdk "$SDK_ID" 2>/dev/null | egrep '^Path: ' | cut -d ' ' -f 2)" case $TARGET in (iPhoneOS) ARCH=arm MARCHS="armv7 armv7s arm64" - EXTRA_FLAGS="-miphoneos-version-min=$SDK_IOS_MIN_VERSION" ;; (iPhoneSimulator) ARCH=i386 MARCHS="i386 x86_64" - EXTRA_FLAGS="-miphoneos-version-min=$SDK_IOS_MIN_VERSION" ;; esac + EXTRA_FLAGS="-fembed-bitcode -miphoneos-version-min=$SDK_IOS_MIN_VERSION" for MARCH in $MARCHS; do echo "building for $TARGET - $MARCH" diff --git a/build-mac/libetpan.xcodeproj/project.pbxproj b/build-mac/libetpan.xcodeproj/project.pbxproj index e8c1b79..2b6c23f 100644 --- a/build-mac/libetpan.xcodeproj/project.pbxproj +++ b/build-mac/libetpan.xcodeproj/project.pbxproj @@ -2493,6 +2493,7 @@ GCC_OPTIMIZATION_LEVEL = 0; INFOPLIST_FILE = Info.plist; INSTALL_PATH = "@loader_path/../Frameworks"; + MACOSX_DEPLOYMENT_TARGET = 10.8; PRODUCT_NAME = libetpan; SDKROOT = macosx; WRAPPER_EXTENSION = framework; @@ -2511,6 +2512,7 @@ GCC_MODEL_TUNING = G5; INFOPLIST_FILE = Info.plist; INSTALL_PATH = "@loader_path/../Frameworks"; + MACOSX_DEPLOYMENT_TARGET = 10.8; PRODUCT_NAME = libetpan; SDKROOT = macosx; STRIP_INSTALLED_PRODUCT = YES; @@ -2534,6 +2536,7 @@ OTHER_CFLAGS = ( "-DHAVE_CFNETWORK=1", "-DHAVE_CONFIG_H=1", + "-DLIBETPAN_IOS_DISABLE_SSL=1", ); }; name = Debug; @@ -2552,6 +2555,7 @@ OTHER_CFLAGS = ( "-DHAVE_CFNETWORK=1", "-DHAVE_CONFIG_H=1", + "-DLIBETPAN_IOS_DISABLE_SSL=1", ); }; name = Release; @@ -2591,6 +2595,7 @@ buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; COPY_PHASE_STRIP = NO; + ENABLE_BITCODE = YES; GCC_DYNAMIC_NO_PIC = NO; GCC_MODEL_TUNING = G5; GCC_OPTIMIZATION_LEVEL = 0; @@ -2599,11 +2604,8 @@ "$(SRCROOT)/libsasl-ios/include", ); INSTALL_PATH = /usr/local/lib; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; LIBRARY_SEARCH_PATHS = "$(SRCROOT)/libsasl-ios/lib"; - OTHER_CFLAGS = ( - "$(inherited)", - "-DLIBETPAN_IOS_DISABLE_SSL=1", - ); PRODUCT_NAME = "etpan-ios"; SDKROOT = iphoneos; SKIP_INSTALL = YES; @@ -2616,17 +2618,15 @@ ALWAYS_SEARCH_USER_PATHS = NO; COPY_PHASE_STRIP = YES; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_BITCODE = YES; GCC_MODEL_TUNING = G5; HEADER_SEARCH_PATHS = ( "$(inherited)", "$(SRCROOT)/libsasl-ios/include", ); INSTALL_PATH = /usr/local/lib; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; LIBRARY_SEARCH_PATHS = "$(SRCROOT)/libsasl-ios/lib"; - OTHER_CFLAGS = ( - "$(inherited)", - "-DLIBETPAN_IOS_DISABLE_SSL=1", - ); PRODUCT_NAME = "etpan-ios"; SDKROOT = iphoneos; SKIP_INSTALL = YES; @@ -2644,6 +2644,7 @@ GCC_MODEL_TUNING = G5; GCC_OPTIMIZATION_LEVEL = 0; INSTALL_PATH = /usr/local/lib; + MACOSX_DEPLOYMENT_TARGET = 10.8; PRODUCT_NAME = etpan; SDKROOT = macosx; SKIP_INSTALL = YES; @@ -2659,6 +2660,7 @@ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; GCC_MODEL_TUNING = G5; INSTALL_PATH = /usr/local/lib; + MACOSX_DEPLOYMENT_TARGET = 10.8; PRODUCT_NAME = etpan; SDKROOT = macosx; SKIP_INSTALL = YES; diff --git a/build-mac/update.sh b/build-mac/update.sh index 56cd794..163eb6f 100755 --- a/build-mac/update.sh +++ b/build-mac/update.sh @@ -7,12 +7,12 @@ logfile="`pwd`/update.log" cd .. -if test x$1 = xprepare ; then +if test "x$1" = xprepare ; then echo preparing ./autogen.sh > "$logfile" 2>&1 tar czf build-mac/autogen-result.tar.gz `find . -name '*.in'` configure install-sh config.sub missing config.guess exit 0 -elif test x$1 = xprepare-clean ; then +elif test "x$1" = xprepare-clean ; then if test -f Makefile ; then make maintainer-clean >/dev/null cd build-mac @@ -22,16 +22,16 @@ elif test x$1 = xprepare-clean ; then exit 0 fi -if test x$SRCROOT = x ; then +if test "x$SRCROOT" = x ; then echo Should be run from Xcode exit 1 fi -if test x$ACTION = x ; then +if test "x$ACTION" = x ; then ACTION=build fi -if test x$ACTION = xbuild ; then +if test "x$ACTION" = xbuild -o "x$ACTION" = xinstall ; then md5 build-mac/autogen-result.tar.gz > build-mac/autogen-result.md5.new if ! cmp -s build-mac/autogen-result.md5 build-mac/autogen-result.md5.new ; then @@ -53,14 +53,14 @@ if test x$ACTION = xbuild ; then make libetpan-config.h >> "$logfile" 2>&1 md5 build-mac/autogen-result.tar.gz > build-mac/autogen-result.md5 fi - if test x$PLATFORM_NAME = xiphoneos -o x$PLATFORM_NAME = xiphonesimulator ; then + if test "x$PLATFORM_NAME" = xiphoneos -o "x$PLATFORM_NAME" = xiphonesimulator ; then if test ! -d build-mac/libsasl-ios ; then # build dependencies for iOS cd build-mac sh ./prepare-ios.sh fi fi -elif test x$ACTION = xclean ; then +elif test "x$ACTION" = xclean ; then if test -f Makefile ; then make distclean >/dev/null cd build-mac diff --git a/build-windows/README.md b/build-windows/README.md index 235534d..92fc4d7 100644 --- a/build-windows/README.md +++ b/build-windows/README.md @@ -10,8 +10,10 @@ In case you just need a binary build of libEtPan: Also, you'll need all the dependencies, download the most recent binary builds in: +- [Cyrus SASL](http://d.etpan.org/mailcore2-deps/cyrus-sasl-win32/) - [zlib](http://d.etpan.org/mailcore2-deps/zlib-win32/) - [OpenSSL](http://d.etpan.org/mailcore2-deps/misc-win32/) +- [SASL](http://d.etpan.org/mailcore2-deps/cyrus-sasl-win32/) ### Build using Visual Studio 2013 ### @@ -19,6 +21,7 @@ You'll need all the dependencies, download the most recent binary builds in: - [zlib](http://d.etpan.org/mailcore2-deps/zlib-win32/) - [OpenSSL](http://d.etpan.org/mailcore2-deps/misc-win32/) +- [SASL](http://d.etpan.org/mailcore2-deps/cyrus-sasl-win32/) #### Instructions for zlib #### diff --git a/build-windows/build_headers.list b/build-windows/build_headers.list index c0b082f..4b68d83 100644 --- a/build-windows/build_headers.list +++ b/build-windows/build_headers.list @@ -152,7 +152,6 @@ src\low-level\smtp\mailsmtp_socket.h src\low-level\smtp\mailsmtp_ssl.h src\low-level\smtp\mailsmtp_types.h src\main\libetpan.h -src\main\libetpan_version.h src\windows\win_etpan.h build-windows\libetpan-config.h build-windows\libetpan_version.h diff --git a/build-windows/gen-public-headers.sh b/build-windows/gen-public-headers.sh index f779369..f1fdb02 100755 --- a/build-windows/gen-public-headers.sh +++ b/build-windows/gen-public-headers.sh @@ -23,7 +23,7 @@ list_headers() } cd ../src -list_headers libetpan.h | sort +list_headers libetpan.h | grep -v libetpan_version.h | sort echo src\\windows\\win_etpan.h echo build-windows\\libetpan-config.h echo build-windows\\libetpan_version.h diff --git a/build-windows/libetpan-config.h b/build-windows/libetpan-config.h index 5dc7a02..04be4c0 100644 --- a/build-windows/libetpan-config.h +++ b/build-windows/libetpan-config.h @@ -80,7 +80,9 @@ #include #ifdef _MSC_VER # define MMAP_UNAVAILABLE +# ifndef __cplusplus # define inline __inline +# endif #else # include #endif diff --git a/build-windows/libetpan.sln b/build-windows/libetpan.sln index faa0839..37f58ab 100644 --- a/build-windows/libetpan.sln +++ b/build-windows/libetpan.sln @@ -4,7 +4,7 @@ VisualStudioVersion = 12.0.31101.0 MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{B2C11050-3E46-4E10-B734-F9203A75AA46}" ProjectSection(SolutionItems) = preProject - README.txt = README.txt + README.md = README.md EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libetpan", "libetpan\libetpan.vcxproj", "{BA4DED3C-E56F-4484-BFC3-9C13E461A1BE}" diff --git a/build-windows/libetpan/libetpan.vcxproj b/build-windows/libetpan/libetpan.vcxproj index 3b1c14f..4dfc2b9 100644 --- a/build-windows/libetpan/libetpan.vcxproj +++ b/build-windows/libetpan/libetpan.vcxproj @@ -100,7 +100,7 @@ /DLL %(AdditionalOptions) - libsasl.lib;zdll.lib;Ws2_32.lib;ssleay32.lib;libeay32.lib;%(AdditionalDependencies) + libsasl2.lib;zlib.lib;Ws2_32.lib;ssleay32MDd.lib;libeay32MDd.lib;%(AdditionalDependencies) true ../../third-party/lib;%(AdditionalLibraryDirectories) C;%(IgnoreSpecificDefaultLibraries) @@ -132,7 +132,7 @@ /DLL %(AdditionalOptions) - libsasl2.dll;zlib.lib;Ws2_32.lib;ssleay32MDd.lib;libeay32MDd.lib;%(AdditionalDependencies) + libsasl2.lib;zlib.lib;Ws2_32.lib;ssleay32MDd.lib;libeay32MDd.lib;%(AdditionalDependencies) true ../../third-party/lib64;%(AdditionalLibraryDirectories) C;%(IgnoreSpecificDefaultLibraries) @@ -405,8 +405,205 @@ build_headers.bat + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -415,4 +612,4 @@ build_headers.bat - \ No newline at end of file + diff --git a/build-windows/libetpan/libetpan.vcxproj.filters b/build-windows/libetpan/libetpan.vcxproj.filters index 5927fcc..a93a96a 100644 --- a/build-windows/libetpan/libetpan.vcxproj.filters +++ b/build-windows/libetpan/libetpan.vcxproj.filters @@ -641,6 +641,597 @@ Source Files\low-level\smtp + + Source Files\datatypes + + + Source Files\datatypes + + + Source Files\datatypes + + + Source Files\datatypes + + + Source Files\datatypes + + + Source Files\datatypes + + + Source Files\datatypes + + + Source Files\datatypes + + + Source Files\datatypes + + + Source Files\datatypes + + + Source Files\datatypes + + + Source Files\datatypes + + + Source Files\datatypes + + + Source Files\datatypes + + + Source Files\datatypes + + + Source Files\datatypes + + + Source Files\datatypes + + + Source Files\datatypes + + + Source Files\datatypes + + + Source Files\datatypes + + + Source Files\datatypes + + + Source Files\datatypes + + + Source Files\datatypes + + + Source Files\datatypes + + + Source Files\datatypes + + + Source Files\datatypes + + + Source Files\datatypes + + + Source Files\datatypes + + + Source Files\datatypes + + + Source Files\driver\implementation\data-message + + + Source Files\driver\implementation\feed + + + Source Files\driver\implementation\feed + + + Source Files\driver\implementation\feed + + + Source Files\driver\implementation\feed + + + Source Files\driver\implementation\hotmail + + + Source Files\driver\implementation\imap + + + Source Files\driver\implementation\imap + + + Source Files\driver\implementation\imap + + + Source Files\driver\implementation\imap + + + Source Files\driver\implementation\imap + + + Source Files\driver\implementation\imap + + + Source Files\driver\implementation\imap + + + Source Files\driver\implementation\imap + + + Source Files\driver\implementation\maildir + + + Source Files\driver\implementation\maildir + + + Source Files\driver\implementation\maildir + + + Source Files\driver\implementation\maildir + + + Source Files\driver\implementation\maildir + + + Source Files\driver\implementation\maildir + + + Source Files\driver\implementation\maildir + + + Source Files\driver\implementation\mbox + + + Source Files\driver\implementation\mbox + + + Source Files\driver\implementation\mbox + + + Source Files\driver\implementation\mbox + + + Source Files\driver\implementation\mbox + + + Source Files\driver\implementation\mbox + + + Source Files\driver\implementation\mbox + + + Source Files\driver\implementation\mh + + + Source Files\driver\implementation\mh + + + Source Files\driver\implementation\mh + + + Source Files\driver\implementation\mh + + + Source Files\driver\implementation\mh + + + Source Files\driver\implementation\mh + + + Source Files\driver\implementation\mh + + + Source Files\driver\implementation\mime-message + + + Source Files\driver\implementation\nntp + + + Source Files\driver\implementation\nntp + + + Source Files\driver\implementation\nntp + + + Source Files\driver\implementation\nntp + + + Source Files\driver\implementation\nntp + + + Source Files\driver\implementation\nntp + + + Source Files\driver\implementation\nntp + + + Source Files\driver\implementation\pop3 + + + Source Files\driver\implementation\pop3 + + + Source Files\driver\implementation\pop3 + + + Source Files\driver\implementation\pop3 + + + Source Files\driver\implementation\pop3 + + + Source Files\driver\implementation\pop3 + + + Source Files\driver\implementation\pop3 + + + Source Files\driver\interface + + + Source Files\driver\interface + + + Source Files\driver\interface + + + Source Files\driver\interface + + + Source Files\driver\interface + + + Source Files\driver\interface + + + Source Files\driver\interface + + + Source Files\driver\interface + + + Source Files\driver\interface + + + Source Files\driver\interface + + + Source Files\driver\interface + + + Source Files\driver\interface + + + Source Files\driver\tools + + + Source Files\driver\tools + + + Source Files\driver\tools + + + Source Files\driver\tools + + + Source Files\driver\tools + + + Source Files\low-level\feed + + + Source Files\low-level\feed + + + Source Files\low-level\feed + + + Source Files\low-level\feed + + + Source Files\low-level\feed + + + Source Files\low-level\feed + + + Source Files\low-level\feed + + + Source Files\low-level\feed + + + Source Files\low-level\feed + + + Source Files\low-level\feed + + + Source Files\low-level\feed + + + Source Files\low-level\imap + + + Source Files\low-level\imap + + + Source Files\low-level\imap + + + Source Files\low-level\imap + + + Source Files\low-level\imap + + + Source Files\low-level\imap + + + Source Files\low-level\imap + + + Source Files\low-level\imap + + + Source Files\low-level\imap + + + Source Files\low-level\imap + + + Source Files\low-level\imap + + + Source Files\low-level\imap + + + Source Files\low-level\imap + + + Source Files\low-level\imap + + + Source Files\low-level\imap + + + Source Files\low-level\imap + + + Source Files\low-level\imap + + + Source Files\low-level\imap + + + Source Files\low-level\imap + + + Source Files\low-level\imap + + + Source Files\low-level\imap + + + Source Files\low-level\imap + + + Source Files\low-level\imap + + + Source Files\low-level\imap + + + Source Files\low-level\imap + + + Source Files\low-level\imap + + + Source Files\low-level\imap + + + Source Files\low-level\imap + + + Source Files\low-level\imap + + + Source Files\low-level\imap + + + Source Files\low-level\imap + + + Source Files\low-level\imap + + + Source Files\low-level\imap + + + Source Files\low-level\imap + + + Source Files\low-level\imap + + + Source Files\low-level\imap + + + Source Files\low-level\imap + + + Source Files\low-level\imap + + + Source Files\low-level\imap + + + Source Files\low-level\imap + + + Source Files\low-level\imap + + + Source Files\low-level\imap + + + Source Files\low-level\imap + + + Source Files\low-level\imap + + + Source Files\low-level\imap + + + Source Files\low-level\imap + + + Source Files\low-level\imap + + + Source Files\low-level\imap + + + Source Files\low-level\imap + + + Source Files\low-level\imap + + + Source Files\low-level\imap + + + Source Files\low-level\imap + + + Source Files\low-level\imf + + + Source Files\low-level\imf + + + Source Files\low-level\imf + + + Source Files\low-level\imf + + + Source Files\low-level\imf + + + Source Files\low-level\imf + + + Source Files\low-level\imf + + + Source Files\low-level\maildir + + + Source Files\low-level\maildir + + + Source Files\low-level\mbox + + + Source Files\low-level\mbox + + + Source Files\low-level\mbox + + + Source Files\low-level\mh + + + Source Files\low-level\mime + + + Source Files\low-level\mime + + + Source Files\low-level\mime + + + Source Files\low-level\mime + + + Source Files\low-level\mime + + + Source Files\low-level\mime + + + Source Files\low-level\mime + + + Source Files\low-level\mime + + + Source Files\low-level\mime + + + Source Files\low-level\mime + + + Source Files\low-level\nntp + + + Source Files\low-level\nntp + + + Source Files\low-level\nntp + + + Source Files\low-level\nntp + + + Source Files\low-level\pop3 + + + Source Files\low-level\pop3 + + + Source Files\low-level\pop3 + + + Source Files\low-level\pop3 + + + Source Files\low-level\pop3 + + + Source Files\low-level\smtp + + + Source Files\low-level\smtp + + + Source Files\low-level\smtp + + + Source Files\low-level\smtp + + + Source Files\low-level\smtp + + + Source Files\low-level\smtp + diff --git a/libetpan-config.h.in b/libetpan-config.h.in index eca3def..3583340 100644 --- a/libetpan-config.h.in +++ b/libetpan-config.h.in @@ -9,7 +9,7 @@ @if WIN32 @ define MMAP_UNAVAILABLE @endif -@ifdef _MSC_VER +@if defined(_MSC_VER) && !defined(__cplusplus) @ define inline __inline @endif #ifdef HAVE_LIMITS_H diff --git a/src/data-types/mailstream_cfstream.c b/src/data-types/mailstream_cfstream.c index 50b7705..43976a0 100755 --- a/src/data-types/mailstream_cfstream.c +++ b/src/data-types/mailstream_cfstream.c @@ -1192,6 +1192,11 @@ static carray * mailstream_low_cfstream_get_certificate_chain(mailstream_low * s for(i = 0 ; i < count ; i ++) { SecCertificateRef cert = (SecCertificateRef) SecTrustGetCertificateAtIndex(secTrust, i); CFDataRef data = SecCertificateCopyData(cert); + if (data == NULL) { + carray_free(result); + CFRelease(secTrust); + return NULL; + } CFIndex length = CFDataGetLength(data); const UInt8 * bytes = CFDataGetBytePtr(data); MMAPString * str = mmap_string_sized_new(length); @@ -1209,6 +1214,11 @@ static carray * mailstream_low_cfstream_get_certificate_chain(mailstream_low * s for(i = 0 ; i < count ; i ++) { SecCertificateRef cert = (SecCertificateRef) CFArrayGetValueAtIndex(certs, i); CFDataRef data = SecCertificateCopyData(cert); + if (data == NULL) { + carray_free(result); + CFRelease(certs); + return NULL; + } CFIndex length = CFDataGetLength(data); const UInt8 * bytes = CFDataGetBytePtr(data); MMAPString * str = mmap_string_sized_new(length); diff --git a/src/data-types/mailstream_low.c b/src/data-types/mailstream_low.c index 8d25ac5..a4498c5 100644 --- a/src/data-types/mailstream_low.c +++ b/src/data-types/mailstream_low.c @@ -454,6 +454,30 @@ int mailstream_low_wait_idle(mailstream_low * low, struct mailstream_cancel * id cancel_fd = mailstream_cancel_get_fd(mailstream_low_get_cancel(low)); FD_ZERO(&readfds); +#ifdef WIN32 + HANDLE event = CreateEvent(NULL, TRUE, FALSE, NULL); + WSAEventSelect(fd, event, FD_READ | FD_CLOSE); + FD_SET(event, &readfds); + FD_SET(idle_fd, &readfds); + FD_SET(cancel_fd, &readfds); + r = WaitForMultipleObjects(readfds.fd_count, readfds.fd_array, FALSE, max_idle_delay * 1000); + WSAEventSelect(fd, event, 0); + CloseHandle(event); + if (r == WAIT_TIMEOUT) { + return MAILSTREAM_IDLE_TIMEOUT; + } + else if (r == WAIT_OBJECT_0){ + return MAILSTREAM_IDLE_HASDATA; + } + else if (r == WAIT_OBJECT_0 + 1){ + return MAILSTREAM_IDLE_INTERRUPTED; + } + else if (r == WAIT_OBJECT_0 + 2){ + return MAILSTREAM_IDLE_CANCELLED; + } + DWORD i = GetLastError(); + return MAILSTREAM_IDLE_ERROR; +#else FD_SET(fd, &readfds); FD_SET(idle_fd, &readfds); FD_SET(cancel_fd, &readfds); @@ -494,6 +518,7 @@ int mailstream_low_wait_idle(mailstream_low * low, struct mailstream_cancel * id } return MAILSTREAM_IDLE_ERROR; } +#endif } int mailstream_low_setup_idle(mailstream_low * low) diff --git a/src/driver/interface/mailstorage_tools.c b/src/driver/interface/mailstorage_tools.c index 77a50ae..d50f508 100644 --- a/src/driver/interface/mailstorage_tools.c +++ b/src/driver/interface/mailstorage_tools.c @@ -307,7 +307,11 @@ int mailstorage_generic_connect_with_local_address(mailsession_driver * driver, if (stream == NULL) { res = MAIL_ERROR_STREAM; +#ifdef WIN32 + closesocket(fd); +#else Close(fd); +#endif goto err; } diff --git a/src/low-level/imap/mailimap.c b/src/low-level/imap/mailimap.c index bfb4409..8d4f02c 100644 --- a/src/low-level/imap/mailimap.c +++ b/src/low-level/imap/mailimap.c @@ -2309,7 +2309,12 @@ int mailimap_send_current_tag(mailimap * session) int r; session->imap_tag ++; - snprintf(tag_str, 15, "%i", session->imap_tag); + + if(mailimap_is_163_workaround_enabled(session)) + snprintf(tag_str, 15, "C%i", session->imap_tag); + else + snprintf(tag_str, 15, "%i", session->imap_tag); + r = mailimap_tag_send(session->imap_stream, tag_str); if (r != MAILIMAP_NO_ERROR) @@ -2384,7 +2389,11 @@ int mailimap_parse_response(mailimap * session, return MAILIMAP_ERROR_FATAL; } - snprintf(tag_str, 15, "%i", session->imap_tag); + if(mailimap_is_163_workaround_enabled(session)) + snprintf(tag_str, 15, "C%i", session->imap_tag); + else + snprintf(tag_str, 15, "%i", session->imap_tag); + if (strcmp(response->rsp_resp_done->rsp_data.rsp_tagged->rsp_tag, tag_str) != 0) { mailimap_response_free(response); return MAILIMAP_ERROR_PROTOCOL; @@ -2502,7 +2511,7 @@ mailimap * mailimap_new(size_t imap_progr_rate, f->imap_logger = NULL; f->imap_logger_context = NULL; - + f->is_163_workaround_enabled = 0; return f; free_stream_buffer: @@ -2590,3 +2599,13 @@ void mailimap_set_logger(mailimap * session, void (* logger)(mailimap * session, session->imap_logger = logger; session->imap_logger_context = logger_context; } + +LIBETPAN_EXPORT +void mailimap_set_163_workaround_enabled(mailimap * session, int enabled) { + session->is_163_workaround_enabled = enabled; +} + +LIBETPAN_EXPORT +int mailimap_is_163_workaround_enabled(mailimap * session) { + return session->is_163_workaround_enabled; +} diff --git a/src/low-level/imap/mailimap.h b/src/low-level/imap/mailimap.h index 60af3ad..9942756 100644 --- a/src/low-level/imap/mailimap.h +++ b/src/low-level/imap/mailimap.h @@ -803,6 +803,16 @@ LIBETPAN_EXPORT void mailimap_set_logger(mailimap * session, void (* logger)(mailimap * session, int log_type, const char * str, size_t size, void * context), void * logger_context); +#ifndef LIBETPAN_HAS_MAILIMAP_163_WORKAROUND + #define LIBETPAN_HAS_MAILIMAP_163_WORKAROUND 1 +#endif + +LIBETPAN_EXPORT +int mailimap_is_163_workaround_enabled(mailimap * session); + +LIBETPAN_EXPORT +void mailimap_set_163_workaround_enabled(mailimap * session, int enabled); + #ifdef __cplusplus } #endif diff --git a/src/low-level/imap/mailimap_extension.c b/src/low-level/imap/mailimap_extension.c index 9df9714..19ae259 100644 --- a/src/low-level/imap/mailimap_extension.c +++ b/src/low-level/imap/mailimap_extension.c @@ -189,7 +189,7 @@ void mailimap_extension_data_store(mailimap * session, } LIBETPAN_EXPORT -int mailimap_has_extension(mailimap * session, char * extension_name) +int mailimap_has_extension(mailimap * session, const char * extension_name) { if (session->imap_connection_info != NULL) { if (session->imap_connection_info->imap_capability != NULL) { @@ -214,7 +214,7 @@ int mailimap_has_extension(mailimap * session, char * extension_name) } LIBETPAN_EXPORT -int mailimap_has_authentication(mailimap * session, char * authentication_name) +int mailimap_has_authentication(mailimap * session, const char * authentication_name) { if (session->imap_connection_info != NULL) { if (session->imap_connection_info->imap_capability != NULL) { diff --git a/src/low-level/imap/mailimap_extension.h b/src/low-level/imap/mailimap_extension.h index 42974e9..9d63d08 100644 --- a/src/low-level/imap/mailimap_extension.h +++ b/src/low-level/imap/mailimap_extension.h @@ -99,10 +99,10 @@ void mailimap_extension_data_store(mailimap * session, */ LIBETPAN_EXPORT -int mailimap_has_extension(mailimap * session, char * extension_name); +int mailimap_has_extension(mailimap * session, const char * extension_name); LIBETPAN_EXPORT -int mailimap_has_authentication(mailimap * session, char * authentication_name); +int mailimap_has_authentication(mailimap * session, const char * authentication_name); #ifdef __cplusplus } diff --git a/src/low-level/imap/mailimap_parser.c b/src/low-level/imap/mailimap_parser.c index 7febc7c..88e19b5 100644 --- a/src/low-level/imap/mailimap_parser.c +++ b/src/low-level/imap/mailimap_parser.c @@ -768,6 +768,24 @@ mailimap_string_parse_progress(mailstream * fd, MMAPString * buffer, static int has_crlf(MMAPString * buffer, size_t index); +static int mailimap_address_list_parse(mailstream * fd, MMAPString * buffer, + size_t * indx, + clist ** result, + size_t progr_rate, + progress_function * progr_fun); + +static int mailimap_envelope_parse_full(mailstream * fd, MMAPString * buffer, + size_t * indx, + struct mailimap_envelope ** result, + size_t progr_rate, + progress_function * progr_fun); + +static int mailimap_envelope_parse_workaround_qq_mail(mailstream * fd, MMAPString * buffer, + size_t * indx, + struct mailimap_envelope ** result, + size_t progr_rate, + progress_function * progr_fun); + /* ************************************************************************* */ /* ************************************************************************* */ /* ************************************************************************* */ @@ -1514,6 +1532,14 @@ static int mailimap_addr_host_parse(mailstream * fd, MMAPString * buffer, size_t progr_rate, progress_function * progr_fun) { + int r; + + /* workaround for qq.com IMAP Server. */ + r = mailimap_token_case_insensitive_parse(fd, buffer, indx, "\"qq.com\\\""); + if (r == MAILIMAP_NO_ERROR) { + return r; + } + return mailimap_nstring_parse(fd, buffer, indx, result, NULL, progr_rate, progr_fun); } @@ -4613,6 +4639,26 @@ static int mailimap_envelope_parse(mailstream * fd, MMAPString * buffer, struct mailimap_envelope ** result, size_t progr_rate, progress_function * progr_fun) +{ + int r; + r = mailimap_envelope_parse_full(fd, buffer, indx, result, progr_rate, progr_fun); + if (r == MAILIMAP_NO_ERROR) { + return MAILIMAP_NO_ERROR; + } + else if (r != MAILIMAP_ERROR_PARSE) { + return r; + } + + /* workaround for qq.com IMAP Server. */ + r = mailimap_envelope_parse_workaround_qq_mail(fd, buffer, indx, result, progr_rate, progr_fun); + return r; +} + +static int mailimap_envelope_parse_full(mailstream * fd, MMAPString * buffer, + size_t * indx, + struct mailimap_envelope ** result, + size_t progr_rate, + progress_function * progr_fun) { size_t cur_token; char * date; @@ -4814,6 +4860,203 @@ static int mailimap_envelope_parse(mailstream * fd, MMAPString * buffer, return res; } +static int mailimap_envelope_parse_workaround_qq_mail(mailstream * fd, MMAPString * buffer, + size_t * indx, + struct mailimap_envelope ** result, + size_t progr_rate, + progress_function * progr_fun) +{ + size_t cur_token; + char * date; + char * subject; + struct mailimap_env_from * from; + char * in_reply_to; + char * message_id; + struct mailimap_envelope * envelope; + int r; + int res; + char * first_string; + char * second_string; + int has_first_string; + int has_second_string; + + date = NULL; + subject = NULL; + from = NULL; + in_reply_to = NULL; + message_id = NULL; + first_string = NULL; + second_string = NULL; + + cur_token = * indx; + + r = mailimap_oparenth_parse(fd, buffer, &cur_token); + if (r != MAILIMAP_NO_ERROR) { + res = r; + goto err; + } + + r = mailimap_env_date_parse(fd, buffer, &cur_token, &date, + progr_rate, progr_fun); + if (r != MAILIMAP_NO_ERROR) { + res = r; + goto err; + } + + r = mailimap_space_parse(fd, buffer, &cur_token); + if (r != MAILIMAP_NO_ERROR) { + res = r; + goto date; + } + + r = mailimap_env_subject_parse(fd, buffer, &cur_token, &subject, + progr_rate, progr_fun); + if (r != MAILIMAP_NO_ERROR) { + res = r; + goto date; + } + + r = mailimap_space_parse(fd, buffer, &cur_token); + if (r != MAILIMAP_NO_ERROR) { + res = r; + goto subject; + } + + r = mailimap_env_from_parse(fd, buffer, &cur_token, &from, + progr_rate, progr_fun); + if ((r != MAILIMAP_NO_ERROR) && (r != MAILIMAP_ERROR_PARSE)) { + res = r; + goto subject; + } + + if (from == NULL) { + clist * list; + struct mailimap_address * addr; + + addr = mailimap_address_new("", NULL, "", ""); + if (addr == NULL) { + goto subject; + } + + list = clist_new(); + if (list == NULL) { + mailimap_address_free(addr); + goto subject; + } + + r = clist_append(list, addr); + if (r < 0) { + clist_free(list); + mailimap_address_free(addr); + goto subject; + } + + from = mailimap_env_from_new(list); + if (from == NULL) { + clist_free(list); + mailimap_address_free(addr); + goto subject; + } + } + + while (1) { + clist * list; + + r = mailimap_space_parse(fd, buffer, &cur_token); + if (r == MAILIMAP_ERROR_PARSE) { + break; + } + else if (r != MAILIMAP_NO_ERROR) { + res = r; + goto from; + } + + r = mailimap_address_list_parse(fd, buffer, &cur_token, &list, + progr_rate, progr_fun); + if (r == MAILIMAP_ERROR_PARSE) { + break; + } + else if (r != MAILIMAP_NO_ERROR) { + res = r; + goto from; + } + if (list != NULL) { + clist_foreach(list, (clist_func) mailimap_address_free, NULL); + clist_free(list); + } + } + + has_first_string = 0; + r = mailimap_nstring_parse(fd, buffer, &cur_token, &first_string, NULL, + progr_rate, progr_fun); + if (r == MAILIMAP_NO_ERROR) { + has_first_string = 1; + } + else if (r == MAILIMAP_ERROR_PARSE) { + // Do nothing. + } + else { + res = r; + goto from; + } + + r = mailimap_space_parse(fd, buffer, &cur_token); + // ignore errors. + + has_second_string = 0; + r = mailimap_nstring_parse(fd, buffer, &cur_token, &second_string, NULL, + progr_rate, progr_fun); + if (r == MAILIMAP_NO_ERROR) { + has_second_string = 1; + } + else if (r == MAILIMAP_ERROR_PARSE) { + // Do nothing. + } + else { + res = r; + goto first_string; + } + + if (has_first_string && has_second_string) { + in_reply_to = first_string; + message_id = second_string; + } + else if (has_first_string) { + message_id = first_string; + } + + r = mailimap_cparenth_parse(fd, buffer, &cur_token); + if (r != MAILIMAP_NO_ERROR) { + res = r; + goto second_string; + } + + envelope = mailimap_envelope_new(date, subject, from, NULL, NULL, NULL, + NULL, NULL, in_reply_to, message_id); + if (envelope == NULL) { + res = MAILIMAP_ERROR_MEMORY; + goto second_string; + } + + * result = envelope; + * indx = cur_token; + + return MAILIMAP_NO_ERROR; + +second_string: + free(second_string); +first_string: + free(first_string); +from: + mailimap_env_from_free(from); +subject: + mailimap_env_subject_free(date); +date: + mailimap_env_date_free(date); +err: + return res; +} + /* "(" 1*address ")" / nil */ diff --git a/src/low-level/imap/mailimap_sender.c b/src/low-level/imap/mailimap_sender.c index b8580c4..9f8042c 100644 --- a/src/low-level/imap/mailimap_sender.c +++ b/src/low-level/imap/mailimap_sender.c @@ -184,6 +184,11 @@ static int mailimap_astring_literalplus_send(mailstream * fd, const char * astri static int mailimap_literalplus_count_send(mailstream * fd, size_t count); +static int search_key_notoplevel_send(mailstream * fd, + struct mailimap_search_key * key); + +static int search_key_literalplus_notoplevel_send(mailstream * fd, + struct mailimap_search_key * key); @@ -2252,7 +2257,7 @@ int mailimap_uid_search_literalplus_send(mailstream * fd, const char * charset, static int search_key_send(mailstream * fd, struct mailimap_search_key * key, - int literalplus_enabled) + int literalplus_enabled, int toplevel) { int r; @@ -2479,7 +2484,7 @@ static int search_key_send(mailstream * fd, r = mailimap_space_send(fd); if (r != MAILIMAP_NO_ERROR) return r; - r = mailimap_search_key_send(fd, key->sk_data.sk_not); + r = search_key_send(fd, key->sk_data.sk_not, literalplus_enabled, 0); if (r != MAILIMAP_NO_ERROR) return r; return MAILIMAP_NO_ERROR; @@ -2491,13 +2496,13 @@ static int search_key_send(mailstream * fd, r = mailimap_space_send(fd); if (r != MAILIMAP_NO_ERROR) return r; - r = mailimap_search_key_send(fd, key->sk_data.sk_or.sk_or1); + r = search_key_send(fd, key->sk_data.sk_or.sk_or1, literalplus_enabled, 0); if (r != MAILIMAP_NO_ERROR) return r; r = mailimap_space_send(fd); if (r != MAILIMAP_NO_ERROR) return r; - r = mailimap_search_key_send(fd, key->sk_data.sk_or.sk_or2); + r = search_key_send(fd, key->sk_data.sk_or.sk_or2, literalplus_enabled, 0); if (r != MAILIMAP_NO_ERROR) return r; return MAILIMAP_NO_ERROR; @@ -2605,18 +2610,28 @@ static int search_key_send(mailstream * fd, return MAILIMAP_NO_ERROR; case MAILIMAP_SEARCH_KEY_MULTIPLE: - r = mailimap_oparenth_send(fd); - if (r != MAILIMAP_NO_ERROR) - return r; + if (!toplevel) { + r = mailimap_oparenth_send(fd); + if (r != MAILIMAP_NO_ERROR) + return r; + } - r = mailimap_struct_spaced_list_send(fd, key->sk_data.sk_multiple, - (mailimap_struct_sender *) mailimap_search_key_send); + if (literalplus_enabled) { + r = mailimap_struct_spaced_list_send(fd, key->sk_data.sk_multiple, + (mailimap_struct_sender *) search_key_literalplus_notoplevel_send); + } + else { + r = mailimap_struct_spaced_list_send(fd, key->sk_data.sk_multiple, + (mailimap_struct_sender *) search_key_notoplevel_send); + } if (r != MAILIMAP_NO_ERROR) return r; - r = mailimap_cparenth_send(fd); - if (r != MAILIMAP_NO_ERROR) - return r; + if (!toplevel) { + r = mailimap_cparenth_send(fd); + if (r != MAILIMAP_NO_ERROR) + return r; + } return MAILIMAP_NO_ERROR; case MAILIMAP_SEARCH_KEY_MODSEQ: @@ -2682,16 +2697,28 @@ static int search_key_send(mailstream * fd, } } +static int search_key_notoplevel_send(mailstream * fd, + struct mailimap_search_key * key) +{ + return search_key_send(fd, key, 0, 0); +} + +static int search_key_literalplus_notoplevel_send(mailstream * fd, + struct mailimap_search_key * key) +{ + return search_key_send(fd, key, 1, 0); +} + int mailimap_search_key_send(mailstream * fd, struct mailimap_search_key * key) { - return search_key_send(fd, key, 0); + return search_key_send(fd, key, 0, 1); } int mailimap_search_key_literalplus_send(mailstream * fd, struct mailimap_search_key * key) { - return search_key_send(fd, key, 1); + return search_key_send(fd, key, 1, 1); } int mailimap_mod_sequence_value_send(mailstream * fd, uint64_t number) diff --git a/src/low-level/imap/mailimap_types.h b/src/low-level/imap/mailimap_types.h index 17d539d..379c38c 100644 --- a/src/low-level/imap/mailimap_types.h +++ b/src/low-level/imap/mailimap_types.h @@ -3385,6 +3385,8 @@ struct mailimap { void (* imap_logger)(mailimap * session, int log_type, const char * str, size_t size, void * context); void * imap_logger_context; + + int is_163_workaround_enabled; }; diff --git a/src/low-level/imf/mailimf.c b/src/low-level/imf/mailimf.c index fb164cf..8d9ce4a 100644 --- a/src/low-level/imf/mailimf.c +++ b/src/low-level/imf/mailimf.c @@ -1170,8 +1170,8 @@ int mailimf_atom_parse(const char * message, size_t length, } LIBETPAN_EXPORT -int mailimf_fws_atom_for_word_parse(const char * message, size_t length, - size_t * indx, char ** result) +static int mailimf_fws_atom_for_word_parse(const char * message, size_t length, + size_t * indx, char ** result, int * p_missing_closing_quote) { size_t end; size_t cur_token; @@ -1179,9 +1179,11 @@ int mailimf_fws_atom_for_word_parse(const char * message, size_t length, int res; struct mailmime_encoded_word * word; int has_fwd; + int missing_closing_quote; char * atom; cur_token = * indx; + missing_closing_quote = 0; r = mailimf_fws_parse(message, length, &cur_token); if ((r != MAILIMF_NO_ERROR) && (r != MAILIMF_ERROR_PARSE)) { @@ -1191,7 +1193,7 @@ int mailimf_fws_atom_for_word_parse(const char * message, size_t length, end = cur_token; - r = mailmime_encoded_word_parse(message, length, &cur_token, &word, &has_fwd); + r = mailmime_encoded_word_parse(message, length, &cur_token, &word, &has_fwd, &missing_closing_quote); if ((r != MAILIMF_NO_ERROR) && (r != MAILIMF_ERROR_PARSE)) { res = r; goto err; @@ -1213,6 +1215,7 @@ int mailimf_fws_atom_for_word_parse(const char * message, size_t length, * result = atom; * indx = cur_token; + * p_missing_closing_quote = missing_closing_quote; return MAILIMF_NO_ERROR; @@ -1591,15 +1594,17 @@ int mailimf_word_parse(const char * message, size_t length, LIBETPAN_EXPORT int mailimf_fws_word_parse(const char * message, size_t length, - size_t * indx, char ** result) + size_t * indx, char ** result, int * p_missing_closing_quote) { size_t cur_token; char * word; int r; + int missing_closing_quote; cur_token = * indx; + missing_closing_quote = 0; - r = mailimf_fws_atom_for_word_parse(message, length, &cur_token, &word); + r = mailimf_fws_atom_for_word_parse(message, length, &cur_token, &word, &missing_closing_quote); if (r == MAILIMF_ERROR_PARSE) r = mailimf_fws_quoted_string_parse(message, length, &cur_token, &word); @@ -1609,6 +1614,7 @@ int mailimf_fws_word_parse(const char * message, size_t length, * result = word; * indx = cur_token; + * p_missing_closing_quote = missing_closing_quote; return MAILIMF_NO_ERROR; } @@ -1627,8 +1633,10 @@ static int mailimf_phrase_parse(const char * message, size_t length, int r; int res; char * str; + int has_missing_closing_quote; cur_token = * indx; + has_missing_closing_quote = 0; gphrase = mmap_string_new(""); if (gphrase == NULL) { @@ -1639,7 +1647,11 @@ static int mailimf_phrase_parse(const char * message, size_t length, first = TRUE; while (1) { - r = mailimf_fws_word_parse(message, length, &cur_token, &word); + int missing_quote = 0; + r = mailimf_fws_word_parse(message, length, &cur_token, &word, &missing_quote); + if (missing_quote) { + has_missing_closing_quote = 1; + } if (r == MAILIMF_NO_ERROR) { if (!first) { if (mmap_string_append_c(gphrase, ' ') == NULL) { @@ -1669,6 +1681,10 @@ static int mailimf_phrase_parse(const char * message, size_t length, goto free; } + if (has_missing_closing_quote) { + r = mailimf_char_parse(message, length, &cur_token, '\"'); + } + str = strdup(gphrase->str); if (str == NULL) { res = MAILIMF_ERROR_MEMORY; diff --git a/src/low-level/imf/mailimf.h b/src/low-level/imf/mailimf.h index 9dccac1..059ec67 100644 --- a/src/low-level/imf/mailimf.h +++ b/src/low-level/imf/mailimf.h @@ -348,7 +348,7 @@ int mailimf_fws_atom_parse(const char * message, size_t length, LIBETPAN_EXPORT int mailimf_fws_word_parse(const char * message, size_t length, - size_t * indx, char ** result); + size_t * indx, char ** result, int * p_missing_closing_quote); LIBETPAN_EXPORT int mailimf_fws_quoted_string_parse(const char * message, size_t length, diff --git a/src/low-level/imf/mailimf_write_generic.c b/src/low-level/imf/mailimf_write_generic.c index 23af6ce..f7ee94e 100644 --- a/src/low-level/imf/mailimf_write_generic.c +++ b/src/low-level/imf/mailimf_write_generic.c @@ -1773,10 +1773,12 @@ static int mailimf_path_write_driver(int (* do_write)(void *, const char *, size if (r != MAILIMF_NO_ERROR) return r; - r = mailimf_string_write_driver(do_write, data, col, path->pt_addr_spec, - strlen(path->pt_addr_spec)); - if (r != MAILIMF_NO_ERROR) - return r; + if (path->pt_addr_spec != NULL) { + r = mailimf_string_write_driver(do_write, data, col, path->pt_addr_spec, + strlen(path->pt_addr_spec)); + if (r != MAILIMF_NO_ERROR) + return r; + } r = mailimf_string_write_driver(do_write, data, col, ">", 1); if (r != MAILIMF_NO_ERROR) diff --git a/src/low-level/mime/mailmime_decode.c b/src/low-level/mime/mailmime_decode.c index bea7b62..80605e2 100644 --- a/src/low-level/mime/mailmime_decode.c +++ b/src/low-level/mime/mailmime_decode.c @@ -110,6 +110,7 @@ int mailmime_encoded_phrase_parse(const char * default_fromcode, char * str; char * wordutf8; int type; + int missing_closing_quote; cur_token = * indx; @@ -127,7 +128,7 @@ int mailmime_encoded_phrase_parse(const char * default_fromcode, int has_fwd; word = NULL; - r = mailmime_encoded_word_parse(message, length, &cur_token, &word, &has_fwd); + r = mailmime_encoded_word_parse(message, length, &cur_token, &word, &has_fwd, &missing_closing_quote); if (r == MAILIMF_NO_ERROR) { if ((!first) && has_fwd) { if (type != TYPE_ENCODED_WORD) { @@ -366,7 +367,7 @@ mailmime_non_encoded_word_parse(const char * message, size_t length, int mailmime_encoded_word_parse(const char * message, size_t length, size_t * indx, struct mailmime_encoded_word ** result, - int * p_has_fwd) + int * p_has_fwd, int * p_missing_closing_quote) { size_t cur_token; char * charset; @@ -381,9 +382,11 @@ int mailmime_encoded_word_parse(const char * message, size_t length, int opening_quote; int end; int has_fwd; + int missing_closing_quote; cur_token = * indx; + missing_closing_quote = 0; has_fwd = 0; r = mailimf_fws_parse(message, length, &cur_token); if (r == MAILIMF_NO_ERROR) { @@ -509,6 +512,9 @@ int mailmime_encoded_word_parse(const char * message, size_t length, goto free_encoded_text; } #endif + if (r == MAILIMF_ERROR_PARSE) { + missing_closing_quote = 1; + } } /* fix charset */ @@ -525,6 +531,7 @@ int mailmime_encoded_word_parse(const char * message, size_t length, * result = ew; * indx = cur_token; * p_has_fwd = has_fwd; + * p_missing_closing_quote = missing_closing_quote; return MAILIMF_NO_ERROR; diff --git a/src/low-level/mime/mailmime_decode.h b/src/low-level/mime/mailmime_decode.h index f17b371..a5ea10b 100644 --- a/src/low-level/mime/mailmime_decode.h +++ b/src/low-level/mime/mailmime_decode.h @@ -53,7 +53,7 @@ int mailmime_encoded_word_parse(const char * message, size_t length, size_t * indx, struct mailmime_encoded_word ** result, - int * p_has_fwd); + int * p_has_fwd, int * p_missing_closing_quote); #ifdef __cplusplus } diff --git a/travis/script.sh b/travis/script.sh index 211a870..c84c809 100755 --- a/travis/script.sh +++ b/travis/script.sh @@ -1,6 +1,9 @@ #!/bin/sh set -e +IOSSDK="`xcodebuild -showsdks 2>/dev/null | grep iphoneos | sed 's/.*iphoneos\(.*\)/\1/'`" +OSXSDK="`xcodebuild -showsdks 2>/dev/null | grep macosx | sed 's/.*macosx\(.*\)/\1/'`" + if test "x`uname`" = xLinux ; then distdir=libetpan-travis-build ./autogen.sh --with-curl=no --disable-db --with-expat=no @@ -13,12 +16,12 @@ if test "x`uname`" = xLinux ; then make imap-sample else echo Building library for iPhoneOS - xctool -project build-mac/libetpan.xcodeproj -sdk iphoneos8.1 -scheme "libetpan ios" build ARCHS="armv7 armv7s arm64" + xctool -project build-mac/libetpan.xcodeproj -sdk iphoneos$IOSSDK -scheme "libetpan ios" build ARCHS="armv7 armv7s arm64" echo Building library for iPhoneSimulator - xctool -project build-mac/libetpan.xcodeproj -sdk iphonesimulator8.1 -scheme "libetpan ios" build ARCHS="i386 x86_64" + xctool -project build-mac/libetpan.xcodeproj -sdk iphonesimulator$IOSSDK -scheme "libetpan ios" build ARCHS="i386 x86_64" echo Building library for Mac - xctool -project build-mac/libetpan.xcodeproj -sdk macosx10.10 -scheme "static libetpan" build + xctool -project build-mac/libetpan.xcodeproj -sdk macosx$OSXSDK -scheme "static libetpan" build echo Building framework for Mac - xctool -project build-mac/libetpan.xcodeproj -sdk macosx10.10 -scheme "libetpan" build + xctool -project build-mac/libetpan.xcodeproj -sdk macosx$OSXSDK -scheme "libetpan" build fi