1692 Commits

Author SHA1 Message Date
Michael Jones
958f70d5c2
Use calloc where appropriate, avoid memset when normal buffer initialization works ()
Depends on https://github.com/coturn/coturn/pull/1547
2024-08-04 17:30:58 -07:00
Michael Jones
c4da2a8ea4
Fix make lint () 2024-08-04 17:21:34 -07:00
Michael Jones
5fa67a65f5
Fix compiler warnings from continuous integration ()
Almost all of the warnings were about truncating pointers, because
sizeof(void*) != sizeof(long) on all platforms.
2024-08-04 15:44:15 -07:00
Michael Jones
ba0ea42914
Fix nodejs/glibc problem with old container images. ()
This problem is caused by this issue:
https://github.com/actions/checkout/issues/1809

Several comments include documentation on various environment variables
to force it to use the older nodejs release still, but probably those
various workarounds will stop working eventually.
2024-08-04 15:40:17 -07:00
David Smitmanis
1f74024a30
windows: Only attempt to bind when the network interface is up ()
Previously if the system had an interface with a static IP configured,
coturn would attempt to bind to that address, even if the interface was
down. This would fail, and prevent coturn from starting (even if there
were other usable interfaces)
2024-07-26 22:22:25 -07:00
tyranron
00ce90cee0
Update Alpine to 3.20.2 version to fix CVE-2024-5535 in Docker image docker/4.6.2-r11 2024-07-26 13:10:14 +03:00
tyranron
7afa4e9ac9
Update Debian "bookworm" to 20240722 snapshot in Docker image 2024-07-26 12:39:52 +03:00
Pavel Punsky
c7d431a36a
Memset user_db before reading conf file, not after ()
Fixes  and 

Memsetting `turn_params.default_users_db` before reading conf file, not
after.
Because auth is read in first iteration so secret was wiped out.

# test plan
Add new test script that uses config file to setup turnserver instead of
cli arguments and confirm it works (fails without the change)
2024-07-14 16:59:26 -07:00
tyranron
d541f56613
Update Debian "bookworm" to 20240701 snapshot in Docker image 2024-07-03 11:50:59 +03:00
tyranron
fbe07c4a16
Update Alpine to 3.20.1 version to fix CVE-2024-4741, CVE-2023-42364 and CVE-2023-42365 in Docker image docker/4.6.2-r10 2024-06-21 07:19:38 +02:00
redraincatching
295b9cfe1a
added support for amazon linux and renamed tests.yml ()
superseding changes made in pr
https://github.com/coturn/coturn/pull/1394 on request of @jonesmz

dependent on pr https://github.com/coturn/coturn/pull/1399 - uses the
composite action for dependency installation i wrote there

added YAML file for amazon linux and renames tests.yml to
ubuntu_tests.yml for clarity
2024-06-16 18:18:50 -07:00
tyranron
0868999b5c
Update Debian "bookworm" to 20240612 snapshot in Docker image 2024-06-13 14:07:26 +02:00
Michael Jones
c3d235b6e9
Check the result of malloc in send_message_to_redis () 2024-06-02 16:36:27 -07:00
Michael Jones
0de3bda383
Check the result of malloc in mongo_set_realm_option_one () 2024-06-02 16:35:37 -07:00
Michael Jones
a394fb1cee
Simplify workflow for codeql () 2024-06-02 16:34:29 -07:00
Michael Jones
868f15a672
Move the hiredis_libevent2 code from common to relay ()
The point of this change is to make the build instructions a bit more
straight forward. Since the hiresevent2 source files are only ever used
by the relay target, this scoping makes sense in general.
2024-06-01 18:16:39 -07:00
Michael Jones
d1db5e590d
Include what you use ()
Use the include-what-you-use program to (partially) clean up header
includes, so that only includes which are needed, and no includes that
are not needed (or at least closer to that ideal) are done.

For a c-language project, the build-time improvements from this change
is minimal. This would have a much bigger impact on a C++ project than a
C-project for build times.

So for coturn, this change is mostly intended to just provide
consistency and make it easier to locate weird issues like strange
dependencies, and unnecessary connections between code.
2024-06-01 18:13:08 -07:00
Michael Jones
ebf7587aaf
Remove deprecated macos-11, add macos-13 and macos-14 () 2024-06-01 18:10:55 -07:00
Michael Jones
e45d846331
Check the result of malloc in string_list_add () 2024-05-29 20:49:54 -07:00
Michael Jones
35a3293531
Check the result of realloc and calloc in ch_map_get () 2024-05-29 20:48:46 -07:00
Michael Jones
66a85ef09e
Address clang-tidy warnings in db files ()
The general approach here was:

- Always declare variables as close to where they are defined as
possible.
- Check for pre-conditions of functions before doing work (e.g. ensure
we can connect to the DB before doing a bunch of string formatting)
- Keep the scope of mutexes as reasonably small as practical.
- Use idiomatic C11, such as for-loops over the thing being iterated,
not while() loops over constants, or variables that aren't modified.
- Prefer if(fail){return} function-body after over `if(not fail){
function-body inside if} return;

Clang-tidy returns a clean bill of health, but while going through this
file i noticed a lot of things that raise questions.

Lack of checking column counts. Lack of handling the possibility of
multiple return values. Questionably handling of strings. Complete lack
of checking function inputs for invalid values (e.g. nullptr).

I'm not going to fix those, my organization doesn't USE the DB drivers,
so i have little interest in re-working the logic beyond addressing
clang-tidy warnings for my own sanity, but i did add TODO comments for
someone else to look at in the future.



Additional note: While the changes look very invasive.... they aren't.

I don't think there is a way to get github to ignore whitespace in the
filediff, but if someone were to compare the commit locally, they'll see
that almost all of the changes are just adjusting indentation.
2024-05-29 20:44:23 -07:00
redraincatching
99777bd585
malloc now allocates space for string terminator ()
addresses a code scanner vulnerability

the combination of `strlen` and `malloc` results in space being
allocated for the string, but not the null terminator required to end
the string, so space for an extra character has to be manually specified

#### references
- CERT C Coding Standard: [MEM35-C. Allocate sufficient memory for an
object](https://www.securecoding.cert.org/confluence/display/c/MEM35-C.+Allocate+sufficient+memory+for+an+object).
- Common Weakness Enumeration:
[CWE-131](https://cwe.mitre.org/data/definitions/131.html).
- Common Weakness Enumeration:
[CWE-120](https://cwe.mitre.org/data/definitions/120.html).
- Common Weakness Enumeration:
[CWE-122](https://cwe.mitre.org/data/definitions/122.html).
2024-05-29 20:42:31 -07:00
Michael Jones
ad94684b23
Use bool over int for the turnutils_uclient program ()
Converts all of the variables in the uclient program that should be bool
but weren't.

A few other minor adjustments made at the behest of clang-tidy, but this
change does not address all of clang-tidy's complaints.
2024-05-29 20:39:51 -07:00
Michael Jones
58dc071b46
Fix lint complaint about comment () 2024-05-29 19:07:20 -07:00
Michael Jones
6f82083ea3
Run all of the CI except for Docker builds on any change ()
I'm having trouble testing changes in my own fork because many of the CI
workflows are only set to build on a pull request.

Better to just build on any commit.

I've left the docker builds as they are.
2024-05-27 13:50:43 -07:00
Michael Jones
e8fa2f666a
Avoid read-past-end of string in get_bold_admin_title () 2024-05-27 13:47:54 -07:00
Michael Jones
544382f313
Fix mingw and MSVC ci build () 2024-05-27 13:43:40 -07:00
Michael Jones
46caa941d3
Check allocation results in add_static_user_account () 2024-05-27 12:05:21 -07:00
Pavel Punsky
47fcc99853
Address some build issues introduced by api changes ()
 made APIs consistent with using bool as a return value where true
is success and false is failure
In a few places the change broke code

This PR fixes the breakage
2024-05-27 12:00:23 -07:00
Michael Jones
846f717059
Check the result of calloc in handle_logon_request () 2024-05-27 11:30:49 -07:00
Michael Jones
a32d1a2704
Avoid writing potentially uninitialized data to aes_128 key file () 2024-05-27 10:56:12 -07:00
Pavel Punsky
17926fe70b
Use active CPU number instead of total number ()
The code used `get_system_number_of_cpus()` instead of
`get_system_active_number_of_cpus()` to configure number of relay
servers.
That caused incorrect number to be used on virtualized systems. See
2024-05-26 18:35:15 -07:00
redraincatching
90799f5c60
defined a magic number for stun fingerprinting ()
The value `0x5354554e`, used twice in the `ns_turn_msg.c`, was unclear,
and was changed to a macro that better explained its usage, as defined
in [RFC
5389](https://datatracker.ietf.org/doc/html/rfc5389#section-15.5)
2024-05-26 18:34:10 -07:00
Michael Jones
525550ab86
Always run lint, regardless of branch ()
Someone working on a branch in their own fork won't see the lint running
on their github-actions CI until they open a pull request.

It'd be much easier to ensure changes being worked on are going to pass
the linter if the linter runs before the last step of opening the PR.
2024-05-26 18:27:39 -07:00
Michael Jones
4e8524d9d7
avoid potential nullptr derefernence in udp_create_server_socket () 2024-05-26 18:22:31 -07:00
Michael Jones
f3b73f60d0
Change the various map functions to return bool instead of inconsistantly return 0, 1, or -1 () 2024-05-26 17:45:18 -07:00
Michael Jones
6fc5cf31e9
Check the result of malloc in del_alt_server () 2024-05-26 17:34:15 -07:00
Michael Jones
2c45aa731c
Avoid nullptr dereference of server variable in various functions () 2024-05-26 17:32:02 -07:00
tyranron
74f279d695
Upgrade Alpine to 3.20 version in Docker image docker/4.6.2-r9 2024-05-24 16:56:31 +02:00
tyranron
d72919e4e1
Update Debian "bookworm" to 20240513 snapshot in Docker image 2024-05-14 15:01:30 +02:00
Gustavo Garcia
14e6d16d14
Fix msvc analyzer error on goto label on rfc5769check ()
rfc5769check.c file is using ERROR as a label for gotos but apparently
that name is already used for a constant and msvc analyzer detects it as
an error.

Rename it to "err" that is already used in other parts of the codebase
and also more consistent in terms of casing.

Co-authored-by: Gustavo Garcia <gustavogb@mail.com>
2024-05-05 12:19:10 +02:00
Stefan Junker
158fe9b698
Fix buffer overflow in generate_enc_password with increase rsalt by 2 ()
before this change i see a bufferflow during `readable_string`.
2024-05-04 18:26:35 +02:00
tyranron
e1d8661b40
Update Debian "bookworm" to 20240423 snapshot in Docker image 2024-04-24 12:19:08 +03:00
Gustavo Garcia
386371c174
Fix lint errors 2024-04-21 23:05:29 +02:00
Nikolayshcx
eb3af26867
Add support for raw public keys (Rfc 7250) ()
Resolving 

---------

Co-authored-by: nmegdanov <nikolay.megdanov@softavail.com>
2024-04-19 17:12:48 +02:00
Gustavo Garcia
c2d13700ac Fix clang-format lint warnings 2024-04-19 17:08:49 +02:00
Gustavo Garcia
28294cf053 Fix const during free warning in rfc5769check app 2024-04-19 16:23:30 +02:00
Kang Lin
5b68014699
Refactor: peer_input_handle () 2024-04-19 12:09:43 +02:00
tyranron
bc54a4d940
Update Debian "bookworm" to 20240408 snapshot in Docker image 2024-04-10 14:30:37 +03:00
redraincatching
e96f22ab71
workflow tidying ()
Normalisation of some of the workflow files
2024-04-09 23:18:03 +02:00