Bram Matthys
f3ec97ee23
floodprot (+f): fix issue where 't' was kicking innocent users due to
...
flooding. The 't' action was activated in if no 'r' type was present
because the counter was not reset.
https://bugs.unrealircd.org/view.php?id=5401
2019-09-15 15:33:30 +02:00
Bram Matthys
c7c3fbdfa8
struct stats *ircstp; -> IRCStatistics ircstats; (for statistics, /STATS)
2019-09-15 14:48:45 +02:00
Bram Matthys
bea2564e5d
IRCStatistics ircstats; -> IRCCounts irccounts; (this is used for LUSERS)
2019-09-15 14:39:51 +02:00
Bram Matthys
677afe9ca4
Don't use memory pools when using ASan, since it would miss things.
...
-> See my comment in src/mempool.c
2019-09-15 14:37:59 +02:00
Bram Matthys
f81f221b13
Use memory pool for Client and LocalClient. Also reorder struct a bit.
2019-09-15 12:28:50 +02:00
Bram Matthys
1a24a634e5
Make Link functions (make_link, free_link) use memory pool code.
...
Also clean up a bit.
2019-09-15 11:33:17 +02:00
Bram Matthys
edb199841a
Move all the (remaining) LIST stuff to modules/list and use ModData.
2019-09-15 11:07:15 +02:00
Bram Matthys
085c0f0c4e
Move jointhrottle data from moddata_client to moddata_local_client
...
since we only count for local users.
2019-09-15 09:50:27 +02:00
Bram Matthys
ffe5abe30b
ModData: moddata_localvar -> moddata_local_variable,
...
moddata_globalvar -> moddata_global_variable,
and the just-added moddata_localclient -> moddata_local_client
..all this so it's more consistent
2019-09-15 09:47:54 +02:00
Bram Matthys
b2f32c1746
Add moddata_localclient(), which is for locally connected clients only.
...
Make the silence module use this.
2019-09-15 09:26:54 +02:00
Bram Matthys
654919f2c4
Make modules/silence use ModData and remove more out of the core.
...
It uses a Silence struct now, rather than Link.
Also, SILENCE is handled only for local clients now (different
cost/benefit tradeoff nowadays).
2019-09-15 09:03:30 +02:00
Bram Matthys
6cc94b4b11
Move add_silence and del_silence out of the core to modules/silence
2019-09-15 07:52:04 +02:00
Bram Matthys
2b2fb8906e
Zero memory in make_link() - needed since memory changes of today.
2019-09-14 21:03:12 +02:00
Bram Matthys
f2e3712d62
Remove various if's and such that are now unneeded
...
This is part 5 of the memory function / caller changes.
2019-09-14 17:23:07 +02:00
Bram Matthys
a75d10d3e4
Some remaining malloc() calls -> safe_alloc()
...
Unimportant, but this way 100% of those is done.
This is step 4 of X of the memory function / caller changes.
2019-09-14 17:15:15 +02:00
Bram Matthys
950fc5001e
Update memory allocation calls, step 3 of X
...
This changes free() calls to safe_free().
This mass change could be automated and unaudited, fortunately.
2019-09-14 17:12:37 +02:00
Bram Matthys
9fc1e758ab
Mass change of dst = strdup(str) to safe_strdup(dst,str) but with a manual
...
audit since 'dst' must now be initialized memory.
There's still a raw_strdup() if you insist.
This is step 2 of X of memory allocation changes
2019-09-14 16:58:01 +02:00
Bram Matthys
de87b439b7
Update memory allocation routines. Step 1 of X.
2019-09-14 16:52:53 +02:00
Bram Matthys
7c6358024c
Add 'natural order' string comparison to core: strnatcmp and strnatcasecmp
...
extern int strnatcmp(char const *a, char const *b);
extern int strnatcasecmp(char const *a, char const *b);
This will be handy for version comparisons. For example they will
return -1 (=lower) for things like ("1.4.9", "1.4.10"), unlike strcmp.
Also, some loosely related spelling fixes elsewhere.
2019-09-14 08:12:47 +02:00
Bram Matthys
f1f0acdd25
ident_lookup: reject spaces and control characters early.
...
...even though in m_nick there is code so it never gets into
sptr->user->username.
2019-09-13 19:37:28 +02:00
Bram Matthys
9b14970c2a
Move ident lookups to module 'ident_lookup' and rewrite the code
...
to be a bit less ugly. The module is loaded by default so you can
still use set::options::identd-check like before, even though I
hate ident... it's old shit... still, other's seem to like it.
More changes will follow later. There is still some ident stuff
in the core at the moment and the module is currently PERM, which
largely (but not entirely) defeats the purpose of being a module.
That will be fixed at a later time as well.
2019-09-13 19:21:29 +02:00
Bram Matthys
3592d8db3a
Update name in first few lines of .c files.
...
Eg: src/modules/m_away.c is src/modules/away.c nowadays.
2019-09-13 15:46:20 +02:00
Bram Matthys
baf02e8980
Rename all m_* functions to cmd_* functions.
2019-09-13 15:45:19 +02:00
Bram Matthys
bb1bb35f50
MOD_LOAD(xyz) is now just MOD_LOAD(), same for MOD_TEST, MOD_INIT,
...
MOD_UNLOAD. And MOD_HEADER(xyz) is now MOD_HEADER even without ()
since this isn't a function, really.
To make things understandable I added the following to the
developer section of the release notes:
* The module header is now as follows:
ModuleHeader MOD_HEADER
= {
"nameofmodule",
"5.0",
"Some description",
"Name of Author",
"unrealircd-5",
};
There's a new author field, the version must start with a digit,
and also the name of the module must match the loadmodule name.
So for example third/funmod must also be named third/funmod.
* The MOD_TEST, MOD_INIT, MOD_LOAD and MOD_UNLOAD functions no longer
take a name argument. So: MOD_INIT(mymod) is now MOD_INIT()
2019-09-13 15:27:40 +02:00
Bram Matthys
9114c0ed85
The name of the module must now match the relative path, e.g.
...
the chanmodes/delayjoin module must be named chanmodes/delayjoin
in the module header.
This because currently we have two module names for each module,
one is the name from the MOD_HEADER and the other is the
relative path, such as used by loadmodule and is_module_loaded().
This commit also (not entirely, but practically) breaks loading
of modules outside the regular modules path. I don't think that's
a problem, although it could use a bit more documentation.
2019-09-13 15:09:07 +02:00
Bram Matthys
b40981f0ab
Prevent a dlopen() if module is already loaded (instead of ~50 lines
...
further down). This is in case you have two loadmodule lines, which
isn't particularly unusual. Saves some CPU too....
2019-09-13 14:52:57 +02:00
Bram Matthys
5c209bf6ca
require-module: CONFIG_RUN: only return 1 for settings that are for us.
2019-09-13 09:46:41 +02:00
GottemHams
43b03e75a6
Fixed some now-outdated comments in require-module, also send deny module notices globally instead of locally and change the default message for this
2019-09-12 21:45:33 +02:00
GottemHams
ab7cdbf2a7
Fix a couple of bugs recently introduced in require-module, also delay SQUITting until after the current SMOD command has been parsed
2019-09-12 19:48:33 +02:00
Bram Matthys
70410b3f33
Remove unused variables (67 files done, will do rest another time).
2019-09-12 17:57:01 +02:00
Bram Matthys
8d2dad4796
chanmodes/floodprot: remove old +f 1:1 conversion code, cleanup a bit
...
and remove unused variables (unused now, that is).
2019-09-12 16:49:20 +02:00
Bram Matthys
c3f7bbd9c0
require-mode: account for a little bit more room in S2S command
...
(not just hostname but also the command "SMOD" etc.. let's just say
16 bytes for now)
..and some minor cleanups of variables that are not needed.
2019-09-12 07:55:34 +02:00
Bram Matthys
cafe3cfd6d
Some S2S command changes to new require-modules module:
...
REQMODS Gmodname:version ....
to:
SMOD G:modname:version ....
Also, call the module require-module to be consistent with the
naming of the configuration directive.
Not sure yet of the set name, but call it set::require-module for
now as well.
2019-09-12 07:38:55 +02:00
Bram Matthys
88cbc38ff2
Do some more syntax checking, even for servers.
...
This fixes a crash in case of incorrect server to server traffic.
2019-09-12 07:16:18 +02:00
GottemHams
3948c3a74b
Forgot to remove a lil' comment :D [skip-ci]
2019-09-11 22:26:53 +02:00
GottemHams
358a31eaee
First draft of require-modules module (require modules globally or deny them)
2019-09-11 22:18:03 +02:00
GottemHams
daa2441c1c
Stray tab in rmtkl :D
2019-09-11 22:14:03 +02:00
Bram Matthys
c833ac2082
And some final cleanups of today, nothing important.
2019-09-11 20:07:47 +02:00
Bram Matthys
482c85de44
Get rid of this sptr->serv->user, as we already have sptr->serv->by
...
to track who initiated the connect. It also didn't seem to be displayed
anywhere but in /TRACE.
2019-09-11 19:46:52 +02:00
Bram Matthys
9b113c27e4
Document some more structs and group them in a logical place.
2019-09-11 19:07:11 +02:00
Bram Matthys
c72d848b61
Get rid of MembershipL since there's no difference anymore between
...
local membership structs (MembershipL) and remote ones (Membership),
so they are now all called... Membership.
2019-09-11 17:53:29 +02:00
Bram Matthys
bf2c5110db
IsPerson() -> IsUser(), MyClient() -> MyUser(), etc.
...
This so we have a few simple concepts:
Client: this can be a user, server, or something unknown yet
Then the type of clients:
User: this is a user, someone with a nick name.
Server: this is a server
Etc.
2019-09-11 17:43:17 +02:00
Bram Matthys
fcf0ff4e3c
Document client statuses (cptr->status) and some more renames.
2019-09-11 16:52:11 +02:00
Bram Matthys
2df5326615
Overhaul of all client flag macros (mass renaming, always use getters/setters/checkers)
2019-09-11 16:00:47 +02:00
Bram Matthys
e372e9118d
Move cptr->count to cptr->local->identbufcnt since this only used by
...
the ident reading code nowadays, which obviously only happens for
locally connected users.
2019-09-11 14:36:12 +02:00
Bram Matthys
d80e601760
Rename sptr->username to sptr->ident, since that is what it is.
...
[skip ci]
2019-09-11 14:31:14 +02:00
Bram Matthys
c69bdbe175
->status is now an enum of ClientStatus and STAT_xx -> CLIENT_STATUS_xx
2019-09-11 14:27:32 +02:00
Bram Matthys
792709bf4f
Move cptr->fd to cptr->local->fd. This may cause some crashes while
...
the rest of the code is audited / checked ;)
2019-09-11 14:21:07 +02:00
Bram Matthys
cb236eea88
Rename cptr->from to cptr->direction, since the 'from' is rather misleading
...
as cptr->from is NOT (necessarily) the server where cptr is connected to.
So we now call it cptr->direction since it indicates the directly connected
server (or &me)... in other words: the direction of the client path.
2019-09-11 14:03:27 +02:00
Bram Matthys
6a019d6188
Let's allow user connections.
...
*sigh*
(at least we have automated tests for this)
2019-09-11 13:44:55 +02:00