sha1.c contains symbols that overlap with libcrypto. This patch
fixes linking with libstrophe as static library.
Prefix crypto_ will help to group other crypto API in the future.
The arguments of AC_ARG_WITH are (package, help-string, [action-if-given], [action-if-not-given]).
action-if-given takes effect when the flag is given in **either** form (--with or --without).
The proper code for action-if-given would thus be with_libxml2=$withval, which is already the default.
Thus leaving this argument empty is the proper course of action.
cf. https://autotools.io/autoconf/arguments.html
This pseudo-random number generator solves problem with
platform-independent generation of randomized nonces.
Current implementation uses weak entropy, especially when
kernel.randomize_va_space = 0. But it can be improved by
adding new sources to xmpp_rand_reseed().
New internal API introduced:
xmpp_rand_new
xmpp_rand_free
xmpp_rand
xmpp_rand_bytes
xmpp_rand_nonce
The use of 0xff as a separator for libexpat only works on arch where
char is defined as an unsigned char. This is an unportable behaviour.
Before this patch this is what I experienced:
xmpp DEBUG sock_connect to im.bouledef.eu:5222 returned 3
xmpp DEBUG attempting to connect to im.bouledef.eu
xmpp DEBUG connection successful
conn DEBUG SENT: <?xml version="1.0"?><stream:stream to="bouledef.eu" xml:lang="en" version="1.0" xmlns="jabber:client" xmlns:stream="http://etherx.jabber.org/streams">
conn ERROR Server did not open valid stream.
xmpp DEBUG Closing socket.
DEBUG: disconnected
event DEBUG Stopping event loop.
xmpp DEBUG RECV: <http://etherx.jabber.org/streamsÿfeatures><urn:ietf:params:xml:ns:xmpp-tlsÿstarttls><urn:ietf:params:xml:ns:xmpp-tlsÿrequired/></urn:ietf:params:xml:ns:xmpp-tlsÿstarttls></http://etherx.jabber.org/streamsÿfeatures>
event DEBUG Event loop completed.
name = http://etherx.jabber.org/streamsÿstream
Passing an array as a parameter to a function in C doesn't work, they decay
into pointer. Defining them is pointless and error prone, so just
declare a pointer.
On Win32 at least, select() will immediately fail with an error if
there are no file descriptors to wait for (max == 0). In the simple case
of a single XMPP session and an event loop that runs only while the
connection is open, this isn't a problem, but doesn't work for more
complex scenarios.
Add some handling so that if xmpp_run_once is called and there are no
active connections, simply sleep for duration of the timeout and
return.
Connection objects in the disconnected state should not have their
fd taken into account when determining the maximum socket fd number,
as they are not set in the bitmask with FD_SET, and their fd could
be anything, even a wildly large or small number.
By default libtool choose dynamic library for linking. Since non-public
API is hidden in libstrophe.so check_parser has been broken. As solution
libtool takes static libstophe.a now.