62 Commits

Author SHA1 Message Date
Dmitry Podgorny
4e53184eee tests/stanza: add test for xmpp_stanza_reply_error() 2021-07-17 01:23:16 +03:00
Dmitry Podgorny
2bf1988b3c parser: fix memory leak in error path for depth more than 1
If parser has an unfinished stanza with depth > 1, it can happen that
parser->stanza points to a child. Releasing the child doesn't free the
parent stanza.

Instead of releasing parser->stanza in parser_reset() and parser_free(),
find the top most parent and release the whole tree. Also add a test
case for this memory leak.
2021-06-27 03:44:55 +03:00
Jordy Zomer
1f0a3f1ad1 Add basic fuzzing support for libstrophe 2021-06-26 17:05:53 -04:00
Dmitry Podgorny
d1ce4b35ae tests/xmppaddr: improve error reports
COMPARE() assumes that the first argument is the reference. Swap
arguments to report right expected value.
2021-03-23 02:14:25 +02:00
Steffen Jaeckel
25d3a2d459 add test for new API's
Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
2021-03-23 02:04:59 +02:00
Dmitry Podgorny
cf2f7147d9 tests/rand: don't define xmpp_snprintf when HAVE_SNPRINTF is set
If HAVE_SNPRINTF is set, xmpp_snprintf is replaced with snprintf symbol
and it can cause issues (e.g. on MacOS system).
2021-03-23 00:30:09 +02:00
Dmitry Podgorny
db8a511f68 style: remove extra const keyword from interfaces
Const variables in prototypes don't add much value, but make the code
larger and redundant. Remove these const keywords.
Note, this doesn't apply to pointers to const memory.
2021-03-19 22:12:15 +02:00
Dmitry Podgorny
428681a185 stanza: add xmpp_stanza_new_from_string()
This function creates a stanza object from a string. The string must
contain a single complete stanza. Multiple stanzas will lead to memory
leak and this is not handled in the patch.
2020-06-04 03:44:21 +03:00
Steffen Jaeckel
f2c658723f clean-up 2020-04-30 12:03:57 +02:00
Oleg Synelnykov
198bdd77d0 Remove -Wno-unused-parameter
Introduced UNUSED macro with cast to void in commoh.h for internal
use. Used cast to void directly in those files which do not
include common.h. Although this change doesn't fix semantic issues
with unused function parameters, it does explicitly mark all those
places, which might require attention in future.
2020-03-31 17:37:12 +03:00
Dmitry Podgorny
6fdac3ae72 tests/sha512: add test case for a million of a 2020-01-31 01:59:42 +02:00
Dmitry Podgorny
623ff164de tests/scram: add HMAC test vector
Add test for HMAC and make other tests independent from SHA1.
2020-01-31 01:59:42 +02:00
Steffen Jaeckel
709e41fd10 add SHA256&SHA512 tests 2020-01-31 01:59:42 +02:00
Steffen Jaeckel
fc064bc883 re-factor SCRAM to be independent of the hash 2020-01-31 01:34:23 +02:00
Dmitry Podgorny
562a06425b Unify coding style
@sjaeckel integrated clang-format with formal coding style. Run his
script and commit changes.

There are pros and cons of this commit.

Mixed coding style is a "broken window". A good single style simplifies
reading and writing code.

On the other hand, this is a big change which will lead to conflicts.
2020-01-31 01:16:50 +02:00
Steffen Jaeckel
abd1b08a97 trim trailing spaces 2020-01-31 01:14:32 +02:00
Dmitry Podgorny
212df6d036 tests: add test for stanza functions
Check reference counting in xmpp_stanza_add_child() amd
xmpp_stanza_add_child_ex().
2020-01-10 00:50:22 +02:00
Dmitry Podgorny
2e325e5e68 tests/sha1: fix type mismatch warning 2020-01-05 00:28:01 +02:00
Andrey Starodubtsev
ab568a2666 memory leak in hash values fixed 2018-12-13 14:28:41 +03:00
Scott M Anderson
5b204b0938 fix strtok_r test on MSW 2018-02-18 09:55:33 +02:00
Dmitry Podgorny
82040403bf tests/hash: enable the test 2017-06-29 20:22:55 +03:00
Steffen Jaeckel
c074a6166c enable some warnings & fix 'em 2017-06-29 16:58:11 +02:00
Alexander Krotov
2f9bcfe145 Test xmpp_jid_bare 2017-06-23 20:00:41 +03:00
Dariusz Dwornikowski
d1a41c9d7d Fixed occurred spelling error fixes: #96 2016-09-23 08:31:31 +02:00
Dmitry Podgorny
b360316b8b tests/resolver: added test case with pointers 2016-09-16 01:01:43 +03:00
Dmitry Podgorny
c6aaa96dcb resolver: fixed few bugs
Fixed a bug which caused resolver to return a wrong target name with a
missed ".". The bug was in the part of message_name_get() where a pointer
is handled.
Added checks for buffer overflow.
Added 2 test cases to check a corner case and error handling.
2016-09-15 19:26:10 +03:00
Dmitry Podgorny
f0706f56c4 tests: remove dependency on check package
Only check_parser depends on the check. Convert it. All tests will be
rewritten at once when new testsuite is implemented.
2016-09-15 12:46:11 +03:00
Tim Nieradzik
7ad42add73 test_string: Fix failing strdup test
`rc` may be initialised with -1.
2016-09-05 09:11:55 +03:00
Dmitry Podgorny
233094af10 tests/parser: include string.h explicitly 2016-09-04 03:35:28 +03:00
Dmitry Podgorny
c80f99bc68 tests: add tests for string functions 2016-09-04 00:53:24 +03:00
Dmitry Podgorny
f351d62355 tests/jid: fixed crash on QNX
QNX version of printf() doesn't check whether a string is valid or not.
Passing NULL pointer leads to a crash inside strlen(). Fix this with a
wrapper _s() which returns "<NULL>" for instead of NULL pointer.
Add checks before strcmp() to avoid crash in case of unexpected result
of the jid functions.
2016-09-02 19:57:25 +03:00
Dmitry Podgorny
b6fcb7035d rand: replace time() with time_stamp() as entropy source
time_stamp() has bigger precision.
2016-09-02 17:38:42 +03:00
Dmitry Podgorny
2b2de142ef tests/resolver: fix the test and add new testcase
It was broken because of changed API.
2016-09-02 12:45:28 +03:00
Dmitry Podgorny
14066d0bff resolver: fix commit 171b285 2016-08-29 20:09:45 +03:00
Dmitry Podgorny
2ffb278aa4 Implemented public Base64 interface
Base64 is required for vCard avatars. It will also be useful for
an authentication mechanism with future xmpp_connect_raw() interface.
2016-04-30 18:09:01 +00:00
Dmitry Podgorny
7f57e3987a tests/resolver: don't link against -lstrophe 2016-04-30 16:40:10 +00:00
Dmitry Podgorny
c62d1d64ab tests/ctx: enable the test 2016-04-30 16:37:18 +00:00
Dmitry Podgorny
c9a5cba113 tests/jid: enable the test 2016-04-30 16:15:45 +00:00
Dmitry Podgorny
565ace7982 tests/snprintf: undef HAVE_SNPRINTF and HAVE_VSNPRINTF 2016-04-29 22:51:23 +00:00
Dmitry Podgorny
6d70bf4b0d tests/sha1: fixed indentation 2016-04-13 12:40:42 +00:00
Dmitry Podgorny
3aafeef215 res_query_dump: added comment with printable symbols 2016-04-13 12:38:53 +00:00
Dmitry Podgorny
b7e308d057 Implemented resolver to replace sock_srv_lookup() 2016-02-20 00:15:08 +02:00
Dmitry Podgorny
98c8afd5fc tests: updated SHA1 test
* added new testcase with 128 'a'
* added check that SHA1 functions don't change original strings
2015-12-04 09:57:09 +02:00
Dmitry Podgorny
331db6f565 tests: added test vectors for MD5 2015-10-18 03:05:38 +03:00
Tristan Le Guern
a61dba0c13 Move declarations of xmpp_{v,}snprintf.
Use HAVE_SNPRINTF and HAVE_VSNPRINTF to conditionnaly use an internal
version of these functions or use the libc one.
2015-10-16 14:48:10 +03:00
Dmitry Podgorny
60cfcc72e6 snprintf: moved self-test to a separated test 2015-10-16 00:05:26 +03:00
Dmitry Podgorny
e41b7a06e4 sha1: moved self test to separated test 2015-10-15 00:35:19 +03:00
Dmitry Podgorny
e0a13ecdaa tests/base64: updated and added to Makefile.am 2015-10-13 23:19:25 +03:00
Dmitry Podgorny
fc856f36a3 tests/parser: fixed gcc warning
tests/check_parser.c:59:9: error: variable ‘ret’ set but not used
2015-10-13 22:39:27 +03:00
Dmitry Podgorny
9b67acbfc4 tests: moved common routines to test.[ch] 2015-10-13 22:38:18 +03:00