print "Please note: for \e[1;32mSSL support\e[0m you will need to load required\n";
print "modules in your config. This configure script has added those modules to the\n";
print "build process. For more info, please refer to:\n";
- print "\e[1;32mhttp://wiki.inspircd.org/Installation_From_Tarball\e[0m\n";
+ print "\e[1;32mhttps://wiki.inspircd.org/Installation_From_Tarball\e[0m\n";
}
print "*** \e[1;32mRemember to edit your configuration files!!!\e[0m ***\n\n\n";
if (($config{OSNAME} eq "OpenBSD") && ($config{CC} ne "eg++")) {
# represented as 192.168.1.0/24). This means that abuse across an ISP #
# is detected and curtailed much easier. Here is a good chart that #
# shows how many IPs the different CIDRs correspond to: #
-# http://en.wikipedia.org/wiki/CIDR#Prefix_aggregation #
+# https://en.wikipedia.org/wiki/IPv4_subnetting_reference #
+# https://en.wikipedia.org/wiki/IPv6_subnetting_reference #
# #
<cidr
ssl="gnutls"
# fingerprint: If defined, this option will force servers to be
- # authenticated using SSL Fingerprints. See http://wiki.inspircd.org/SSL
+ # authenticated using SSL Fingerprints. See https://wiki.inspircd.org/SSL
# for more information. This will require an SSL link for both inbound
# and outbound connections.
#fingerprint=""
# #
# By default, ALL modules are commented out. You must uncomment them #
# or add lines to your config to load modules. Please refer to #
-# http://wiki.inspircd.org/Modules for a list of modules and #
+# https://wiki.inspircd.org/2.0/Modules for a list of modules and #
# each modules link for any additional conf tags they require. #
# #
# ____ _ _____ _ _ ____ _ _ _ #
# #
# Optional - If you specify to use the m_censor module, then you must #
# specify some censor tags. See also: #
-# http://wiki.inspircd.org/Modules/censor #
+# https://wiki.inspircd.org/Modules/2.0/censor #
#
#<include file="conf/examples/censor.conf.example">
# Optional - If you specify to use m_cgiirc, then you must specify one
# or more cgihost tags which indicate authorised CGI:IRC servers which
# will be connecting to your network, and an optional cgiirc tag.
-# For more information see: http://wiki.inspircd.org/Modules/cgiirc
+# For more information see: https://wiki.inspircd.org/Modules/2.0/cgiirc
#
# Set to yes if you want to notice opers when CGI:IRC clients connect.
# <cgiirc opernotice="no">
#<module name="m_dnsbl.so"> #
# #
# For configuration options please see the wiki page for m_dnsbl at #
-# http://wiki.inspircd.org/Modules/dnsbl #
+# https://wiki.inspircd.org/Modules/2.0/dnsbl #
#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
# Exempt channel operators module: Provides support for allowing #
#
#-#-#-#-#-#-#-#-#-#-#- HOSTCHANGE CONFIGURATION -#-#-#-#-#-#-#-#-#-#
# #
-# See http://wiki.inspircd.org/Modules/hostchange for help. #
+# See https://wiki.inspircd.org/Modules/2.0/hostchange for help. #
# #
#<host suffix="invalid.org" separator="." prefix="">
#<hostchange mask="*@42.theanswer.example.org" action="addnick">
#-#-#-#-#-#-#-#-#-#-#-#- SQL CONFIGURATION -#-#-#-#-#-#-#-#-#-#-#-#-#
# #
# m_mssql.so is more complex than described here, see wiki for more #
-# info http://wiki.inspircd.org/Modules/mssql #
+# info https://wiki.inspircd.org/Modules/2.0/mssql #
#
#<database module="mssql" name="db" user="user" pass="pass" host="localhost" id="db1">
#-#-#-#-#-#-#-#-#-#-#-#- SQL CONFIGURATION -#-#-#-#-#-#-#-#-#-#-#-#-#
# #
# m_mysql.so is more complex than described here, see the wiki for #
-# more: http://wiki.inspircd.org/Modules/mysql #
+# more: https://wiki.inspircd.org/Modules/2.0/mysql #
#
#<database module="mysql" name="mydb" user="myuser" pass="mypass" host="localhost" id="my_database2">
#-#-#-#-#-#-#-#-#-#-# OVERRIDE CONFIGURATION -#-#-#-#-#-#-#-#-#-#-#
# #
# m_override.so is too complex it describe here, see the wiki: #
-# http://wiki.inspircd.org/Modules/override #
+# https://wiki.inspircd.org/Modules/2.0/override #
#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
# Oper levels module: Gives each oper a level and prevents actions
#-#-#-#-#-#-#-#-#-#-#-#- SQL CONFIGURATION -#-#-#-#-#-#-#-#-#-#-#-#-#
# #
# m_pgsql.so is more complex than described here, see the wiki for #
-# more: http://wiki.inspircd.org/Modules/pgsql #
+# more: https://wiki.inspircd.org/Modules/2.0/pgsql #
#
#<database module="pgsql" name="mydb" user="myuser" pass="mypass" host="localhost" id="my_database" ssl="no">
#-#-#-#-#-#-#-#-#-#-#- GNUTLS CONFIGURATION -#-#-#-#-#-#-#-#-#-#-#-#
# #
# m_ssl_gnutls.so is too complex to describe here, see the wiki: #
-# http://wiki.inspircd.org/Modules/ssl_gnutls #
+# https://wiki.inspircd.org/Modules/2.0/ssl_gnutls #
#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
# SSL info module: Allows users to retrieve information about other
#-#-#-#-#-#-#-#-#-#-#- OPENSSL CONFIGURATION -#-#-#-#-#-#-#-#-#-#-#-#
# #
# m_ssl_openssl.so is too complex to describe here, see the wiki: #
-# http://wiki.inspircd.org/Modules/ssl_openssl #
+# https://wiki.inspircd.org/Modules/2.0/ssl_openssl #
#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
# Strip color module: Adds channel mode +S that strips mIRC color
# SQLite3 module: Allows other SQL modules to access SQLite3 #
# databases through a unified API. #
# This module is in extras. Re-run configure with: #
-# ./configure --enable-extras=m_sqlite.cpp
+# ./configure --enable-extras=m_sqlite3.cpp
# and run make install, then uncomment this module to enable it. #
#
#<module name="m_sqlite3.so">
#-#-#-#-#-#-#-#-#-#-#-#- SQL CONFIGURATION -#-#-#-#-#-#-#-#-#-#-#-#-#
# #
# m_sqlite.so is more complex than described here, see the wiki for #
-# more: http://wiki.inspircd.org/Modules/sqlite3 #
+# more: https://wiki.inspircd.org/Modules/2.0/sqlite3 #
#
#<database module="sqlite" hostname="/full/path/to/database.db" id="anytext">
#-#-#-#-#-#-#-#-#-#-#- SQLAUTH CONFIGURATION -#-#-#-#-#-#-#-#-#-#-#-#
# #
# m_sqlauth.so is too complex to describe here, see the wiki: #
-# http://wiki.inspircd.org/Modules/sqlauth #
+# https://wiki.inspircd.org/Modules/2.0/sqlauth #
#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
# SQL oper module: Allows you to store oper credentials in an SQL table
# dbid - Database ID to use (see SQL modules). #
# hash - Hashing provider to use for password hashing. #
# #
-# See also: http://wiki.inspircd.org/Modules/sqloper #
+# See also: https://wiki.inspircd.org/Modules/2.0/sqloper #
# #
#<sqloper dbid="1" hash="md5">
# Optional - If you specify to use m_cgiirc, then you must specify one
# or more cgihost tags which indicate authorised CGI:IRC servers which
# will be connecting to your network, and an optional cgiirc tag.
-# For more information see: http://wiki.inspircd.org/Modules/cgiirc
+# For more information see: https://wiki.inspircd.org/Modules/2.0/cgiirc
#
# Set to yes if you want to notice opers when CGI clients connect
# <cgiirc opernotice="no">
#-#-#-#-#-#-#-#-#-#-#- GNUTLS CONFIGURATION -#-#-#-#-#-#-#-#-#-#-#-#
# #
# m_ssl_gnutls.so is too complex to describe here, see the wiki: #
-# http://wiki.inspircd.org/Modules/ssl_gnutls #
+# https://wiki.inspircd.org/Modules/2.0/ssl_gnutls #
#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
# SSL Info module: Allows users to retrieve information about other
#-#-#-#-#-#-#-#-#-#-#- OPENSSL CONFIGURATION -#-#-#-#-#-#-#-#-#-#-#-#
# #
# m_ssl_openssl.so is too complex to describe here, see the wiki: #
-# http://wiki.inspircd.org/Modules/ssl_openssl #
+# https://wiki.inspircd.org/Modules/2.0/ssl_openssl #
<module name="m_stripcolor.so">
<module name="m_svshold.so">
# Optional - If you specify to use m_cgiirc, then you must specify one
# or more cgihost tags which indicate authorised CGI:IRC servers which
# will be connecting to your network, and an optional cgiirc tag.
-# For more information see: http://wiki.inspircd.org/Modules/cgiirc
+# For more information see: https://wiki.inspircd.org/Modules/2.0/cgiirc
#
# Set to yes if you want to notice opers when CGI clients connect
# <cgiirc opernotice="no">
#-#-#-#-#-#-#-#-#-#-# OVERRIDE CONFIGURATION -#-#-#-#-#-#-#-#-#-#-#
# #
# m_override.so is too complex to describe here, see the wiki: #
-# http://wiki.inspircd.org/Modules/override #
+# https://wiki.inspircd.org/Modules/2.0/override #
<module name="m_operlevels.so">
<module name="m_opermodes.so">
#-#-#-#-#-#-#-#-#-#-#- GNUTLS CONFIGURATION -#-#-#-#-#-#-#-#-#-#-#-#
# #
# m_ssl_gnutls.so is too complex to describe here, see the wiki: #
-# http://wiki.inspircd.org/Modules/ssl_gnutls #
+# https://wiki.inspircd.org/Modules/2.0/ssl_gnutls #
<module name="m_sslinfo.so">
#-#-#-#-#-#-#-#-#-#-#- OPENSSL CONFIGURATION -#-#-#-#-#-#-#-#-#-#-#-#
# #
# m_ssl_openssl.so is too complex to describe here, see the wiki: #
-# http://wiki.inspircd.org/Modules/ssl_openssl #
+# https://wiki.inspircd.org/Modules/2.0/ssl_openssl #
<module name="m_stripcolor.so">
<module name="m_svshold.so">
*/
std::string err;
-#ifdef _WIN32
/** Sets the last error string
*/
void RetrieveLastError();
-#endif
public:
/** This constructor loads the module using dlopen()
/** A hash of commands used by the core
*/
-typedef nspace::hash_map<std::string,Command*> Commandtable;
+#ifdef HASHMAP_DEPRECATED
+ typedef nspace::hash_map<std::string, Command*, nspace::insensitive, irc::StrHashComp> Commandtable;
+#else
+ typedef nspace::hash_map<std::string, Command*, nspace::hash<std::string>, irc::StrHashComp> Commandtable;
+#endif
/** Membership list of a channel */
typedef std::map<User*, Membership*> UserMembList;
for (user_hash::iterator u = this->Users->clientlist->begin(); u != this->Users->clientlist->end(); u++)
{
- if ((InspIRCd::Match(u->second->MakeHost(), mask, ascii_case_insensitive_map)) ||
- (InspIRCd::Match(u->second->MakeHostIP(), mask, ascii_case_insensitive_map)))
+ if ((InspIRCd::MatchCIDR(u->second->MakeHost(), mask, ascii_case_insensitive_map)) ||
+ (InspIRCd::MatchCIDR(u->second->MakeHostIP(), mask, ascii_case_insensitive_map)))
{
matches++;
}
for (user_hash::iterator u = this->Users->clientlist->begin(); u != this->Users->clientlist->end(); u++)
{
- if (InspIRCd::Match(u->second->GetIPString(), ip, ascii_case_insensitive_map))
+ if (InspIRCd::MatchCIDR(u->second->GetIPString(), ip, ascii_case_insensitive_map))
matches++;
}
ServerInstance->SendError("Server restarting.");
#ifndef _WIN32
- /* XXX: This hack sets FD_CLOEXEC on all possible file descriptors, so they're closed if the execv() below succeeds.
+ /* XXX: This hack sets FD_CLOEXEC on all possible file descriptors, so they're closed if the execvp() below succeeds.
* Certainly, this is not a nice way to do things and it's slow when the fd limit is high.
*
* A better solution would be to set the close-on-exec flag for each fd we create (or create them with O_CLOEXEC),
}
#endif
- execv(ServerInstance->Config->cmdline.argv[0], ServerInstance->Config->cmdline.argv);
+ execvp(ServerInstance->Config->cmdline.argv[0], ServerInstance->Config->cmdline.argv);
ServerInstance->SNO->WriteGlobalSno('a', "Failed RESTART - could not execute '%s' (%s)",
ServerInstance->Config->cmdline.argv[0], strerror(errno));
}
h = dlopen(fname, RTLD_NOW|RTLD_LOCAL);
if (!h)
{
-#ifdef _WIN32
RetrieveLastError();
-#else
- err = dlerror();
-#endif
}
}
initfn.vptr = dlsym(h, MODULE_INIT_STR);
if (!initfn.vptr)
{
-#ifdef _WIN32
RetrieveLastError();
-#else
- err = dlerror();
-#endif
return NULL;
}
return "Unversioned module";
}
-#ifdef _WIN32
void DLLManager::RetrieveLastError()
{
+#if defined _WIN32
char errmsg[500];
DWORD dwErrorCode = GetLastError();
if (FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, dwErrorCode, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPSTR)errmsg, _countof(errmsg), NULL) == 0)
sprintf_s(errmsg, _countof(errmsg), "Error code: %u", dwErrorCode);
SetLastError(ERROR_SUCCESS);
err = errmsg;
+#else
+ char* errmsg = dlerror();
+ err = errmsg ? errmsg : "Unknown error";
+#endif
std::string::size_type p;
while ((p = err.find_last_of("\r\n")) != std::string::npos)
err.erase(p, 1);
}
-#endif
(**i).already_sent = 0;
(**i).RemoveExpiredInvites();
}
+
+ // HACK: ELines are not expired properly at the moment but it can't be fixed as
+ // the 2.0 XLine system is a spaghetti nightmare. Instead we skip over expired
+ // ELines in XLineManager::CheckELines() and expire them here instead.
+ ServerInstance->XLines->GetAll("E");
}
void InspIRCd::SetSignals()
std::string ConfigReader::ReadValue(const std::string &tag, const std::string &name, const std::string &default_value, int index, bool allow_linefeeds)
{
std::string result = default_value;
- if (!SlowGetTag(tag, index)->readString(name, result, allow_linefeeds))
+ ConfigTag* conftag = SlowGetTag(tag, index);
+ if (!conftag || !conftag->readString(name, result, allow_linefeeds))
{
this->error = CONF_VALUE_NOT_FOUND;
}
bool ConfigReader::ReadFlag(const std::string &tag, const std::string &name, const std::string &default_value, int index)
{
bool def = (default_value == "yes");
- return SlowGetTag(tag, index)->getBool(name, def);
+ ConfigTag* conftag = SlowGetTag(tag, index);
+ return conftag ? conftag->getBool(name, def) : def;
}
bool ConfigReader::ReadFlag(const std::string &tag, const std::string &name, int index)
int ConfigReader::ReadInteger(const std::string &tag, const std::string &name, const std::string &default_value, int index, bool need_positive)
{
int v = atoi(default_value.c_str());
- int result = SlowGetTag(tag, index)->getInt(name, v);
+ ConfigTag* conftag = SlowGetTag(tag, index);
+ int result = conftag ? conftag->getInt(name, v) : v;
if ((need_positive) && (result < 0))
{
For example, m_filter_pcre requires the PCRE libraries.
To compile any of these modules first ensure you have the required dependencies
-(read the online documentation at http://wiki.inspircd.org/) and then symlink
+(read the online documentation at https://wiki.inspircd.org/) and then symlink
the .cpp file from this directory into the parent directory (src/modules/).
Alternatively, use the command: ./configure --enable-extras=m_extra.cpp, which will
* if a module is ever put in a re-enterant state (stack corruption could occur, crashes, data
* corruption, and worse, so DONT think about it until the day comes when InspIRCd is 100%
* gauranteed threadsafe!)
- *
- * For a diagram of this system please see http://wiki.inspircd.org/Mysql2
*/
class SQLConnection;
{
if (target_type == TYPE_CHANNEL)
{
- if ((!IS_LOCAL(user)) || (text.length() < minlen))
+ if ((!IS_LOCAL(user)) || (text.length() < minlen) || (text == "\1ACTION\1") || (text == "\1ACTION"))
return MOD_RES_PASSTHRU;
Channel* c = (Channel*)dest;
}
else
{
- user->WriteNumeric(ERR_INVALIDCAPSUBCOMMAND, "%s %s :Invalid CAP subcommand", user->nick.c_str(), subcommand.c_str());
+ user->WriteNumeric(ERR_INVALIDCAPSUBCOMMAND, "%s %s :Invalid CAP subcommand", user->nick.c_str(), subcommand.empty() ? "*" : subcommand.c_str());
return CMD_FAILURE;
}
realhost.set(user, user->host);
realip.set(user, user->GetIPString());
- bool host_ok = (parameters[2].length() < 64);
+ bool host_ok = (parameters[2].length() < 64) && (parameters[2].find_first_not_of("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ.-") == std::string::npos);
const std::string& newhost = (host_ok ? parameters[2] : parameters[3]);
if (notify)
if ((target_type == TYPE_CHANNEL) && (IS_LOCAL(user)))
{
Channel* c = (Channel*)dest;
- if ((text.empty()) || (text[0] != '\001') || (!strncmp(text.c_str(),"\1ACTION ",8)))
+ if ((text.empty()) || (text[0] != '\001') || (!strncmp(text.c_str(),"\1ACTION ", 8)) || (text == "\1ACTION\1") || (text == "\1ACTION"))
return MOD_RES_PASSTHRU;
ModResult res = ServerInstance->OnCheckExemption(user,c,"noctcp");
params.push_back(host);
params.push_back(ip);
+ LocalUser* lu = IS_LOCAL(user);
+ if (lu)
+ {
+ // NOTE: SaslAuthenticator instances are only created for local
+ // users so this parameter will always be appended.
+ SocketCertificateRequest req(&lu->eh, ServerInstance->Modules->Find("m_sasl.so"));
+ params.push_back(req.cert ? "S" : "P");
+ }
+
SendSASL(params);
}
* If you completely change the protocol, completely change the number.
*
* IMPORTANT: If you make changes, document your changes here, without fail:
- * http://wiki.inspircd.org/List_of_protocol_changes_between_versions
+ * https://wiki.inspircd.org/List_of_protocol_changes_between_versions
*
* Failure to document your protocol changes will result in a painfully
* painful death by pain. You have been warned.
// If halfop is loaded, send notice to halfops and above, otherwise send to ops and above
ModeHandler* mh = ServerInstance->Modes->FindMode('h', MODETYPE_CHANNEL);
- char pfxchar = (mh && mh->name == "halfop") ? '%' : '@';
+ char pfxchar = (mh && mh->name == "halfop") ? mh->GetPrefix() : '@';
channel->WriteAllExcept(ServerInstance->FakeClient, true, pfxchar, tmp, "NOTICE %s :%s added a timed ban on %s lasting for %ld seconds.", channel->name.c_str(), user->nick.c_str(), mask.c_str(), duration);
return CMD_SUCCESS;
void User::SetClientIP(const irc::sockets::sockaddrs& sa, bool recheck_eline)
{
- cachedip.clear();
- cached_hostip.clear();
+ this->InvalidateCache();
memcpy(&client_sa, &sa, sizeof(irc::sockets::sockaddrs));
}
for (LocalUserList::const_iterator u2 = ServerInstance->Users->local_users.begin(); u2 != ServerInstance->Users->local_users.end(); u2++)
{
User* u = (User*)(*u2);
+ u->exempt = false;
/* This uses safe iteration to ensure that if a line expires here, it doenst trash the iterator */
LookupIter safei;
safei++;
XLine *e = i->second;
- u->exempt = e->Matches(u);
+ if ((!e->duration || ServerInstance->Time() < e->expiry) && e->Matches(u))
+ u->exempt = true;
i = safei;
}
void ELine::Unset()
{
- /* remove exempt from everyone and force recheck after deleting eline */
- for (LocalUserList::const_iterator u2 = ServerInstance->Users->local_users.begin(); u2 != ServerInstance->Users->local_users.end(); u2++)
- {
- User* u = (User*)(*u2);
- u->exempt = false;
- }
-
ServerInstance->XLines->CheckELines();
}