summaryrefslogtreecommitdiff
path: root/external/neon
diff options
context:
space:
mode:
authorGiuseppe Castagno <giuseppe.castagno@acca-esse.eu>2015-11-08 11:48:31 +0100
committerCaolán McNamara <caolanm@redhat.com>2015-11-10 12:33:08 +0000
commitf75c1966a6869eb043debbcb4432a6b12f874d10 (patch)
tree92910cb190eaa15ed75eff5de81739f6651caa8a /external/neon
parente3bd0951e6b8e8889aabc8640c5641ab32300517 (diff)
tdf#90249 fix lock timeout in neon for Windows platform.
According to RFC 4918 the value used for lock timeout is unsigned 32 bit, see: <http://tools.ietf.org/html/rfc4918#section-10.7> for info. This patch fix the way the timeout element of lock response payload is parsed in Windows. Change-Id: I335a1cb884c3ef1c2362b00981a2784d9232b23e Reviewed-on: https://gerrit.libreoffice.org/19867 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'external/neon')
-rw-r--r--external/neon/UnpackedTarball_neon.mk11
-rw-r--r--external/neon/neon_fix_lock_timeout_windows.patch27
2 files changed, 38 insertions, 0 deletions
diff --git a/external/neon/UnpackedTarball_neon.mk b/external/neon/UnpackedTarball_neon.mk
index 25784c4b7373..9cce366fc0d2 100644
--- a/external/neon/UnpackedTarball_neon.mk
+++ b/external/neon/UnpackedTarball_neon.mk
@@ -17,12 +17,23 @@ $(eval $(call gb_UnpackedTarball_add_files,neon,src,\
$(eval $(call gb_UnpackedTarball_set_patchlevel,neon,0))
+ifeq ($(OS),WNT)
$(eval $(call gb_UnpackedTarball_add_patches,neon,\
external/neon/neon.patch \
external/neon/neon_ne_set_request_flag.patch \
external/neon/neon_with_gnutls.patch \
external/neon/ubsan.patch \
external/neon/neon_fix_lock_token_on_if.patch \
+ external/neon/neon_fix_lock_timeout_windows.patch \
))
+else
+$(eval $(call gb_UnpackedTarball_add_patches,neon,\
+ external/neon/neon.patch \
+ external/neon/neon_ne_set_request_flag.patch \
+ external/neon/neon_with_gnutls.patch \
+ external/neon/ubsan.patch \
+ external/neon/neon_fix_lock_token_on_if.patch \
+))
+endif
# vim: set noet sw=4 ts=4:
diff --git a/external/neon/neon_fix_lock_timeout_windows.patch b/external/neon/neon_fix_lock_timeout_windows.patch
new file mode 100644
index 000000000000..d6fe030d9e15
--- /dev/null
+++ b/external/neon/neon_fix_lock_timeout_windows.patch
@@ -0,0 +1,27 @@
+--- src.origin/ne_locks.c 2007-02-05 11:09:27.000000000 +0100
++++ src/ne_locks.c 2015-11-08 17:21:52.968561488 +0100
+@@ -428,10 +428,20 @@
+ if (ne_strcasecmp(timeout, "infinite") == 0) {
+ return NE_TIMEOUT_INFINITE;
+ } else if (strncasecmp(timeout, "Second-", 7) == 0) {
+- long to = strtol(timeout+7, NULL, 10);
+- if (to == LONG_MIN || to == LONG_MAX)
+- return NE_TIMEOUT_INVALID;
+- return to;
++ // according RFC 4918 the value used for lock timeout is unsigned 32 bit
++ // see: <http://tools.ietf.org/html/rfc4918#section-10.7>
++ // adapt it to the 'long' used internally by neon instead
++ // LONG_MAX means around 68 years.
++ unsigned long to1 = strtoul(timeout+7, NULL, 10);
++ long to;
++ if (to1 >= LONG_MAX)
++ to = LONG_MAX - 1;
++ else
++ to = (long)to1;
++ NE_DEBUG(NE_DBG_LOCKS, "Received lock timeout: %ld\n", to);
++ if (to == LONG_MIN || to == LONG_MAX)
++ return NE_TIMEOUT_INVALID;
++ return to;
+ } else {
+ return NE_TIMEOUT_INVALID;
+ }