1
0
mirror of https://github.com/unrealircd/unrealircd.git synced 2026-06-26 17:56:37 +02:00
Commit Graph

5825 Commits

Author SHA1 Message Date
Bram Matthys 03d78bf95d Fix looking up the wrong extban in some cases.
~T => ~text => starts with ~t => ~time... fun.
2021-08-14 17:57:22 +02:00
Bram Matthys 75dbd99614 I think the code already handles all these "can't stack these" cases.
If I'm wrong we have a regression :D
2021-08-14 17:46:44 +02:00
Bram Matthys 0acc9eef49 Add parameter to clean_ban_mask() that will be put in b->conv_options.
Currently only supported option is:
BCTX_CONV_OPTION_WRITE_LETTER_BANS: always write letter bans

This removes the NULL pointer magic that i was not happy about.
2021-08-14 17:36:49 +02:00
Bram Matthys ca4f4c2575 Add PROTOCTL NEXTBANS. This indicates support for named extended bans.
If you don't indicate NEXTBANS support then we will send old fashioned
extended bans to you.
Note that eventually we will likely require named extended bans support,
but that will be UnrealIRCd 7 / 8.... ;)
2021-08-14 17:28:15 +02:00
Bram Matthys 5f31f7a5cc Add unreal_server_compat module which rewrites named extbans in
server to server traffic to be letter extbans.
Yeah this is a tad ugly, but the alternative was worse, see
header of the file for the full story.

Module is loaded by default (obviously).

Still to do: only do this for non-U6 servers (add some PROTOCTL)

And probably alter clean_ban_mask because I don't like the
magic on NULL client at the moment.
2021-08-14 16:45:18 +02:00
Bram Matthys f6704cfd1c Add empty_mode(modebuf) to check for "", "+" or "-" modes, that is:
modes that are empty/useless. Previously this check was done at
several places in their own way. Ugly and duplicate code.
2021-08-14 15:18:34 +02:00
Bram Matthys c0d31130f8 channel->creationtime is always set, so assume this is always set.
In U5 channel->creationtime could be 0 momentarily, eg for a new
channel, but nowadays we set channel->creationtime to TStime()
if the channel gets created in make_channel() [*]
[*] which was previously called get_channel() by the way

Also update some comments in mode.c to make things more clear.
2021-08-14 15:10:32 +02:00
Bram Matthys 9e0357ad71 Get rid of all the bounce stuff in MODE.
The only stuff we still have is if a bounce servermode is detected
(incoming) then we just ignore it.

All this bounce stuff wasn't used much, and didn't even work
(was always sending empty bounce string). It was only complicating
the code everywhere with stupid stuff like:
*x++ = bounce ? '+' : '-';
what = MODE_DEL;
2021-08-14 14:56:53 +02:00
Bram Matthys ec6062bc53 Slightly change the log message for the other case which previous
caused a bounce, or was supposed to (never really worked either).
We now ignore the mode (which was de-facto what we did anyway)
and also log it in that way.
2021-08-14 14:41:39 +02:00
Bram Matthys a5b86fcc11 Don't try to fix op-desyncs anymore. The bounce code didn't work anyway
(but the -oh did work)
2021-08-14 14:29:32 +02:00
Bram Matthys c7345f41b6 Fix hardcoded ~f: and ~m: to also deal with named bans.
(Actually only made it worse by more hardcoding for now...)
2021-08-14 10:35:15 +02:00
Bram Matthys b80a9adef9 Set extended ban names instead of using module name placeholders. 2021-08-14 10:28:26 +02:00
Bram Matthys a70580cc86 Enable sending of named extended bans. This can be changed via the
configuration file via set::named-extended-bans <yes|no>; and now
defaults to yes.
Still to do:
* explicitly set names instead of using stupid module names
* update test suite to check for these new names (other git tree)
* backwards compatible sending to U5 and lower using ugly shit
2021-08-14 10:12:43 +02:00
Bram Matthys 34bf0d7ec6 Grin... 2021-08-14 09:50:58 +02:00
Bram Matthys a6b5587666 Use prefix_with_extban() at the 3 places, needed for next... 2021-08-14 09:49:22 +02:00
Bram Matthys 34b034ab36 Add named extban support. This only deals with the incoming parsing,
it is not visible outgoing yet. So: ~account:name becomes ~a:name.
2021-08-14 09:27:39 +02:00
Bram Matthys d41e3e0f6e src/modules/extbans/*.c: memset(&req, 0, sizeof(req)); before ExtbanAdd() 2021-08-14 09:27:01 +02:00
Bram Matthys 5a387f9c0b Rename extban.flag to extban.letter.
TODO: Should probably do this for umode/cmode as well ;)
2021-08-14 09:07:22 +02:00
Bram Matthys f23546b27c More conv_param() changes, the +3 rule changed, and matches the rest.
The .conv_param() now receives the ban minus the ~own-extban.
And it should also return the part minus the ~own-extban.

Changes to findmod_by_bantype():
1) Takes a string now, rather than a single char value,
   so it is ready for named extbans.
2) Second parameter added so you can easily jump to the remainder.
   Eg:
   extban = findmod_by_bantype(b->banstr, &nextbanstr);
   [..check if extban is non-NULL and then..]
   b->banstr = nextbanstr;
2021-08-14 08:57:33 +02:00
Bram Matthys 5269b647d5 Round three of extban API overhaul, this changes extban->conv_param().
More changes will follow related to that...
2021-08-13 17:59:45 +02:00
Bram Matthys 163eaa432c ExtBans API: Now we can get rid of the +3 everywhere in is_ok().
When extban->is_ok() is called the banstr now no longer points
to "~x:something" but to "something".
Just like we did for extban->is_banned().
Again, need this for later too...
2021-08-13 16:39:03 +02:00
Bram Matthys b5d948c09c Round two of extban API overhaul, this changes extban->is_ok()
Also cleanup big blob op duplicate code in +beI handling in MODE.
2021-08-13 16:03:15 +02:00
Bram Matthys 98291c9f69 ExtBans API: Now we can get rid of the +3 everywhere in is_banned().
When extban->is_banned() is called the banstr now no longer points
to "~x:something" but to "something". This will be more useful later...
2021-08-13 14:39:34 +02:00
Bram Matthys bff6fdde6f Start of extban API recode. I created the current API in 2003 and..
well.. let's hope I have gained some good insights since then.. :D
2021-08-13 14:17:07 +02:00
Bram Matthys bdef6a2af2 Move stuff from AllowClient() to register_user(), since it deals with
setting hostname and such, which does not belong there (well, mostly)
2021-08-13 13:10:23 +02:00
Bram Matthys a0a95f6cee Get rid of unnecessary check_init() stuff (and the hook) 2021-08-13 13:06:35 +02:00
Bram Matthys da3bdc0437 AllowClient() doesn't need nor use the 2nd argument. 2021-08-13 12:27:23 +02:00
Bram Matthys 68b6f62d88 Convert DNS names to lowercase 2021-08-13 12:23:44 +02:00
Bram Matthys eb171c8e22 Add strtolower(). Note: we already hade strtolower_safe(). 2021-08-13 12:22:49 +02:00
Bram Matthys 9310fd3b4b Move check for valid hostname out of register_user(), we already
have that in dns.c. Also remove verify_hostname() from dns.c and
integrate it in valid_host() which now takes a second argument
named 'strict'. Call valid_host() with strict set to 1 if the
hostname should be checked to be a valid DNS hostname, eg the
host may not contain stuff like ':' or '/'. Use 0 otherwise
for the loose check, eg if you are not sure if the passed host
is an IP address or a host, or if it is for a vhost.
2021-08-13 12:17:24 +02:00
Bram Matthys 7c250188a5 Some moving around 2021-08-13 12:05:37 +02:00
Bram Matthys 72d4973840 Cleanup code that sets client->user->username based on ident config and result 2021-08-13 11:59:54 +02:00
Bram Matthys 1b3376d091 More cleanups in register_user(): Move the username checks to valid_username() 2021-08-13 11:54:43 +02:00
Bram Matthys 3a9976ef53 Get rid of ERR_HOSTILENAME which clutters the code too much
and no other IRCd seems to be using it.
2021-08-13 11:33:34 +02:00
Bram Matthys 3f8538f767 Split off part of register_user() to new function welcome_user() 2021-08-13 11:30:53 +02:00
Bram Matthys 199d7d8e65 cmd_uid: fix setting IP on the wrong client (server instead of user, oops...) 2021-08-13 11:11:05 +02:00
Bram Matthys fa875d6fd4 Cleanup: register_user() now takes only 1 argument (client) instead of 5 arguments.
The last 3 were always NULL after the remote/local split from a few commits ago.
And nick and username were useless as well as client->name and
client->user->username were always already set.
2021-08-13 11:06:30 +02:00
Bram Matthys 77a7b3aca2 More cleanups in nick.c: integrate register_user_remote() in cmd_uid() 2021-08-13 10:57:54 +02:00
Bram Matthys 33db820355 More nick.c (register user) cleanups.. 2021-08-13 10:49:45 +02:00
Bram Matthys 75a7d171b9 Test buildbot 2021-08-13 10:40:53 +02:00
Bram Matthys 8ca735a217 Split remote register_user() off into register_user_remote(),
which may or may not disappear in a future cleanup.
2021-08-13 10:23:50 +02:00
Bram Matthys f90c7a7991 Move IP validation from register_user() to cmd_uid().
This also makes it so the decoded IP is passed to register_user(),
eg "1.2.3.4" instead of binary base64'd stuff.
2021-08-12 20:09:24 +02:00
Bram Matthys 5eb2ac7624 Fix OperOverride message 2021-08-12 17:56:23 +02:00
Bram Matthys 9a2e8613ae For remotely received log messages (via SLOG) show the original server name
as sender in the NOTICE, just like we used to do in the past.
2021-08-12 17:07:12 +02:00
Bram Matthys 9f54c9b0d3 Don't send SAPART in SAJOIN (:D) 2021-08-12 16:51:18 +02:00
Bram Matthys 152d24bd73 Don't check for "chathistory" capability yet (only "draft/chathistory")
as this casuses BUG_CLIENTCAPABILITYBIT_UNKNOWN_TOKEN to be triggered.
2021-08-12 16:33:31 +02:00
Bram Matthys 60d970d9af And another fix for previous case. 2021-08-12 16:16:09 +02:00
Bram Matthys 5cc2ef7fba Newlog: free arguments, even if unreal_log_recursion_trap is hit
This was triggered for example when sending logs to remote servers.
2021-08-12 16:11:02 +02:00
Bram Matthys 16527eb6a4 Back out previous change, bad idea :D 2021-08-12 16:03:20 +02:00
Bram Matthys 507f43fc74 Set me.uplink to &me. Not entirely sure if this is what we want.
Without this, I think otherwise we need too many checks everywhere
for the IsMe() case. And this behavior matches me.direction which
also points to &me.
Then again, will doing it this way cause issues? We will see...
2021-08-12 15:57:58 +02:00