From 72b0f89205e09abc23dc794721b296a4ab9489f7 Mon Sep 17 00:00:00 2001 From: Volker Birk Date: Thu, 30 Jul 2020 13:20:10 +0200 Subject: [PATCH 1/8] fixing timegm_with_gmtoff() --- src/etpan_mime.c | 4 ++++ src/timestamp.c | 22 ++++++++++++++-------- src/timestamp.h | 4 ++-- 3 files changed, 20 insertions(+), 10 deletions(-) diff --git a/src/etpan_mime.c b/src/etpan_mime.c index 7f68eb07..2b09ecc7 100644 --- a/src/etpan_mime.c +++ b/src/etpan_mime.c @@ -548,6 +548,10 @@ timestamp * etpantime_to_timestamp(const struct mailimf_date_time *et) result->tm_mon = et->dt_month - 1; result->tm_year = et->dt_year - 1900; result->tm_gmtoff = 36L * (long) et->dt_zone; + + time_t t = timegm_with_gmtoff(result); + gmtime_r(&t, result); + return result; } diff --git a/src/timestamp.c b/src/timestamp.c index 688221b3..3e9f6e60 100644 --- a/src/timestamp.c +++ b/src/timestamp.c @@ -10,12 +10,21 @@ #include -DYNAMIC_API time_t timegm_with_gmtoff(timestamp* ts) +DYNAMIC_API time_t timegm_with_gmtoff(const timestamp* ts) { - const time_t raw_time = timegm(ts); + if (!ts) + return -1; + + timestamp *_ts = timestamp_dup(ts); + if (!_ts) + return -1; + + const time_t raw_time = timegm(_ts); if(raw_time==-1) return -1; - + + free_timestamp(_ts); + return raw_time - ts->tm_gmtoff; } @@ -44,11 +53,8 @@ DYNAMIC_API timestamp * timestamp_dup(const timestamp *src) if (!src) return NULL; - timestamp *dst = calloc(1, sizeof(timestamp)); - assert(dst); - if (!dst) - return NULL; - + timestamp *dst = (timestamp *) malloc(sizeof(timestamp)); memcpy(dst, src, sizeof(timestamp)); + return dst; } diff --git a/src/timestamp.h b/src/timestamp.h index 87538155..8989d4de 100644 --- a/src/timestamp.h +++ b/src/timestamp.h @@ -34,11 +34,11 @@ typedef struct tm timestamp; // timegm_with_gmtoff() - convert the broken-out time into time_t, and respect tm_gmtoff // // parameters: -// timeptr(inout) broken-out time; members will be "normalized" by this function. +// timeptr(in) broken-out time // // return value: // time_t that holds the usual "seconds since epoch" -DYNAMIC_API time_t timegm_with_gmtoff(timestamp* ts); +DYNAMIC_API time_t timegm_with_gmtoff(const timestamp* ts); // new_timestamp() - allocate a new timestamp From 065b5463b806cb62a6e1a44c1afab454db82b64f Mon Sep 17 00:00:00 2001 From: Volker Birk Date: Thu, 30 Jul 2020 14:35:33 +0200 Subject: [PATCH 2/8] now it behaves the same --- src/platform_windows.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/platform_windows.cpp b/src/platform_windows.cpp index 6d7321d3..10a7fbc3 100644 --- a/src/platform_windows.cpp +++ b/src/platform_windows.cpp @@ -406,6 +406,7 @@ DYNAMIC_API time_t timegm(timestamp *timeptr) if (!timeptr) return -1; + timeptr->tm_gmtoff = 0; time_t result = _mkgmtime((struct tm *) timeptr); if (result == -1) return -1; From cb6663104ac9d3396ba32312e0def37761519bcb Mon Sep 17 00:00:00 2001 From: Thomas Date: Thu, 30 Jul 2020 15:03:14 +0200 Subject: [PATCH 3/8] Asn1 on Windows, only generate code and delete pEp folder when rebuilding --- build-windows/libpEpasn1/libpEpasn1.vcxproj | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/build-windows/libpEpasn1/libpEpasn1.vcxproj b/build-windows/libpEpasn1/libpEpasn1.vcxproj index 7bd8f91d..b63f687d 100644 --- a/build-windows/libpEpasn1/libpEpasn1.vcxproj +++ b/build-windows/libpEpasn1/libpEpasn1.vcxproj @@ -60,10 +60,6 @@ Windows - - cd "$(ProjectDir)..\.." && "$(ProjectDir)..\generate_code.cmd" - Generating Code for pEp Sync - @@ -81,10 +77,6 @@ true true - - cd "$(ProjectDir)..\.." && "$(ProjectDir)..\generate_code.cmd" - Generating Code for pEp Sync - @@ -227,4 +219,8 @@ + + + + \ No newline at end of file From b1da96a43849a5bbd1a057dc79289fb02ecbf4da Mon Sep 17 00:00:00 2001 From: Volker Birk Date: Thu, 30 Jul 2020 21:51:11 +0200 Subject: [PATCH 5/8] Automatically bumped RC in source for future release. Next RC after this one will be 2.1.0-RC24 **if released**. --- src/Makefile | 2 +- src/pEpEngine.h | 2 +- test/Makefile | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Makefile b/src/Makefile index 4eb4f3c2..16df3b30 100644 --- a/src/Makefile +++ b/src/Makefile @@ -28,7 +28,7 @@ endif ifeq ($(BUILD_ON),Darwin) ifeq ($(BUILD_FOR),Darwin) CFLAGS+= -DSQLITE_THREADSAFE=1 - LDLIBS+= -lz -liconv + LDLIBS+= -lz -liconv -mmacosx-version-min=10.10 else $(error I do not know how to make for $(BUILD_FOR) on $(BUILD_ON)) endif diff --git a/src/pEpEngine.h b/src/pEpEngine.h index 4a723795..f3427916 100644 --- a/src/pEpEngine.h +++ b/src/pEpEngine.h @@ -25,7 +25,7 @@ extern "C" { #define PEP_ENGINE_VERSION_MAJOR 2 #define PEP_ENGINE_VERSION_MINOR 1 #define PEP_ENGINE_VERSION_PATCH 0 -#define PEP_ENGINE_VERSION_RC 23 +#define PEP_ENGINE_VERSION_RC 24 #define PEP_OWN_USERID "pEp_own_userId" diff --git a/test/Makefile b/test/Makefile index fa5f973f..b4607103 100644 --- a/test/Makefile +++ b/test/Makefile @@ -16,7 +16,7 @@ SRCS:=$(wildcard src/*.cc) $(wildcard src/*/*.cc) OBJS:=$(addsuffix .o,$(basename $(SRCS))) DEPS:=$(OBJS:.o=.d) -LDFLAGS+= -L../asn.1 -L../src $(ETPAN_LIB) $(CPPUNIT_LIB) +LDFLAGS+= -L../asn.1 -L../src $(ETPAN_LIB) $(CPPUNIT_LIB) $(GTEST_LDFLAGS) TARGET:=EngineTests From 43e6d206e83c14d8cb52cd5b459ed43716dd61e1 Mon Sep 17 00:00:00 2001 From: Jorg Knobloch Date: Thu, 30 Jul 2020 22:50:42 +0200 Subject: [PATCH 6/8] ENGINE-780, take 2: After normalizing to UTC, forget the offset. --- src/etpan_mime.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/etpan_mime.c b/src/etpan_mime.c index 2b09ecc7..cea42004 100644 --- a/src/etpan_mime.c +++ b/src/etpan_mime.c @@ -549,8 +549,10 @@ timestamp * etpantime_to_timestamp(const struct mailimf_date_time *et) result->tm_year = et->dt_year - 1900; result->tm_gmtoff = 36L * (long) et->dt_zone; + // Normalize to UTC and then forget the offset. time_t t = timegm_with_gmtoff(result); gmtime_r(&t, result); + result->tm_gmtoff = 0; return result; } From ddbc9ce1d25845b5294810fa6f784a4831d21217 Mon Sep 17 00:00:00 2001 From: Volker Birk Date: Fri, 31 Jul 2020 00:18:09 +0200 Subject: [PATCH 8/8] Automatically bumped RC in source for future release. Next RC after this one will be 2.1.0-RC25 **if released**. --- src/pEpEngine.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pEpEngine.h b/src/pEpEngine.h index f3427916..94d24764 100644 --- a/src/pEpEngine.h +++ b/src/pEpEngine.h @@ -25,7 +25,7 @@ extern "C" { #define PEP_ENGINE_VERSION_MAJOR 2 #define PEP_ENGINE_VERSION_MINOR 1 #define PEP_ENGINE_VERSION_PATCH 0 -#define PEP_ENGINE_VERSION_RC 24 +#define PEP_ENGINE_VERSION_RC 25 #define PEP_OWN_USERID "pEp_own_userId"