Commit Graph

713 Commits

Author SHA1 Message Date
iphydf
9c03439ad0
Fix out of bounds read in error case in messenger_test.
Also got rid of two VLAs. They are overused a bit in toxcore. In
irc_syncbot, the array was uninitialised and then filled by a recv system
call. This can cause uninitialised reads if recv doesn't fill the entire
array. It could not cause out of bounds read directly, because a
NUL-terminator was in place, but both cases are undefined behaviour.
2018-01-26 01:30:06 +00:00
iphydf
42636861d8
Publish a single public BUILD target for c-toxcore. 2018-01-22 21:18:24 +00:00
iphydf
e6c04ef028
Use self-built portaudio instead of system-provided. 2018-01-22 00:44:19 +00:00
iphydf
52778aed93
Make BUILD files more finely-grained.
This allows us to precisely see which libraries depend on which and lets
us split them up more, if necessary.
2018-01-21 19:44:09 +00:00
iphydf
1cecb6c87a
Add BUILD files for all the little tools in the repo.
Also, fix av_test.c, since I broke it last time.
2018-01-21 01:31:11 +00:00
iphydf
822dd2fac2
Don't allocate or dereference Tox_Options in tests.
This struct will soon become opaque.
2018-01-21 00:14:43 +00:00
iphydf
98febe0589
Add testing/*.c (except av_test) to bazel build. 2018-01-20 19:32:12 +00:00
iphydf
d7583a719a
Remove nTox from the repo.
It's a maintenance burden nobody uses. Let's make toxic the official
console client, instead.
2018-01-20 19:05:53 +00:00
iphydf
18a33169b8
Add bazel build scripts for c-toxcore.
This allows us and users to reproducibly build verified versions of the
library with checksums. It will power the toktok-stack continuous build
with checked-in checksums at specific git revisions.
2018-01-18 16:11:52 +00:00
iphydf
643eea60bb
Make DHT a module-private type. 2018-01-16 20:06:07 +00:00
iphydf
cec5fea71b
Remove hstox test for now.
This isn't adding value. We're going to redo the whole rpc test framework
in the future, after a lot of refactoring that the hstox test currently
just stands in the way of.
2018-01-15 11:29:51 +00:00
iphydf
1eea3f0ab6
Fix some memory or file descriptor leaks in test code.
Also some missing return value checks for `fopen`.
2018-01-14 19:15:28 +00:00
iphydf
54ec162558
Fix formatting in some C files.
Also replace &(x) with &x for consistency.
2018-01-10 18:57:37 +00:00
iphydf
a3079e82dd
Fix file descriptor leak in hstox test.
We return E_WRITE because closing only fails when an I/O error occurs,
which is likely an error from the write() call above. See close(2) for
details.

http://man7.org/linux/man-pages/man2/close.2.html
2018-01-10 18:57:29 +00:00
iphydf
2e33ab26df
Zero-initialise stack-allocated objects in hstox driver.
These potentially cause uninitialised reads on some platforms or msgpack
library versions.
2018-01-10 18:57:25 +00:00
iphydf
2c8fb05f6e Remove deprecated ToxDNS
Based on #331.

Fixes #42.
2017-12-29 00:32:18 +00:00
iphydf
f2b6090eca Generate only one large library "libtoxcore".
This library contains all the code for the old libtoxcore, libtoxav,
libtoxdns, and libtoxencryptsave. The build for toxav is still optional,
and disabling it causes libtoxcore to simply not contain those symbols
and the pkg-config file to not include opus and vpx as dependencies.
2017-12-28 23:01:41 +00:00
endoffile78
83377e6865
Fix include for endian.h and add includes for sys/stat.h and
netinet/in.h
2017-12-28 10:29:42 -06:00
Diadlo
66b8a7685e
AF_INET -> TOX_AF_INET 2017-08-24 20:09:08 +03:00
iphydf
cb69b8a986
Build tests on appveyor, the MSVC build.
Tests are not actually ran on appveyor for now, since they all fault for
some reason. For now, we just build them. Also, some tests are disabled
on msvc entirely, because they don't even compile. We'll need to look
into those, later. They are disabled using `MSVC_DONT_BUILD`.
2017-06-05 13:45:20 +00:00
iphydf
b782ef5d8e
Fix formatting and spelling in version-sync script.
Also some minor reformatting and fixes to the hstox sut driver.
2017-06-04 12:07:43 +00:00
iphydf
d4be41a3ad
Use new encoding of Maybe in msgpack results.
The new encoding is `0` for `Nothing` and `[1, x]` for `Just x`.
2017-06-03 23:32:46 +00:00
Diadlo
50c526e1a5
Move c_sleep to helpers.h and misc_tools.h
Also fix a mistake with forgotten braces around parameter
2017-03-25 20:40:34 +03:00
Diadlo
c1e3358dcd
Fix formatting with astyle
Fix #494
2017-03-04 15:32:00 +03:00
Maxim Biro
aaca8251c8 Remove dependency on strings.h 2017-03-01 20:43:30 -05:00
Diadlo
b19a9e5464
Add part of platform-independent network API implementation
socket      -> net_socket
htons       -> net_htons
htonl       -> net_htonl
connect     -> net_connect
sendto      -> net_sendto_ip4
getaddrinfo -> net_getipport
sa_family_t -> Family
2017-02-26 23:16:16 +03:00
iphydf
6ae33c16cf
Add VLA compatibility macro for C89-ish compilers. 2017-01-28 20:49:12 +00:00
Diadlo
f00006cf1d
Add platform-independent Socket and IP implementation 2017-01-26 23:11:15 +03:00
zugz
b630121f2f reduce thread-unsafe use of static variables
- rework ip_ntoa() to avoid use of static variables
- rework sort_client_list() to avoid use of static variables
- move static 'lastdump' into Messenger struct
- rework ID2String() to avoid use of static variables; rename to id_to_string()
- fetch_broadcast_info(): attempt to mitigate risks from concurrent execution
- current_time_monotonic(): attempt to mitigate risks from concurrent execution
- comment on non-thread-safety of unix_time_update
2017-01-21 22:08:52 +01:00
iphydf
8f96ca6d86
Update license headers and remove redundant file name comment.
"All rights reserved" was incorrect. The project was licensed under GPL3,
which means a lot of rights are licensed to everybody in the world, i.e.
not reserved to the "Tox Project".
2017-01-19 00:01:44 +00:00
Yuri
68f80d260b Fixed FreeBSD build failure due to undefined MSG_NOSIGNAL. 2017-01-13 00:24:00 -08:00
iphydf
8b4eae4038
Remove TOX_DEBUG and have asserts always enabled.
These are cheap asserts. I've also replaced the fprintf's with
`LOGGER_ERROR` calls.
2017-01-11 19:43:08 +00:00
David Zero
8ef1f35ca7 Revert "Revert "Portability fixes""
This reverts commit 59e2a844f0, and
defines _DARWIN_C_SOURCE in toxcore/network.c
2017-01-06 04:20:00 -08:00
endoffile78
59e2a844f0 Revert "Portability fixes"
This reverts commit f3469070fe.
2017-01-05 15:16:56 -06:00
David Zero
f3469070fe Portability fixes
- CFLAG gnu99 was changed to c99.
- CXXFLAG c++98 was changed to c++11.
- CFLAG -pedantic-errors was added so that non-ISO C now throws errors.
- _XOPEN_SOURCE feature test macro added and set to 600 to expose SUSv3
  and c99 definitions in modules that required them.
- Fixed tests (and bootstrap daemon logging) that were failing due to
  the altered build flags.
- Avoid string suffix misinterpretation; explicit narrowing conversion.
- Misc. additions to .gitignore to make sure build artifacts don't wind
  up in version control.
2017-01-04 13:44:39 -08:00
iphydf
ce29c8e7ec
Wrap all sodium/nacl functions in crypto_core.c. 2016-12-22 10:26:59 +00:00
Gregory Mullen (grayhatter)
ad517eb1df
add NAT hole punching level to Tox API 2016-11-24 17:38:34 -08:00
iphydf
656f0b9112 Support float32 and float64 in msgpack type printer. 2016-11-21 02:25:11 +00:00
Maxim Biro
a403c996b5 Fix a memory leak in hstox interface 2016-11-20 20:14:53 -05:00
Mikhael-Danilov
06ad5613bc Support arbitrary video resolutions in av_test 2016-11-12 20:10:56 +03:00
iphydf
fe1fea82c3
Add decode/encode PlainText test support.
These are implemented in terms of decode/encode CipherText. They do the
exact same thing, since they are both simple length-prefixed byte arrays.
2016-11-11 00:00:37 +00:00
iphydf
aed24408db
Remove new_nonce function in favour of random_nonce.
`new_nonce` has been an alias for `random_nonce` for a while now. Having
two names for the same operation is confusing. `random_nonce` better
expresses the intent. The documentation for `new_nonce` talks about
guaranteeing that the nonce is different from previous ones, which is
incorrect, it's just quite likely to be different.
2016-11-09 22:30:49 +00:00
iphydf
42dfdf73c1
Add spectest to the cmake test suite.
This allows for easier development. It is not used on travis (yet).
2016-11-08 21:58:26 +00:00
iphydf
82515f92ee
Move log callback to options.
Previously, all log messages generated by tox_new (which is quite a lot)
were dropped, because client code had no chance to register a logging
callback, yet. This change allows setting the log callback from the
beginning and removes the ability to unset it.

Since the log callback is forever special, since it can't be stateless,
we don't necessarily need to treat it uniformly (with `event`).
2016-11-06 20:35:09 +00:00
iphydf
cf94537266
Enable all possible C compiler warning flags.
We disable the ones that fire, so we can use -Werror. We can then
investigate each warning individually and see whether to fix it or to
keep silencing it.
2016-11-06 01:32:10 +00:00
iphydf
96c672aef5
Compile as C++ for windows builds.
Compiling as C++ changes nothing semantically, but ensures that we don't
break C++ compatibility while also retaining C compatibility.

C++ compatibility is useful for tooling and additional diagnostics and
analyses.
2016-11-02 18:50:41 +00:00
iphydf
c037100747
Import the hstox SUT interface from hstox.
We'll maintain it in the c-toxcore repo, where it belongs.
2016-10-01 02:13:34 +01:00
iphydf
1977d56caa
Remove return after no-return situation (and other cleanups).
Cleanups:
- Fix header guards to not use reserved names.
- Avoid name shadowing.
- Removed an unused variable found by avoiding name shadowing.
2016-09-30 19:06:44 +01:00
iphydf
d369448ace
Work around bug in opencv3 headers.
OpenCV 3.1 doesn't define cvRound in C, only in C++. Thus, we now need
to compile av_test as C++ code.
2016-09-25 01:58:51 +01:00
iphydf
f60900c4b8
Move ring buffer out of toxcore/util into toxav.
Toxcore itself doesn't use this data structure. Only toxav does, so now
toxav owns the code for it.
2016-09-24 23:36:50 +01:00