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

2233 Commits

Author SHA1 Message Date
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
Bram Matthys 7ad7b36312 Remove useless ifdef, this was never reached. 2021-08-10 09:09:21 +02:00
Bram Matthys 532a9becda Massive renames of SSL/TLS and SSL to TLS. People should know the term by now :D 2021-08-10 09:07:32 +02:00
Bram Matthys 3832081eed Rename client->user->svid to client->user->account.
Just as a reminder: don't blindly assume that if anything is set here
that the user is logged in, there is IsLoggedIn(client) for that.
Reason: if the account name starts with a digit or is "*" then the
user isn't actually logged in ;)
2021-08-10 08:14:35 +02:00
Bram Matthys b055b862e4 New: NameValue struct and functions nv_find_by_name() / nv_find_by_value().
These were previously used by the config system as config_binary_flags_search()
but can be useful in other areas as well.
2021-08-09 17:43:15 +02:00
Bram Matthys 61ccd94466 Newlog: convert tls.c to use new log system 2021-08-09 14:41:35 +02:00
Bram Matthys 689c528864 Newlog: add log_data_tls_error() 2021-08-09 14:15:06 +02:00
Bram Matthys bc9525528c Get rid of report_error() and report_baderror() now that the last
function call has been replaced with unreal_log().
2021-08-09 12:20:13 +02:00
Bram Matthys 3a9975713a Move connect_server() from src/socket.c to src/modules/server.c (efunc) 2021-08-09 12:10:24 +02:00
Bram Matthys 8187c4049f Renumber PROTO_'s 2021-08-09 09:36:15 +02:00
Bram Matthys 4ad7d02ffa Changes to unrl_utf8_make_valid():
1) No longer impose a static maximum length
2) Caller must provide a work buffer and maximum length
3) Add a strict length check option
2021-08-09 08:49:01 +02:00
Bram Matthys 53e283082f For IRCOps with unrealircd.org/json-log: in case of a multi-line message
we will now only send the JSON in the first message.

Also fix log file timestamp missing with multiline.

And rename do_unreal_log_ircops() to do_unreal_log_opers()

Add safe_free_message_tags()
2021-08-08 15:10:04 +02:00
Bram Matthys bc9e17aeb0 Add multiline support to unreal_log()
Any \n's will be expanded to multiple lines.
* For JSON disk logging there is no change.
* For text disk logging it will show as:
  [time] facility subsys.CODE+
  [time] facility subsys.CODE+
  [time] facility subsys.CODE
  So a plus sign is added if another message is to follow.
* For notices to opers/snomasks exactly the same (plus sign if needed).

Untested. More changes to follow eg to notice dropping the json
in the followup msgs.

This also changes the logging format for text disk to match
the output on server notices, we no longer log as:
[TS] facility subsystem event_code: msg....
But as:
[TS] facility subsystem.event_code: msg....
2021-08-08 12:04:41 +02:00
Bram Matthys 01542cdf77 Add line2multiline() which takes a string with \n's and returns a MultiLine
linked list.
2021-08-08 11:28:54 +02:00
Bram Matthys 12adca5817 Set client->name early to provided servername and drop the servername
argument from verify_link() since now you can just use client->name.

Also more newlog for server.c (more to follow)
2021-08-08 10:15:59 +02:00
Bram Matthys a339efad2a Add exit_client_fmt() which accepts formatting characters. 2021-08-08 10:14:48 +02:00
Bram Matthys b75f6b4086 Newlog: add "log_source" 2021-08-07 15:49:12 +02:00
Bram Matthys 64180d8a2c Send and receive json as well in SLOG server to server message.
TODO: validate JSON
2021-08-07 15:22:06 +02:00
Bram Matthys 0739af0812 Add initial remote logging support via SLOG (S2S cmd).
Also call the log::destination "remote" instead of "global".
2021-08-07 14:38:06 +02:00
Bram Matthys f4af4acb16 Newlog: fix rehash and memory leak 2021-08-07 14:01:44 +02:00
Bram Matthys e59cd278cd log { } now uses the new log system and is used for logging to disk,
snomasks, opers, global (remote), ..

For disk logs we currently ignore the sources and log everything.

NOTE: REHASH is untested and will memory leak for sure.
2021-08-07 13:04:07 +02:00