1
0
mirror of https://github.com/unrealircd/unrealircd.git synced 2026-06-12 15:34:47 +02:00
Commit Graph

10696 Commits

Author SHA1 Message Date
Bram Matthys d668c4b78b Hardening: add -fstrict-flex-arrays=3
This should help gcc/clang with finding more OOB write bugs.

It does mean that 3rd party modules can no longer use the something like:
struct { char name[1]; }
and then alloc(sizeof(struct) + length of name)

instead the struct element needs to be name[];
...and they would need to alloc(sizeof(struct) + length of name + 1)

No 3rd party modules in unrealircd-contrib use this so.. hopefully fine.
2026-02-22 16:26:57 +01:00
Bram Matthys 014925496b Forgot a few more of those [1] that need to be []
(see previous commit)
2026-02-22 16:24:55 +01:00
Bram Matthys 7d45e69fd2 Use C99 flexible array members, like name[], instead of name[1]
in NameList, Tag, Watch and HistoryLogLine.
This does mean the allocation routines need a +1 everywhere, but
I think I got all of them. I also don't see them being used directly
in such a way in 3rd party modules (which is logical, as they
should use the API and not allocate such structs directly).

Also, SpamExcept has been removed as it was not used anywhere.
2026-02-22 16:11:41 +01:00
Bram Matthys fb0649f14a Use full RELRO for modules (use HARDEN_LDFLAGS in MODULEFLAGS)
Previously, due to HARDEN_LDFLAGS missing in MODULEFLAGS we were
only partial RELRO instead of full RELRO. This is a defense-in-
depth measure but is good to have and the ommission was unintended.
2026-02-22 15:37:45 +01:00
Bram Matthys 8be6337e71 Update release notes
[skip ci]
2026-02-22 13:28:56 +01:00
Bram Matthys 19d17832fe Remove set::restrict-extendedbans as it didn't work. Simply don't load
the particular extended ban module if you don't want it.

For example, if you include the default modules.default.conf and, say,
you don't want ~quiet extbans then you add this in your unrealircd.conf:

blacklist-module "extbans/quiet";
2026-02-22 13:07:57 +01:00
Bram Matthys 6933e1839b Update extban_conv_param_nuh_or_extban() to use MAXBANLEN
instead of arbitrary 256 and such. Also makes it so other people
reading this code will understand better that MAXBANLEN is the
real limit here and not 256 (which is never reached because
the cut off already happens at 200).
2026-02-22 12:42:44 +01:00
Bram Matthys d38a106879 Enforce MAXBANLEN (which is MODEBUFLEN) at some more places.
This shouldn't be needed except for some corner cases, like if some
third party module does not limit their stuff properly, in S2S
or if channeldb contains some weird long entry or something.
2026-02-22 12:38:01 +01:00
Bram Matthys ac86029a61 Make convert_regular_ban() and extban_conv_param_nuh() consistently
allow bans of NICKLEN+USERLEN+HOSTLEN+3. Previously NICKLEN was
ommitted for some reason, which also explains why this ban-
simplification-routine exists in the first place. I think we can
make it use this full n!u@h space. Especially since we already allow
this for bans like ~quiet (the full n!u@h) and other extbans can be
quite long as well, it no longer makes sense to limit it here.

Small detail: in extban_conv_param_nuh() we used +32 which i think
is from the times when we had to deal with prefixes like ~quiet,
which is no longer the case, this routine is only about the final
suffix after the last : in a ban.
2026-02-22 11:58:15 +01:00
Bram Matthys 979f44bde4 Linking: upon duplicate server we could SQUIT the wrong one.
This would cause a bit of a mess, that usually would be resolved a few
seconds later, but still a mess. I had this on irc*.unrealircd.org
myself when rerouting a server from a backup-hub to primary-hub
a few months ago.
2026-02-22 11:37:09 +01:00
Bram Matthys d79161019a Clear client->local->proto for users.
This is not an issue now in all code paths, but if someone accidentally uses
SupportXYZ() without checking IsServer() then it would be an issue.

In the past we used client->local->proto for client flags as well, but this
has been split off to client->local->caps a while ago.

I guess we should rename client->local->proto to something more server-ish
in a later major release to indicate this as well.
2026-02-22 10:37:01 +01:00
Bram Matthys 371cb487b9 Fix missing "return;" in "Bad ulines" rejection of a server. 2026-02-22 10:00:32 +01:00
Bram Matthys 43da14f7c6 Get rid of old confusing comment in src/parse.c regarding commands with 0 flags
if (cmptr->flags != 0) { /* temporary until all commands are updated */

But that is impossible, as CommandAdd()->CommandAddInternal() already has:

if (!flags)
{
        config_error("CommandAdd(): Could not add command '%s': flags are 0", cmd);

And this is the case since commit ceb04cc3eb
from July 15, 2015.
2026-02-22 08:05:18 +01:00
Bram Matthys 059abc4b56 "STATS fdtable" is mostly for debugging. Simplify read/write handler display
and callback data in non-DEBUGMODE. Also because exposing pointers like
this can defeat ASLR. These STATS are oper-only though, but hey, defense in
depth... and the pointer values don't make sense to non-devs anyway,
so why show them in the first place.
2026-02-21 19:41:56 +01:00
Bram Matthys b467e4e147 JSON-RPC: Fix missing mtag issued by in user.part
We use mtag_add_issued_by() to prepare it but then pass NULL
in do_cmd() so it was basically useless.

Also compile fix for previous (forgot to git ammend)
2026-02-21 16:22:36 +01:00
Bram Matthys ec4ccbde82 Fix memory leak on JSON-RPC log.send and fix a small auth url parse thing.
Actually that auth url method is not documented, we should probably remove it.
2026-02-21 16:18:34 +01:00
Bram Matthys b93cb14623 Fix crash due to fix from a few hours ago (5580b294f4) 2026-02-21 16:04:50 +01:00
Bram Matthys d22f65364c Make duplicate deny link::rule items an error.
(as otherwise using duplicated generates only a warning and could memleak)
2026-02-21 14:57:41 +01:00
Bram Matthys f81fd965ea Mask item or security-group: add check for duplicate rule / exclude-rule 2026-02-21 14:55:13 +01:00
Bram Matthys b55a4b84e0 Blacklist hit with a soft ban action: fix memory leak if multiple hits occur.
So, if the IP was on multiple blacklists.
2026-02-21 14:43:41 +01:00
Bram Matthys 8740774d25 Not important but.. this did not free element 255. 2026-02-21 14:01:29 +01:00
Bram Matthys f20b62ea3b Fix memory leak on blacklist hit if using soft bans 2026-02-21 13:59:10 +01:00
Bram Matthys fae9dacf5d Fix some small REHASH leaks: tld->channel, link->connect_ip,
allow->server (last one is very rare).
2026-02-21 13:56:30 +01:00
Bram Matthys 28a8bee041 Don't use 'client' in CENTRAL_BLOCKLIST_ERROR, prolly copy-paste error.
Not really important as it is not part of the normal log message (only JSON).
2026-02-21 13:49:26 +01:00
Bram Matthys f59b937f3b Fix leak if central-blocklist returns "error" JSON string (very rare) 2026-02-21 13:45:47 +01:00
Bram Matthys 5580b294f4 Fix memory leak if using spamfilter::except. 2026-02-21 13:20:17 +01:00
Bram Matthys be479aa890 The buffer in spamfilter_build_user_string() was too small causing cut off.
This affects the spamfilter 'u' target. It didn't overflow but was cut off,
potentially causing a NON-MATCH where it could have been a MATCH instead.
2026-02-21 13:18:30 +01:00
Bram Matthys 2ac09de148 Fix central spamfilter with "stop" action, due to using same &var twice. 2026-02-21 13:13:15 +01:00
Bram Matthys 6130c1b5ae Update Windows build because library package with cURL changed
due to switch to 'cmake'. This is for unrealircd-libraries-6.2.3.zip from
https://www.unrealircd.org/docs/Windows_external_libraries_for_UnrealIRCd
2026-01-31 14:35:55 +01:00
Bram Matthys d8e631bacb ** UnrealIRCd 6.2.3-rc1 **
(not 6.2.2-rc1 :D)
[skip ci]
2026-01-31 10:14:21 +01:00
Bram Matthys bb4d1b528f ** UnrealIRCd 6.2.2-rc1 **
(Actually the Windows build is still building :D)
2026-01-31 09:44:57 +01:00
Bram Matthys 287184649c Update doc/unrealircd_wiki.zim to version of 2026-01-31. 2026-01-31 09:43:35 +01:00
Bram Matthys a93ab146b6 Add rpc/message and rpc/security_group modules for Windows build 2026-01-31 07:54:14 +01:00
Bram Matthys 4218010000 Update curl-ca-bundle to latest version (Dec 2 04:12:02 2025 GMT)
[skip ci]
2026-01-30 13:00:33 +01:00
Bram Matthys 6083c039cd Update shipped libs: PCRE2 (10.47), Jansson (2.15.0), Sodium (1.0.21) 2026-01-30 12:58:12 +01:00
Bram Matthys c24424bb50 JSON-RPC: throttle.set did not do anything
Reported by adator in https://bugs.unrealircd.org/view.php?id=6608
2026-01-30 07:39:37 +01:00
Bram Matthys bd1e25d017 Slightly raise default set::handshake-timeout from 30 to 40 seconds. 2026-01-28 09:44:49 +01:00
Bram Matthys 91d5114a1e Whitespace fix
[skip ci]
2026-01-28 09:38:39 +01:00
Bram Matthys ad1b59b4bd Update release notes a bit (what we have so far)
[skip ci]
2026-01-28 09:37:45 +01:00
Bram Matthys 728807d233 Set SSL_OP_NO_RX_CERTIFICATE_COMPRESSION by default.
Every time compression has been used in TLS it has been a source of
trouble. We don't care about such optimizations anyway since connections
are long-lived in IRC. We are not some kind of webserver where every
millisecond counts.
2026-01-27 19:31:25 +01:00
Bram Matthys e083852e86 Create separate resolver channel resolver_channel_https for HTTPS requests.
This one has DNS caching enabled[*], which makes sense for this case.

[*] If using c-ares 1.31.0 or later. That version was released in June 2024.
The shipped-with-UnrealIRCd library version is 1.34.6, so qualifies.
However, if using system c-ares (which is automatically the case, if detected)
then many systems don't have it. The first Linux distro versions that qualify:
* Fedora 40
* Debian 13
* Ubuntu 25.04 (non-LTS) and future Ubuntu 26.04 (LTS)
* Etc...
2026-01-26 09:57:07 +01:00
Bram Matthys a887de92ce Add extra safety in register_user() against shunned users. 2026-01-25 12:56:52 +01:00
Bram Matthys 8467969878 Don't show confusing CENTRAL_BLOCKLIST_TIMEOUT when user is shunned.
Previously it showed this warning and said "Allowing user .. in unchecked"
when the user got shunend by CBL. Usually harmless but.. had a report
where it possibly was not (though that was an older UnrealIRCd version).
In any case, confusing, solved now!
2026-01-25 12:54:30 +01:00
Bram Matthys ef75962a70 We now use a non-zero exitcode if ./unrealircd module install ... fails
Reported by ikci in https://bugs.unrealircd.org/view.php?id=6578
2026-01-23 13:15:17 +01:00
Bram Matthys af0f1fdd6b ModuleManager: check version of local module, don't overwrite if it is newer.
This was a long standing requests by devs.

So if third/something is version 1.2.3 in the repository, and you have
src/modules/third/something.c which is version 1.2.4 then neither
'./unrealircd module upgrade' nor './unrealircd module upgrade third/something'
will overwrite the module. It will stay the local 1.2.4 version.
A new status inst/LOCAL was added "module installed, local version is newer
than available online"

The command './unrealircd install third/something' would still (re)install
the online version, though, i think that makes sense.

When working on this I noticed that './unrealircd module upgrade' previously
always recompiled the module, even if it was not updated. This is no longer so.
2026-01-23 11:56:48 +01:00
Bram Matthys 91930e3631 Bleh, just use "*" in ERR_INVALIDMODEPARAM for the param.
Otherwise you get into trouble if client does things like:
MODE #test +l ::a
MODE #test +l :a b c
And I am too lazy to handle these cases :D
2026-01-23 08:48:34 +01:00
Bram Matthys d413959e57 Chanmode +l: when coming from an IRC client, reject <=0 instead of transforming.
Reject it with an ERR_INVALIDMODEPARAM, just like we do for +k.

I think the higher number transforming is fine, but this <=0 transformation
is odd as it almost never is what the user actually intended.

In S2S traffic we still transform, as rejecting there is more problematic,
(causing a desync) and transforming it there is not a major issue, anyway.

Reported by ProgVal in https://bugs.unrealircd.org/view.php?id=6602
2026-01-23 08:45:34 +01:00
Bram Matthys 2dd23d13b7 Silently drop TAGMSG to users who refuse PRIVMSG/NOTICE also (umode +D, +R),
since the message/notice would not make it through either.
This also means someone can no longer iterate through users to see who
is +D/+R by sending a "silent" TAGMSG. (Silent in the sense that the
end-user usually would not have noticed)

Suggested in https://bugs.unrealircd.org/view.php?id=6579 by zw32h (I think)

This also means HOOKTYPE_CAN_SEND_TO_USER now allows you to NOT to
set errmsg, to silently drop a message. Previously we would crash
deliberately on such a situation to enforce that all modules would
set a proper errmsg.
2026-01-23 08:23:22 +01:00
Bram Matthys 3925cea089 Update release notes a bit
[skip ci]
2026-01-23 08:11:01 +01:00
Bram Matthys c2db2715c0 Fix post-registration SASL not working due to change from a few days ago.
(commit 0cf0c0faa2)

This was caused by register_user() being called twice, while it should
only have been called if !IsUser().

Reported by ProgVal in https://bugs.unrealircd.org/view.php?id=6606
My BuildBot screen was also all red :D.
2026-01-23 07:48:01 +01:00