1 --- src.origin/ne_locks.c 2007-02-05 11:09:27.000000000 +0100
2 +++ src/ne_locks.c 2015-11-11 16:12:11.236849082 +0100
11 #include <ctype.h> /* for isdigit() */
15 if (ne_strcasecmp(timeout, "infinite") == 0) {
16 return NE_TIMEOUT_INFINITE;
17 } else if (strncasecmp(timeout, "Second-", 7) == 0) {
18 - long to = strtol(timeout+7, NULL, 10);
19 - if (to == LONG_MIN || to == LONG_MAX)
20 + // according RFC 4918 the value used for lock timeout is unsigned 32 bit
21 + // see: <http://tools.ietf.org/html/rfc4918#section-10.7>
22 + // adapt it to the 'long' used internally by neon instead
24 + unsigned long to1 = strtoul(timeout+7, NULL, 10);
25 + if (to1 == ULONG_MAX && errno == ERANGE)
26 return NE_TIMEOUT_INVALID;
27 + NE_DEBUG(NE_DBG_LOCKS, "Parsed lock timeout: %lu\n", to1);
29 + // LONG_MAX means around 68 years,
30 + // more than enough for practical use
37 return NE_TIMEOUT_INVALID;