Commit graph

64 commits

Author SHA1 Message Date
Doug Freed
cc95a6722e modules: quietly succeed at loading a module if already loaded
This allows explicitly loading a module in the config so it's available
for later config items that might need it, and skips the double load
when main loads all modules, which would cause errors
2023-07-01 19:23:56 +01:00
Doug Freed
7a2ccb077f modules: clear module list and mod paths in init
If main is called more than once (like in tests), everything is
reinitialized except the loaded module list and module paths, so clear
them too so that modules are loaded again and the path list is correct.
2023-07-01 19:23:56 +01:00
jailbird777
8f0c3422e7 Remove Windows support 2021-07-30 14:17:47 -04:00
jess
a922755512
make more snotes L_NETWIDE 2020-11-08 14:30:41 -05:00
Ed Kellett
94613c78b6 Implement the solanum.chat/identify-msg vendor cap 2020-10-16 21:47:38 +01:00
Ed Kellett
a6f63a829e
Innovation by sed 2020-10-15 15:52:41 +01:00
Aaron Jones
f598ba3857
ircd/modules.c: complain to foreground if unable to locate module
Without this a conftest user has no idea whether the module path
is correct or not.

[ci skip]
2020-07-04 02:14:33 +00:00
Doug Freed
eed4099e07 Actually use modules' declared hook priorities 2020-07-01 19:43:48 +00:00
Aaron Jones
17dc265c9d
Merge pull request #329 from edk0/reload-by-path
Reload modules by path
2020-06-25 17:32:58 +00:00
Aaron Jones
03c167e03b
Merge pull request #330 from edk0/caps-before-init
modules: create caps before mapi_register()
2020-06-10 15:03:57 +00:00
Ed Kellett
33c0142671
modules: create caps before mapi_register() 2020-06-02 18:35:50 +01:00
Ed Kellett
df7e3dabce
Reload modules by path 2020-06-02 16:17:26 +01:00
Ed Kellett
91b1278224
Implement hook priorities 2020-05-01 17:44:15 +01:00
Ed Kellett
6aa5c725ff
modules: fix use-after-free when reloading 2020-01-02 16:45:15 +00:00
Ed Kellett
7b6410135b
m_modules: make modreload work like restart
/modrestart used to be implemented as a normal command and could crash
when used remotely because it would reload m_encap, which was on the
call stack at the time. This was fixed in 41390bfe5f. However,
/modreload has exactly the same problem, so I'm giving it the
same treatment.

Incidentally: This bug was first discovered in ircd-seven, where the
`/mod*` commands themselves live in the core, so m_encap was the only way
the crash could happen (and it didn't most of the time, because m_encap
would only be moved if you got unlucky). But `/mod*` are in modules in
charybdis, so /modrestart would have unloaded the code it was in the
middle of executing. With that in mind, I'm not sure how it ever
appeared to work.
2019-11-17 18:01:51 +00:00
Ed Kellett
28cc8bb924
Deferred capability notifications from modules
Reloading modules sends CAP DEL followed by an immediate CAP NEW:

    :staberinde.local CAP * DEL :account-tag
    :staberinde.local CAP * NEW :account-tag

This isn't very nice. /modrestart is particularly bad. In order to avoid
doing this, we remember the capability set at the beginning of module
operations, compare that with the set afterwards, and report only the
differences with CAP {DEL,NEW}.
2019-09-07 14:59:33 +01:00
Simon Arlott
de36941445
remove unused variables 2017-08-04 20:02:20 +01:00
Simon Arlott
a7fed8715b
Revert "Core modules cannot be unloaded, otherwise bad things happen."
This reverts commit b5cfad0319.
2017-07-29 23:52:06 +01:00
Aaron Jones
41390bfe5f
When a remote MODRESTART command is received, it will pass through the
ENCAP module. The ms_encap function is responsible for dispatching the
command handler and then the modules will eventually be reloaded.

However, if the ENCAP module is reloaded to a different address, the
stack now contains the address of a function that no longer exists.

Also, in this version of the IRCd, the module restarting functionality
was located in a function that is itself located in a module, so things
will also go badly if that module is reloaded to a different address,
too.

Return immediately from the command handler and have the event loop
call the function responsible for reloading the modules instead.

c.f. release/3.5 commit db05a36210

Reported-by: mniip (Freenode)
2016-12-28 22:08:14 +00:00
Jason Volk
b5cfad0319 Core modules cannot be unloaded, otherwise bad things happen.
Additionally some information is logged and passed to the operator
conducting a MODRESTART.
2016-06-21 17:42:36 -07:00
William Pitcock
e55a9d6abc modules: serious cleanups 2016-06-18 00:52:16 -05:00
William Pitcock
92dad4831d modules: cleanups 2016-06-18 00:38:40 -05:00
Aaron Jones
b143df9ac4
minor spring cleaning: remove/relocate duplicate/unused includes & macros
[ci skip]
2016-05-14 23:29:33 +00:00
Simon Arlott
c173a8ad44
modules: use exit(EXIT_FAILURE) on failure
This will allow service process monitoring to recognise the difference
between a shutdown and an error of a -foreground ircd, because only
/DIE (or SIGINT) will exit with return code 0.
2016-04-25 22:27:57 +01:00
Simon Arlott
e8de2bfaf0
modules: add missing break 2016-04-23 23:37:38 +01:00
Elizabeth Myers
0a87075b86 modules: fix up display names 2016-04-07 04:15:12 -05:00
Elizabeth Myers
78946542bb modules: move module loading/unloading commands to dedicated module.
There's no reason to really have these in the main ircd anymore, static
modules are dead and aren't coming back.

To ensure people don't do something hopelessly retarded, this is a core
module.
2016-04-07 04:00:25 -05:00
Elizabeth Myers
f956cb0f1f Use rb_* versions of nonportable string functions 2016-04-05 05:39:59 -05:00
Elizabeth Myers
3256156aca Announce changed capabilities on module load
Closes #165
2016-04-04 02:30:35 -05:00
staticfox
5eb3d7a7c0 modules: Revert mapi_register() to use ints
modinit() returns either 0 (success) or -1 (failure) so we
can't check for true/false.
2016-04-03 20:14:36 -04:00
Elizabeth Myers
c0483ac17b boolify calls to rehash 2016-04-03 01:53:34 -05:00
Elizabeth Myers
aa483e55bd bool-ify modules stuff 2016-04-03 01:51:45 -05:00
Elizabeth Myers
6603175304 Clean up module loading a bit. 2016-04-03 01:21:19 -05:00
William Pitcock
4d8cfacd95 ircd: start staging for relocatable paths 2016-03-24 18:45:28 -05:00
Matt Ullman
e23126c83b Cleanup warnings 2016-03-21 22:28:41 -04:00
William Pitcock
dd92c99b83 modules: fix thinko 2016-03-20 06:01:12 -05:00
William Pitcock
c9108ea073 ircd: modules: findmodule_byname(): also check LT_MODULE_EXT here 2016-03-20 06:00:20 -05:00
William Pitcock
6cb643f4f9 ircd: modules: use LT_MODULE_EXT more consistently 2016-03-20 05:54:48 -05:00
William Pitcock
02831b6f65 modules: warning cleanups 2016-03-20 02:42:42 -05:00
Elizabeth Myers
1db8a31395 modules: fix stupid GCC false positive warning.
This invocation of strlen is on a constant string and should be folded
by any sane compiler (GCC included), but it warns anyway because GCC is
stupid.
2016-03-18 15:32:33 -05:00
Elizabeth Myers
9abdcf1c64 modules: can .la suffix.
.la archives are prohibited by most Linux distributions because they
clutter up the linker. They may get caught up as victims in scripts that
purge .la files. Besides, .la files don't matter for simple loadable
modules on most systems.

So, what we do now instead is just use the platform suffix detected by
libtool.
2016-03-12 20:10:46 -06:00
Elizabeth Myers
503727d1ee More bool conversions 2016-03-09 02:19:31 -06:00
Elizabeth Myers
550e851c5e Merge branch 'master' of github.com:charybdis-ircd/charybdis into elizafox-cleanups 2016-03-09 01:41:10 -06:00
Elizabeth Myers
3c7d6fcce7 Message handlers should return void.
Also fix up some return values and stuff to use bool (or void if
nothing). I just did it whilst I was here.

According to jilles, the return value used to signify whether or not the
client had exited. This was error-prone and was fixed a long, long time
ago, but the return value was left int for historical reasons.

Since the return type is not used (and has no clear use case anyway),
it's safe to just get rid of it.
2016-03-09 01:37:03 -06:00
William Pitcock
881acf00c6 ircd: fix up some iwarn() calls which referred to L_MAIN 2016-03-08 13:47:41 -06:00
William Pitcock
3089f59c10 modules: using labs() for date math is unsafe 2016-03-08 13:46:19 -06:00
Elizabeth Myers
81204be809 Add ircd serials to AV2. 2016-03-07 18:10:22 -06:00
Elizabeth Myers
978b723252 modules: show module provenance in modlist 2016-03-06 23:21:08 -06:00
Elizabeth Myers
216d70e91d modules: tag origin at load time. 2016-03-06 18:57:05 -06:00
Elizabeth Myers
c63aeb44e9 modules: add origin field to V2 2016-03-06 17:52:49 -06:00