Commit Graph

310 Commits

Author SHA1 Message Date
Dmitry Podgorny
b04c40d3ea tls: don't hang with openssl implementation
* Exit from tls_start() on fatal errors. If SSL_connect() fails and
  returns -1 this leads to endless loop in case of fatal error.
* Don't set writefds on SSL_ERROR_WANT_READ. Otherwise, this makes
  select(2) exit immediately what leads to CPU usage.
2015-10-13 02:43:23 +03:00
Tristan Le Guern
442914c375 Shorten the nlen+dlen+rlen part 2015-10-13 01:11:45 +03:00
Tristan Le Guern
a4558b69df Publicly expose JID manipulation functions 2015-10-13 01:11:25 +03:00
Dmitry Podgorny
07751974ac conn: fixed typo 2015-10-13 00:53:15 +03:00
Dmitry Podgorny
8ff46add8c conn: don't remember tls state from old connection
* Clear conn->secured and conn->tls_failed. These values could be
  saved after re-connect.
* conn is not secured if conn->tls is NULL. This condition handles
  disconnected connections.
2015-10-13 00:44:23 +03:00
Dmitry Podgorny
b7fbc81740 conn: added API xmpp_conn_is_secured()
This patch is provided by @kjkao. New API is already used in
WorksSystems/wks_xep0047.
2015-10-13 00:10:02 +03:00
Dmitry Podgorny
36af7afa27 conn: implemented old-style SSL connection
Added new API xmpp_conn_set_old_style_ssl(). This function forces
using of old-style SSL connection.
2015-10-12 22:25:39 +03:00
Dmitry Podgorny
254b9d73a1 sock: do nothing if srv lookup fails
Proper action is performed in xmpp_connect_client.
2015-10-12 22:06:27 +03:00
Dmitry Podgorny
8fcac79301 Makefile.am: removed whitespaces 2015-10-12 20:51:24 +03:00
Dmitry Podgorny
a48add8f13 ChangeLog: new features in 0.8.9 2015-10-12 16:12:34 +03:00
Dmitry Podgorny
8627fbb13f Implemented UUID generation (RFC4122)
This patch adds new API:
  * xmpp_uuid_gen()
2015-10-12 15:17:22 +03:00
Dmitry Podgorny
5e64c850bd Added stddef.h to strophe.h to define size_t 2015-10-12 15:02:59 +03:00
Dmitry Podgorny
533664903a tls: fixed GnuTLS implementation 2015-10-11 16:30:50 +03:00
Dmitry Podgorny
cda805163f conn: cleanup of headers
* added stdarg.h
* removed unused headers
2015-10-11 05:38:12 +03:00
Dmitry Podgorny
3d4c657467 Removed stdio.h from strophe.h 2015-10-11 05:25:19 +03:00
Dmitry Podgorny
8339fd0420 sock: socket should be non-blocking
Event loop handles asynchronous connections.
2015-10-11 05:20:31 +03:00
Dmitry Podgorny
63946ff7ef sock: set AI_ADDRCONFIG only if defined
AI_ADDRCONFIG is undefined on some systems.
2015-10-10 23:09:48 +03:00
Dmitry Podgorny
e6bbfa7a62 Updated license in new files 2015-10-10 01:11:08 +03:00
Chih-Wei Chen
b2a98fb9b6 sock : Add IPv6 support 2015-10-10 00:24:08 +03:00
Dmitry Podgorny
f326c2f42f sha1: added prefix crypto_ to SHA1 API
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.
2015-10-09 12:14:23 +03:00
Dennis Schridde
3b55c20879 Fix --without-libxml2
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
2015-10-09 02:20:01 +03:00
christoph
a335466450 Fix invalid write in dopr(...)
Fix an invalid write in dopr(...) that occured when maxlen == 0 and
buffer != 0 since 0-1 > 0 using size_t.
2015-10-07 22:45:44 +03:00
Dmitry Podgorny
c73ddf065b autotools: set development version to 0.8.9 2015-10-07 22:27:26 +03:00
Dmitry Podgorny
fa585fd107 Removed outdated vs2008 directory 2015-10-07 22:20:22 +03:00
Dmitry Podgorny
7a782df9f5 auth: memory leak in _make_scram_sha1_init_msg() 2015-10-07 20:02:45 +03:00
Tristan Le Guern
982d840472 Signed to unsigned conversion to appease GCC 2015-10-07 19:48:35 +03:00
Tristan Le Guern
75938845fd Add missing prototypes to strophe.h 2015-10-07 19:46:55 +03:00
Dmitry Podgorny
e70e755e19 tests: added UT for SCRAM-SHA1 functions 2015-10-07 19:42:16 +03:00
Dmitry Podgorny
5e37de2b63 tests: added test vectors for Hash_DRBG 2015-10-07 19:35:42 +03:00
Dmitry Podgorny
10656ead46 Introduced PRNG based on Hash_DRBG (NIST SP 800-90A)
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
2015-10-07 19:35:42 +03:00
Dmitry Podgorny
75b1a633d6 sha1: moved wrapper SHA1() to sha1.c 2015-10-07 19:35:42 +03:00
Tristan Le Guern
109aaa71a5 Fix behaviour of libstrophe on signed char arch
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
2015-10-07 15:01:14 +03:00
Dmitry Podgorny
92709a773c hash: fixed hash_new() prototype 2015-09-28 14:31:48 +03:00
Tristan Le Guern
93f9a5d1e8 Don't lie about array parameters 2015-09-28 14:26:25 +03:00
Tristan Le Guern
0acec5c335 -Wshadow for hash.c 2015-09-28 14:26:25 +03:00
Tristan Le Guern
0e8d407f93 Correct a type in scram.c 2015-09-28 14:26:25 +03:00
Tristan Le Guern
ed5f982312 Don't lie about array parameters
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.
2015-09-28 14:26:24 +03:00
James Booth
cd92f69c76 Fixed Changelog 0.8.8 2015-08-18 22:07:06 +01:00
James Booth
73080e0660 Fixed indentation in Changelog 2015-08-18 22:00:43 +01:00
James Booth
7cdef1e319 Check for name element when reading mechanisms
Fixes an issue where the server sends whitespace between
elements, a segfault would occur when performing a strcmp
on the name.
2015-08-03 23:05:04 +01:00
James Booth
527bc0573a Fixed _log_open_tag to remove namespace prefix with libexpat 2015-03-28 17:37:11 +00:00
James Booth
59d2dd55d2 Added codelite project to .gitignore 2015-03-26 20:58:05 +00:00
James Booth
b1cbcffdc7 Bumped version, added to Changelog 2015-03-26 20:52:48 +00:00
James Booth
154b70ed2c Merge remote-tracking branch 'cwtitan/namespace' 2015-03-26 20:44:10 +00:00
Codewalker
e33a98e498 Streamline xmpp_stanza_to_text for the namespace patch by following XML
namespace scoping guidelines and not outputting the xmlns attribute in
contexts where it can be inferred from the parent element.
2015-01-23 11:11:23 -06:00
shooding
239d365ea1 fix Makefile.am to respect openssl_CFLAGS, which is useful if openssl is not installed in the default path, e.g. cross-compiling. 2015-01-14 18:06:35 +08:00
Dmitry Podgorny
57ed30b2bc autotools: fixed build with old versions of automake
Automake-1.11 and some newer versions fail if m4/ doesn't exist. This
behaviour was changed to warning in version 1.13.2.
2015-01-03 01:01:07 +02:00
Codewalker
86f913b001 Fix use of snprintf (which does not exist on all platforms) in auth.c
by replacing it with xmpp_snprintf in order to be consistent with the
rest of the code. Also fixes compile error on MSVC.
2015-01-02 20:21:59 +02:00
Codewalker
e2f1c1e94a Add XML namespace support. 2014-12-28 22:46:16 -06:00
Codewalker
f62d817c71 Fix error spam in event loop when no connections are open.
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.
2014-12-24 12:08:05 -06:00