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

2253 Commits

Author SHA1 Message Date
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 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 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 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 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 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 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 a0a95f6cee Get rid of unnecessary check_init() stuff (and the hook) 2021-08-13 13:06:35 +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 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 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 445b47391f Do an #undef on LOG_DEBUG, LOG_INFO, etc.. so they cannot be confused
anymore with the ULOG_DEBUG, ULOG_INFO, etc levels.
2021-08-12 15:27:27 +02:00
Bram Matthys a94017c731 Remove sendto_ops_and_log(), use unreal_log() instead! 2021-08-11 19:10:30 +02:00
Bram Matthys 609a6600aa Remove ircd_log(), use unreal_log() instead! 2021-08-11 18:01:00 +02:00
Bram Matthys 4968bf84fe Newlog: convert those in include/*.h too 2021-08-11 17:59:40 +02:00
Bram Matthys fe21fd6024 Remove sendto_realops_and_log() and map some remaining temporary
to sendto_ops_and_log() which will soon disappear too.
2021-08-11 15:47:00 +02:00
Bram Matthys 9308e5b8a0 Change maximum chanmode +l value to 1 million and "coincidentally" also
change the IsInvalidChannelTS() macro to check for this value or lower.
2021-08-11 15:39:15 +02:00
Bram Matthys 9efe590a8e Newlog and fishy timestamp handling:
* New macro IsInvalidChannelTS() which evaluates to ts < 750000
* Check for faulty creation time ("fishy timestamp") at ALL places
  where channel->creationtime is set.
* Also, important, changed behavior:
  if !IsInvalidChannelTS then:
  1) We print our warning
  2) We pretend ts is our channel creationtime (which may be
     TStime() if the channel did not previously exist)
  3) We allow the command through and allow it to merge (in case of SJOIN)

This makes it so we still log the error (noisy) but on the other hand
we won't get "infected" by fishy timestamps since we will never set
them, no matter what happens.
2021-08-11 15:29:45 +02:00
Bram Matthys 3f5fd3d5b8 Newlog: add log_data_channel(). TODO: expand a lot more. 2021-08-11 09:12:57 +02:00
Bram Matthys 8cd3647ae0 Rename mtag.can_send() to mtag.should_send_to_client().
This because "can send" is ambigious and could be interpreted to
mean that the client may send this mtag to us, while in fact this
function decided whether to send TO the client.
2021-08-10 18:57:47 +02:00
Bram Matthys 798106c805 Avoid logging LINK_DISCONNECTED message twice, and also fix the
IP address in the message. We now use ip:port from the link block
if we failed to connect, and otherwise we use the ip from the
connection if the connection is established (also because it
can be a remote connection, not linked directly to us)
2021-08-10 15:08:07 +02:00
Bram Matthys c5347a554d Remove some old LOG_* loglevels, now that these are using newlog.
Also move SQUIT message to newlog, although this may cause
duplicates, so need to (re-)check later.
2021-08-10 14:54:22 +02:00
Bram Matthys 6e3de0c297 Some reindenting/whitespace in struct.h 2021-08-10 14:48:49 +02:00
Bram Matthys 6e996d7ffb Remove unused structs: ConfigItem_log, ConfigItem_unknown, ConfigItem_unknown_ex 2021-08-10 14:45:20 +02:00
Bram Matthys 7063cd0c86 Module coders: add UNREAL_VERSION so you can more easily check UnrealIRCd
versions in #ifdef's. Eg: #if UNREAL_VERSION > 0x05020100 to check if >5.2.1
2021-08-10 14:33:10 +02:00
Bram Matthys f742d08643 Remove some whitespace 2021-08-10 14:25:34 +02:00
Bram Matthys 2c011202a4 Integrate iConf.network in iConf itself as the distinction between
these "network settings" and other settings has been lost in time.

Rename some of these variables and macro's.
ircnetwork -> NETWORK_NAME
ircnet005 -> NETWORK_NAME_005
defserv ->? DEFAULT_SERVER
hidden_host -> CLOAK_PREFIX
helpchan -> HELP_CHANNEL

Also one config change (visible to admins):
set::hiddenhost-prefix is now set::cloak-prefix
We still accept the old name, though.
The example conf has been updated as well, but not the wiki yet.
2021-08-10 14:22:42 +02:00
Bram Matthys a4d9ef3947 Get rid of some shorts. Sorry... i hate these :D.
Also get rid of some unused stats struct members.
2021-08-10 14:07:54 +02:00
Bram Matthys cc8b047819 Remove old client->user->flood stuff as it was moved to client->local->flood
a few versions before and is now unused.
2021-08-10 14:00:47 +02:00
Bram Matthys dca7142152 Rename client->user->lastaway to client->user->away_since 2021-08-10 13:57:44 +02:00
Bram Matthys c55e65b47b Remove client->server->timestamp (completely unused) 2021-08-10 13:55:57 +02:00
Bram Matthys 8b19168f1b Get rid of client->server->up, since client->uplink->name provides the
same information.
2021-08-10 13:52:10 +02:00
Bram Matthys 641d514853 Move traffic stats from client->local->sendM/sendK/receiveM/receiveK/sendB/receiveB
into a client->local->traffic struct.
2021-08-10 13:22:59 +02:00
Bram Matthys 420eb2ffb6 Rename client->serv to client->server: this is set if the client is a server,
just like client->user is set if the client is a user.

Rename client->srvptr to client->uplink: this is the uplink that the client
is connected to. If the client is a user then it is set to the server that
the client is connected to, if the client is a server then it is set to the
server that the server is connected to (the.. tadah.. uplink).
For local clients it is always set to &me.
2021-08-10 12:52:46 +02:00
Bram Matthys 0f71381589 typedef aWhowas -> WhoWas 2021-08-10 12:44:54 +02:00
Bram Matthys 90a01ed7f9 Rename client->local->lasttime to client->local->last_msg_received
(Last time any message was received, i.e. the socket was read)
2021-08-10 12:40:07 +02:00
Bram Matthys 73f8976a3a Rename client->local->firsttime to client->local->creationtime
(Time user was created (connected on IRC))
2021-08-10 12:38:07 +02:00
Bram Matthys 43f42edfb7 Rename client->local->nextnick to client->local->next_nick_allowed 2021-08-10 12:36:48 +02:00
Bram Matthys a076e7a93a Remove client->local->lastsq since it is unused (only written, never read) 2021-08-10 12:36:06 +02:00
Bram Matthys 6b36399533 Rename client->local->last to client->local->idle_since
(Last time a RESETIDLE message was received (PRIVMSG))
2021-08-10 12:34:13 +02:00
Bram Matthys 4dbc2ac860 Rename client->local->since to client->local->fake_lag, since it is used
for fake lag calculations only (well, except for 1 corner case).

As said, modules should use the new function:
void add_fake_lag(Client *client, long msec)
2021-08-10 12:26:19 +02:00
Bram Matthys 4d947c3e51 Convert fake lag changes to use void add_fake_lag(Client *client, long msec) 2021-08-10 12:24:16 +02:00
Bram Matthys d59cfa092a Add terminal_supports_color(), used by logging to terminal code.
We now also correctly disable color support if someone is on
a color-capable terminal but redirects the output of the boot
to a file, eg: bin/unrealircd >boot.log 2>&1
2021-08-10 09:24:08 +02:00