readfile returns a value of type ssize_t (signed) and returns -1 if an
error occurs. In auth_readdb_internal, however, we were assigning the
return value of readfile to a variable of type size_t (unsigned), but
then testing this unsigned value to see if it was < 0, a
contradiction. We would thus simultaneously fail to report the error
in readfile and would end up with a corrupted length value.
sres_cached_answers_sockaddr is supposed to return ENOENT if no cached
records are found. Because of the missing return statement, however,
it would never do this and would instead return something very likely
to be garbage.
base64_d returns a value of size_t, which is unsigned. The value
therefore cannot be less than zero. The second check testing whether
it is >= INT_MAX is not a contradiction, but it doesn't make any sense
to check for this (as far as I can tell).
Converting these macros to functions declared static inline allow the
C type-checker to work and avoid warnings about unused expression
values. These warnings break the build with clang.
This avoid warnings about expressions with unused values. These
warnings break the build with clang.
An optimizing compiler should still inline these calls. If that turns
out not to happen on some platform, we could rename the functions used
internally and declare them static inline.
In a sofia profile, you can now set the parameter tls-timeout to a
positive integer value which represents the maximum time in seconds
that OpenSSL will keep a TLS session (and its ephemeral keys) alive.
This value is passed to OpenSSL's SSL_CTX_set_timeout(3).
OpenSSL's default value is 300 seconds, but the relevant standard
(RFC 2246) suggests that much longer session lifetimes are
acceptable (it recommends values less than 24 hours).
Longer values can be useful for extending battery life on mobile
devices.
Signed-off-by: Travis Cross <tc@traviscross.com>