diff options
-rw-r--r-- | docs/conf/modules.conf.example | 8 | ||||
-rw-r--r-- | make/directive.pm | 13 | ||||
-rw-r--r-- | make/template/main.mk | 6 | ||||
-rw-r--r-- | src/channels.cpp | 2 | ||||
-rw-r--r-- | src/modules/extra/m_geoip.cpp | 1 | ||||
-rw-r--r-- | src/modules/extra/m_ldap.cpp | 2 | ||||
-rw-r--r-- | src/modules/extra/m_mysql.cpp | 2 | ||||
-rw-r--r-- | src/modules/extra/m_pgsql.cpp | 1 | ||||
-rw-r--r-- | src/modules/extra/m_regex_pcre.cpp | 1 | ||||
-rw-r--r-- | src/modules/extra/m_sqlite3.cpp | 1 | ||||
-rw-r--r-- | src/modules/extra/m_ssl_gnutls.cpp | 1 | ||||
-rw-r--r-- | src/modules/extra/m_ssl_openssl.cpp | 1 | ||||
-rw-r--r-- | src/modules/m_joinflood.cpp | 13 | ||||
-rw-r--r-- | src/modules/m_nickflood.cpp | 15 |
14 files changed, 54 insertions, 13 deletions
diff --git a/docs/conf/modules.conf.example b/docs/conf/modules.conf.example index 4352b0a09..5aa5bb158 100644 --- a/docs/conf/modules.conf.example +++ b/docs/conf/modules.conf.example @@ -1007,8 +1007,11 @@ #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# # Join flood module: Adds support for join flood protection +j X:Y. -# Closes the channel for 60 seconds if X users join in Y seconds. +# Closes the channel for N seconds if X users join in Y seconds. #<module name="joinflood"> +# +# The number of seconds to close the channel for: +#<joinflood duration="1m"> #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# # Jump server module: Adds support for the RPL_REDIR numeric. @@ -1215,6 +1218,9 @@ # Nickchange flood protection module: Provides channel mode +F X:Y # which allows up to X nick changes in Y seconds. #<module name="nickflood"> +# +# The number of seconds to prevent nick changes for: +#<nickflood duration="1m"> #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# # Nicklock module: Let opers change a user's nick and then stop that diff --git a/make/directive.pm b/make/directive.pm index c490135fd..4501fc5ec 100644 --- a/make/directive.pm +++ b/make/directive.pm @@ -80,6 +80,13 @@ sub execute_functions($$$) { return $line; } +sub __environment { + my ($prefix, $suffix) = @_; + $suffix =~ s/[-.]/_/g; + $suffix =~ s/[^A-Za-z0-9_]//g; + return $prefix . uc $suffix; +} + sub __error { my ($file, @message) = @_; push @message, ''; @@ -142,7 +149,7 @@ sub __function_execute { # If looking up with pkg-config fails then check the environment... if (defined $environment && $environment ne '') { - $environment = sprintf('INSPIRCD_%s', uc $environment); + $environment = __environment 'INSPIRCD_', $environment; if (defined $ENV{$environment}) { print_format "Execution of `<|GREEN $command|>` failed; using the environment: <|BOLD $ENV{$environment}|>\n"; return $ENV{$environment}; @@ -170,7 +177,7 @@ sub __function_find_compiler_flags { } # If looking up with pkg-config fails then check the environment... - my $key = sprintf('INSPIRCD_CXXFLAGS_%s', uc $name); + my $key = __environment 'INSPIRCD_CXXFLAGS_', $name; if (defined $ENV{$key}) { print_format "Found the compiler flags for <|GREEN ${\basename $file, '.cpp'}|> using the environment: <|BOLD $ENV{$key}|>\n"; return $ENV{$key}; @@ -197,7 +204,7 @@ sub __function_find_linker_flags { } # If looking up with pkg-config fails then check the environment... - my $key = sprintf('INSPIRCD_LDFLAGS_%s', uc $name); + my $key = __environment 'INSPIRCD_CXXFLAGS_', $name; if (defined $ENV{$key}) { print_format "Found the linker flags for <|GREEN ${\basename $file, '.cpp'}|> using the environment: <|BOLD $ENV{$key}|>\n"; return $ENV{$key}; diff --git a/make/template/main.mk b/make/template/main.mk index 818b4139d..c2babe8f6 100644 --- a/make/template/main.mk +++ b/make/template/main.mk @@ -123,9 +123,9 @@ FOOTER = finishmessage CORECXXFLAGS += -DINSPIRCD_STATIC @ENDIF -# Add the users CXXFLAGS to the base ones to allow them to override -# things like -Wfatal-errors if they wish to. -CORECXXFLAGS += $(CXXFLAGS) +# Add the users CPPFLAGS/CXXFLAGS to the base ones to allow them to +# override things like -Wfatal-errors if they wish to. +CORECXXFLAGS += $(CPPFLAGS) $(CXXFLAGS) @DO_EXPORT CXX CORECXXFLAGS LDLIBS PICLDFLAGS INSPIRCD_VERBOSE SOCKETENGINE CORELDFLAGS @DO_EXPORT SOURCEPATH BUILDPATH INSPIRCD_STATIC diff --git a/src/channels.cpp b/src/channels.cpp index 49fa75f98..bc23c680a 100644 --- a/src/channels.cpp +++ b/src/channels.cpp @@ -181,7 +181,7 @@ Channel* Channel::JoinUser(LocalUser* user, std::string cname, bool override, co { unsigned int opermaxchans = ConvToInt(user->oper->getConfig("maxchans")); // If not set, use 2.0's <channels:opers>, if that's not set either, use limit from CC - if (!opermaxchans) + if (!opermaxchans && user->HasPrivPermission("channels/high-join-limit")) opermaxchans = ServerInstance->Config->OperMaxChans; if (opermaxchans) maxchans = opermaxchans; diff --git a/src/modules/extra/m_geoip.cpp b/src/modules/extra/m_geoip.cpp index b350ede90..c7b0fd210 100644 --- a/src/modules/extra/m_geoip.cpp +++ b/src/modules/extra/m_geoip.cpp @@ -20,6 +20,7 @@ /// $CompilerFlags: find_compiler_flags("geoip" "") /// $LinkerFlags: find_linker_flags("geoip" "-lGeoIP") +/// $PackageInfo: require_system("centos" "7.0") GeoIP-devel pkgconfig /// $PackageInfo: require_system("darwin") geoip pkg-config /// $PackageInfo: require_system("ubuntu") libgeoip-dev pkg-config diff --git a/src/modules/extra/m_ldap.cpp b/src/modules/extra/m_ldap.cpp index 78cce50bd..fc1bee939 100644 --- a/src/modules/extra/m_ldap.cpp +++ b/src/modules/extra/m_ldap.cpp @@ -18,6 +18,8 @@ */ /// $LinkerFlags: -llber -lldap_r + +/// $PackageInfo: require_system("centos") openldap-devel /// $PackageInfo: require_system("ubuntu") libldap2-dev #include "inspircd.h" diff --git a/src/modules/extra/m_mysql.cpp b/src/modules/extra/m_mysql.cpp index d965c88fb..39b0c369d 100644 --- a/src/modules/extra/m_mysql.cpp +++ b/src/modules/extra/m_mysql.cpp @@ -22,6 +22,8 @@ /// $CompilerFlags: execute("mysql_config --include" "MYSQL_CXXFLAGS") /// $LinkerFlags: execute("mysql_config --libs_r" "MYSQL_LDFLAGS" "-lmysqlclient") +/// $PackageInfo: require_system("centos" "6.0" "6.99") mysql-devel +/// $PackageInfo: require_system("centos" "7.0") mariadb-devel /// $PackageInfo: require_system("darwin") mysql-connector-c /// $PackageInfo: require_system("ubuntu") libmysqlclient-dev diff --git a/src/modules/extra/m_pgsql.cpp b/src/modules/extra/m_pgsql.cpp index 56455a718..5f6f6e30f 100644 --- a/src/modules/extra/m_pgsql.cpp +++ b/src/modules/extra/m_pgsql.cpp @@ -24,6 +24,7 @@ /// $CompilerFlags: -Iexecute("pg_config --includedir" "POSTGRESQL_INCLUDE_DIR") /// $LinkerFlags: -Lexecute("pg_config --libdir" "POSTGRESQL_LIBRARY_DIR") -lpq +/// $PackageInfo: require_system("centos") postgresql-devel /// $PackageInfo: require_system("darwin") postgresql /// $PackageInfo: require_system("ubuntu") libpq-dev diff --git a/src/modules/extra/m_regex_pcre.cpp b/src/modules/extra/m_regex_pcre.cpp index 5ad27858f..e270ca039 100644 --- a/src/modules/extra/m_regex_pcre.cpp +++ b/src/modules/extra/m_regex_pcre.cpp @@ -20,6 +20,7 @@ /// $CompilerFlags: execute("pcre-config --cflags" "PCRE_CXXFLAGS") /// $LinkerFlags: execute("pcre-config --libs" "PCRE_LDFLAGS" "-lpcre") +/// $PackageInfo: require_system("centos") pcre-devel pkgconfig /// $PackageInfo: require_system("darwin") pcre pkg-config /// $PackageInfo: require_system("ubuntu") libpcre3-dev pkg-config diff --git a/src/modules/extra/m_sqlite3.cpp b/src/modules/extra/m_sqlite3.cpp index fa88cacc3..ac7146e38 100644 --- a/src/modules/extra/m_sqlite3.cpp +++ b/src/modules/extra/m_sqlite3.cpp @@ -22,6 +22,7 @@ /// $CompilerFlags: find_compiler_flags("sqlite3") /// $LinkerFlags: find_linker_flags("sqlite3" "-lsqlite3") +/// $PackageInfo: require_system("centos") pkgconfig sqlite-devel /// $PackageInfo: require_system("darwin") pkg-config sqlite3 /// $PackageInfo: require_system("ubuntu") libsqlite3-dev pkg-config diff --git a/src/modules/extra/m_ssl_gnutls.cpp b/src/modules/extra/m_ssl_gnutls.cpp index a42efa1ab..c1ffdfb4c 100644 --- a/src/modules/extra/m_ssl_gnutls.cpp +++ b/src/modules/extra/m_ssl_gnutls.cpp @@ -26,6 +26,7 @@ /// $LinkerFlags: find_linker_flags("gnutls" "-lgnutls") /// $LinkerFlags: require_version("gnutls" "1.0" "2.12") execute("libgcrypt-config --libs" "LIBGCRYPT_LDFLAGS") +/// $PackageInfo: require_system("centos") gnutls-devel pkgconfig /// $PackageInfo: require_system("darwin") gnutls pkg-config /// $PackageInfo: require_system("ubuntu" "1.0" "13.10") libgcrypt11-dev /// $PackageInfo: require_system("ubuntu" "14.04") gnutls-bin libgnutls-dev pkg-config diff --git a/src/modules/extra/m_ssl_openssl.cpp b/src/modules/extra/m_ssl_openssl.cpp index 8843c34f6..7cff5da8a 100644 --- a/src/modules/extra/m_ssl_openssl.cpp +++ b/src/modules/extra/m_ssl_openssl.cpp @@ -24,6 +24,7 @@ /// $CompilerFlags: find_compiler_flags("openssl") /// $LinkerFlags: find_linker_flags("openssl" "-lssl -lcrypto") +/// $PackageInfo: require_system("centos") openssl-devel pkgconfig /// $PackageInfo: require_system("darwin") openssl pkg-config /// $PackageInfo: require_system("ubuntu" "16.04") libssl-dev openssl pkg-config diff --git a/src/modules/m_joinflood.cpp b/src/modules/m_joinflood.cpp index 56131f0be..077ceff52 100644 --- a/src/modules/m_joinflood.cpp +++ b/src/modules/m_joinflood.cpp @@ -23,6 +23,9 @@ #include "inspircd.h" +// The number of seconds the channel will be closed for. +static unsigned int duration; + /** Holds settings and state associated with channel mode +j */ class joinfloodsettings @@ -71,7 +74,7 @@ class joinfloodsettings void lock() { - unlocktime = ServerInstance->Time() + 60; + unlocktime = ServerInstance->Time() + duration; } bool operator==(const joinfloodsettings& other) const @@ -129,6 +132,12 @@ class ModuleJoinFlood : public Module { } + void ReadConfig(ConfigStatus&) CXX11_OVERRIDE + { + ConfigTag* tag = ServerInstance->Config->ConfValue("joinflood"); + duration = tag->getDuration("duration", 60, 10, 600); + } + ModResult OnUserPreJoin(LocalUser* user, Channel* chan, const std::string& cname, std::string& privs, const std::string& keygiven) CXX11_OVERRIDE { if (chan) @@ -159,7 +168,7 @@ class ModuleJoinFlood : public Module { f->clear(); f->lock(); - memb->chan->WriteNotice(InspIRCd::Format("This channel has been closed to new users for 60 seconds because there have been more than %d joins in %d seconds.", f->joins, f->secs)); + memb->chan->WriteNotice(InspIRCd::Format("This channel has been closed to new users for %u seconds because there have been more than %d joins in %d seconds.", duration, f->joins, f->secs)); } } } diff --git a/src/modules/m_nickflood.cpp b/src/modules/m_nickflood.cpp index 39e097daa..abb3cdfaf 100644 --- a/src/modules/m_nickflood.cpp +++ b/src/modules/m_nickflood.cpp @@ -20,6 +20,9 @@ #include "inspircd.h" +// The number of seconds nickname changing will be blocked for. +static unsigned int duration; + /** Holds settings and state associated with channel mode +F */ class nickfloodsettings @@ -72,7 +75,7 @@ class nickfloodsettings void lock() { - unlocktime = ServerInstance->Time() + 60; + unlocktime = ServerInstance->Time() + duration; } }; @@ -126,6 +129,12 @@ class ModuleNickFlood : public Module { } + void ReadConfig(ConfigStatus&) CXX11_OVERRIDE + { + ConfigTag* tag = ServerInstance->Config->ConfValue("nickflood"); + duration = tag->getDuration("duration", 60, 10, 600); + } + ModResult OnUserPreNick(LocalUser* user, const std::string& newnick) CXX11_OVERRIDE { for (User::ChanList::iterator i = user->chans.begin(); i != user->chans.end(); i++) @@ -142,7 +151,7 @@ class ModuleNickFlood : public Module if (f->islocked()) { - user->WriteNumeric(ERR_CANTCHANGENICK, InspIRCd::Format("%s has been locked for nickchanges for 60 seconds because there have been more than %u nick changes in %u seconds", channel->name.c_str(), f->nicks, f->secs)); + user->WriteNumeric(ERR_CANTCHANGENICK, InspIRCd::Format("%s has been locked for nickchanges for %u seconds because there have been more than %u nick changes in %u seconds", channel->name.c_str(), duration, f->nicks, f->secs)); return MOD_RES_DENY; } @@ -150,7 +159,7 @@ class ModuleNickFlood : public Module { f->clear(); f->lock(); - channel->WriteNotice(InspIRCd::Format("No nick changes are allowed for 60 seconds because there have been more than %u nick changes in %u seconds.", f->nicks, f->secs)); + channel->WriteNotice(InspIRCd::Format("No nick changes are allowed for %u seconds because there have been more than %u nick changes in %u seconds.", duration, f->nicks, f->secs)); return MOD_RES_DENY; } } |