Commits
This patch was done while reviewing potential year-2038 issues in openSUSE.
Edited by @aaronmdjones to backport a new function for 7.2
Closes #66
Some resolvers will drop class ANY queries or reply with no data.
Perform an Internet-class query instead.
don't block users logging in as themself
Repurposing operserv:omode for this was a hack, and given the
potential abusability of this module, it should require its
own specific privilege.
The is_valid_nick() function will return false for all of the characters
that were being tested here, and there's no good reason to only test the
first character. Furthermore, we should be rejecting a lot more invalid
characters, such as period (.)
sasl_blacklist.c: hook into logouts and accountname changes as well
Having to duplicate configure tests in all supported Atheme release and
development branches, to enable contrib modules to be built reliably on
all of our supported platforms, was quickly becoming untenable.
Move the checks to contrib's own configure script, which necessitates
importing some build system things from Atheme proper.
This will not be backported to Atheme 7.1 or earlier; those versions are
no longer supported. If this submodule is bumped in those branches, the
contrib modules will no longer build, and make will likely fail.
Most platforms have these as enums, which are converted to int (for use
as arguments) by the compiler automatically. However, some platforms do
not have these as enums, and use macros to define their values instead.
The former platforms also have those macros to define them in terms of
the corresponding enum, so use the macros instead of the enums for
broader compatibility, defining them in terms of their enums when they
don't exist.
glibc2 and musl have enums and compatibility macros, uclibc and
uclibc-ng have enums only, and OpenBSD libc has macros only.
Fixes: 740371b4e2f48fbe8e24 ("Initial commit.")
Due to atheme/atheme@ff79e69ba30f5790426b this module will no longer
work on Atheme version 7.3+. However, all is not lost, as this module
was ported to Atheme proper in that version anyway, where it does
continue to work. Load that module instead.
The atheme.h in v7.3 includes all headers necessary, so we should only
include other Atheme headers if we are building for v7.2 or lower; not
only is including them pointless, but they no longer exist at the old
paths as of Atheme commit 81323dfcaa240ac5ca48
This is used by the ns_mxcheck modules, but on non-Linux platforms, the
functionality is usually in the C library, not a separate resolv one.
- Declare and assign variables at the same time when possible
- Test whether a K-Line has already been sent before doing any lookups
- Don't continue to do more lookups if we already have a match
broader kill line with custom timeout
The `os_klinechan.c` module is quite handy to deal with bad users, but
it is a little specific in the way it works. It bans the full
user@host hostmask and does so for a single day. For prolonged
botnet attacks, this is not very practical.
This patch broadens the banned hostmask to cover *all* users on the
attacker's IP address, so that rotating the username is not sufficient
to bypass the ban. This means more possible collateral damage, but I
think it's a good tradeoff considering we use this module to deal with
botnet attacks, for which we ban whole networks anyways.
Also, the timeout was hardcoded to one day. That seems awfully short
when dealing with prolonged attacks. Instead of hardcoding another
value, let's reuse the value from `SET KLINETIME` so that opers can
actually customize that setting.
- This module only works with Atheme v7.3, so if building against
a lesser version, compile a stub module that complains about
this instead of creating a compilation failure
This would have bit us if we ever bumped modules/contrib/ to
HEAD in the Atheme release/7.2 branch
- Use libathemecore memory allocator for storing new config
entries with an intrusive node so that we don't have to check
if mowgli_node_add() fails (or segfault otherwise)
- Make private variables compilation-unit-static
- Put function names on their own line
- Sprinkle some const-correctness everywhere
- Perform a service_find("saslserv") only once, on startup, and
error out if it fails
- Depend on saslserv/main so that we are reloaded if it is
Otherwise, given the above, mod_deinit() would call
del_conf_item() on a stale pointer and probably segfault
- Collapse 2 almost identical functions for processing config
entries into 1 function
- Collapse multiple instances of clearing a mowgli_list_t into 1
function which does the same
- Indicate which configuration block the parameters are in when
reporting errors with the configuration file
- Avoid some potential NULL dereferences
- Conform to Atheme v7.3 coding style (line wrapping, etc)
Ensure we are using libathemecore's memory allocation functions and
also ensure we use the new sfree() function introduced in Atheme 7.3
if available.
- Remove unnecessary forward declarations
- Make private variables compilation-unit-static
- Make a private function compilation-unit-static
- Remove struct typedefs to remove _t suffix
- Apply atheme/atheme@e1df27b9fbecc2267baa
- Remove unnecessary forward declarations
- Apply atheme/atheme@e1df27b9fbecc2267baa
- Remove unnecessary forward declarations
- Apply atheme/atheme@e1df27b9fbecc2267baa
- Move struct to only function it is used in
- Remove unnecessary forward declarations
- Apply atheme/atheme@e1df27b9fbecc2267baa
- Remove unnecessary forward declarations
- Apply atheme/atheme@e1df27b9fbecc2267baa
- Remove unnecessary forward declarations
- Make private variables compilation-unit-static
- Apply atheme/atheme@e1df27b9fbecc2267baa
- Apply atheme/atheme@8d44940363c0a5b72164
- Remove unnecessary forward declarations
This requires moving some functions around
- Make private variables compilation-unit-static
- Use bool instead of int for a boolean variable
- Apply atheme/atheme@e1df27b9fbecc2267baa
- Mark unused variable in mod_deinit
- Remove unnecessary forward declarations
- Apply atheme/atheme@e1df27b9fbecc2267baa
- Remove unnecessary forward declarations
- Apply atheme/atheme@e1df27b9fbecc2267baa
- Remove unnecessary forward declarations
- Apply atheme/atheme@e1df27b9fbecc2267baa
- Remove unnecessary forward declarations
- Make private variables compilation-unit-static
- Apply atheme/atheme@e1df27b9fbecc2267baa
- Apply atheme/atheme@8d44940363c0a5b72164
- Remove unnecessary forward declarations
- Apply atheme/atheme@e1df27b9fbecc2267baa
- Remove unnecessary forward declarations
- Apply atheme/atheme@e1df27b9fbecc2267baa
- Fix grammar error
Having to duplicate configure tests in all supported Atheme release and
development branches, to enable contrib modules to be built reliably on
all of our supported platforms, was quickly becoming untenable.
Move the checks to contrib's own configure script, which necessitates
importing some build system things from Atheme proper.
This will not be backported to Atheme 7.1 or earlier; those versions are
no longer supported. If this submodule is bumped in those branches, the
contrib modules will no longer build, and make will likely fail.
Most platforms have these as enums, which are converted to int (for use
as arguments) by the compiler automatically. However, some platforms do
not have these as enums, and use macros to define their values instead.
The former platforms also have those macros to define them in terms of
the corresponding enum, so use the macros instead of the enums for
broader compatibility, defining them in terms of their enums when they
don't exist.
glibc2 and musl have enums and compatibility macros, uclibc and
uclibc-ng have enums only, and OpenBSD libc has macros only.
Fixes: 740371b4e2f48fbe8e24 ("Initial commit.")
The `os_klinechan.c` module is quite handy to deal with bad users, but
it is a little specific in the way it works. It bans the full
user@host hostmask and does so for a single day. For prolonged
botnet attacks, this is not very practical.
This patch broadens the banned hostmask to cover *all* users on the
attacker's IP address, so that rotating the username is not sufficient
to bypass the ban. This means more possible collateral damage, but I
think it's a good tradeoff considering we use this module to deal with
botnet attacks, for which we ban whole networks anyways.
Also, the timeout was hardcoded to one day. That seems awfully short
when dealing with prolonged attacks. Instead of hardcoding another
value, let's reuse the value from `SET KLINETIME` so that opers can
actually customize that setting.
- This module only works with Atheme v7.3, so if building against
a lesser version, compile a stub module that complains about
this instead of creating a compilation failure
This would have bit us if we ever bumped modules/contrib/ to
HEAD in the Atheme release/7.2 branch
- Use libathemecore memory allocator for storing new config
entries with an intrusive node so that we don't have to check
if mowgli_node_add() fails (or segfault otherwise)
- Make private variables compilation-unit-static
- Put function names on their own line
- Sprinkle some const-correctness everywhere
- Perform a service_find("saslserv") only once, on startup, and
error out if it fails
- Depend on saslserv/main so that we are reloaded if it is
Otherwise, given the above, mod_deinit() would call
del_conf_item() on a stale pointer and probably segfault
- Collapse 2 almost identical functions for processing config
entries into 1 function
- Collapse multiple instances of clearing a mowgli_list_t into 1
function which does the same
- Indicate which configuration block the parameters are in when
reporting errors with the configuration file
- Avoid some potential NULL dereferences
- Conform to Atheme v7.3 coding style (line wrapping, etc)