diff options
-rw-r--r-- | src/coremods/core_user/cmd_nick.cpp | 3 | ||||
-rw-r--r-- | src/helperfuncs.cpp | 2 | ||||
-rw-r--r-- | src/modules/extra/m_ssl_openssl.cpp | 24 | ||||
-rw-r--r-- | src/modules/m_chanhistory.cpp | 7 | ||||
-rw-r--r-- | src/modules/m_filter.cpp | 1 | ||||
-rw-r--r-- | src/modules/m_nonicks.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_spanningtree/netburst.cpp | 3 | ||||
-rw-r--r-- | src/modules/m_spanningtree/override_map.cpp | 8 | ||||
-rw-r--r-- | src/modules/m_spanningtree/sinfo.cpp | 4 | ||||
-rw-r--r-- | src/modules/m_spanningtree/treeserver.cpp | 1 | ||||
-rw-r--r-- | src/modules/m_spanningtree/treeserver.h | 9 |
11 files changed, 53 insertions, 11 deletions
diff --git a/src/coremods/core_user/cmd_nick.cpp b/src/coremods/core_user/cmd_nick.cpp index cedafbbf4..672155741 100644 --- a/src/coremods/core_user/cmd_nick.cpp +++ b/src/coremods/core_user/cmd_nick.cpp @@ -77,7 +77,8 @@ CmdResult CommandNick::HandleLocal(const std::vector<std::string>& parameters, L Channel* chan = (*i)->chan; if (chan->GetPrefixValue(user) < VOICE_VALUE && chan->IsBanned(user)) { - user->WriteNumeric(ERR_CANNOTSENDTOCHAN, chan->name, "Cannot send to channel (you're banned)"); + user->WriteNumeric(ERR_CANTCHANGENICK, InspIRCd::Format("Cannot change nickname while on %s (you're banned)", + chan->name.c_str())); return CMD_FAILURE; } } diff --git a/src/helperfuncs.cpp b/src/helperfuncs.cpp index b80a3897c..c29e7d2cc 100644 --- a/src/helperfuncs.cpp +++ b/src/helperfuncs.cpp @@ -101,7 +101,7 @@ bool InspIRCd::IsValidMask(const std::string &mask) if (exclamation != 1 || atsign != 1) return false; - if (mask.length() > 250) + if (mask.length() > ServerInstance->Config->Limits.GetMaxMask()) return false; return true; diff --git a/src/modules/extra/m_ssl_openssl.cpp b/src/modules/extra/m_ssl_openssl.cpp index 40861b1f8..2129e5da7 100644 --- a/src/modules/extra/m_ssl_openssl.cpp +++ b/src/modules/extra/m_ssl_openssl.cpp @@ -48,17 +48,32 @@ #include <openssl/ssl.h> #include <openssl/err.h> +#include <openssl/dh.h> #ifdef _WIN32 # pragma comment(lib, "ssleay32.lib") # pragma comment(lib, "libeay32.lib") #endif -// BIO is opaque in OpenSSL 1.1 but the access API does not exist in 1.0 and older. +// Compatibility layer to allow OpenSSL 1.0 to use the 1.1 API. #if ((defined LIBRESSL_VERSION_NUMBER) || (OPENSSL_VERSION_NUMBER < 0x10100000L)) + +// BIO is opaque in OpenSSL 1.1 but the access API does not exist in 1.0. # define BIO_get_data(BIO) BIO->ptr # define BIO_set_data(BIO, VALUE) BIO->ptr = VALUE; # define BIO_set_init(BIO, VALUE) BIO->init = VALUE; + +// These functions have been renamed in OpenSSL 1.1. +# define OpenSSL_version SSLeay_version +# define X509_getm_notAfter X509_get_notAfter +# define X509_getm_notBefore X509_get_notBefore +# define OPENSSL_init_ssl(OPTIONS, SETTINGS) \ + SSL_library_init(); \ + SSL_load_error_strings(); + +// These macros have been renamed in OpenSSL 1.1. +# define OPENSSL_VERSION SSLEAY_VERSION + #else # define INSPIRCD_OPENSSL_OPAQUE_BIO #endif @@ -606,7 +621,7 @@ class OpenSSLIOHook : public SSLIOHook certinfo->fingerprint = BinToHex(md, n); } - if ((ASN1_UTCTIME_cmp_time_t(X509_get_notAfter(cert), ServerInstance->Time()) == -1) || (ASN1_UTCTIME_cmp_time_t(X509_get_notBefore(cert), ServerInstance->Time()) == 0)) + if ((ASN1_UTCTIME_cmp_time_t(X509_getm_notAfter(cert), ServerInstance->Time()) == -1) || (ASN1_UTCTIME_cmp_time_t(X509_getm_notBefore(cert), ServerInstance->Time()) == 0)) { certinfo->error = "Not activated, or expired certificate"; } @@ -984,8 +999,7 @@ class ModuleSSLOpenSSL : public Module ModuleSSLOpenSSL() { // Initialize OpenSSL - SSL_library_init(); - SSL_load_error_strings(); + OPENSSL_init_ssl(0, NULL); #ifdef INSPIRCD_OPENSSL_OPAQUE_BIO biomethods = OpenSSL::BIOMethod::alloc(); } @@ -998,7 +1012,7 @@ class ModuleSSLOpenSSL : public Module void init() CXX11_OVERRIDE { - ServerInstance->Logs->Log(MODNAME, LOG_DEFAULT, "OpenSSL lib version \"%s\" module was compiled for \"" OPENSSL_VERSION_TEXT "\"", SSLeay_version(SSLEAY_VERSION)); + ServerInstance->Logs->Log(MODNAME, LOG_DEFAULT, "OpenSSL lib version \"%s\" module was compiled for \"" OPENSSL_VERSION_TEXT "\"", OpenSSL_version(OPENSSL_VERSION)); // Register application specific data char exdatastr[] = "inspircd"; diff --git a/src/modules/m_chanhistory.cpp b/src/modules/m_chanhistory.cpp index 4ed1ae6ae..c51e6337e 100644 --- a/src/modules/m_chanhistory.cpp +++ b/src/modules/m_chanhistory.cpp @@ -71,7 +71,7 @@ class HistoryMode : public ParamMode<HistoryMode, SimpleExtItem<HistoryList> > unsigned int len = ConvToInt(parameter.substr(0, colon)); unsigned int time = InspIRCd::Duration(duration); - if (len == 0 || time == 0) + if (len == 0) return MODEACTION_DENY; if (len > maxlines && IS_LOCAL(source)) return MODEACTION_DENY; @@ -154,7 +154,10 @@ class ModuleChanHistory : public Module if (sendnotice) { - memb->user->WriteNotice("Replaying up to " + ConvToStr(list->maxlen) + " lines of pre-join history spanning up to " + ConvToStr(list->maxtime) + " seconds"); + std::string message("Replaying up to " + ConvToStr(list->maxlen) + " lines of pre-join history"); + if (list->maxtime > 0) + message.append(" spanning up to " + ConvToStr(list->maxtime) + " seconds"); + memb->user->WriteNotice(message); } for(std::deque<HistoryItem>::iterator i = list->lines.begin(); i != list->lines.end(); ++i) diff --git a/src/modules/m_filter.cpp b/src/modules/m_filter.cpp index adf3afe69..a672bc9f6 100644 --- a/src/modules/m_filter.cpp +++ b/src/modules/m_filter.cpp @@ -440,6 +440,7 @@ ModResult ModuleFilter::OnPreCommand(std::string &command, std::vector<std::stri { /* Note: We gline *@IP so that if their host doesnt resolve the gline still applies. */ GLine* gl = new GLine(ServerInstance->Time(), f->gline_time, ServerInstance->Config->ServerName.c_str(), f->reason.c_str(), "*", user->GetIPString()); + ServerInstance->SNO->WriteGlobalSno('a', "FILTER: " + user->nick + " had their " + command + " message filtered and was G-Lined: " + f->reason); if (ServerInstance->XLines->AddLine(gl,NULL)) { ServerInstance->XLines->ApplyLines(); diff --git a/src/modules/m_nonicks.cpp b/src/modules/m_nonicks.cpp index fbf772e0c..c82107be8 100644 --- a/src/modules/m_nonicks.cpp +++ b/src/modules/m_nonicks.cpp @@ -60,7 +60,7 @@ class ModuleNoNickChange : public Module if (!curr->GetExtBanStatus(user, 'N').check(!curr->IsModeSet(nn))) { - user->WriteNumeric(ERR_CANTCHANGENICK, InspIRCd::Format("Can't change nickname while on %s (+N is set)", + user->WriteNumeric(ERR_CANTCHANGENICK, InspIRCd::Format("Cannot change nickname while on %s (+N is set)", curr->name.c_str())); return MOD_RES_DENY; } diff --git a/src/modules/m_spanningtree/netburst.cpp b/src/modules/m_spanningtree/netburst.cpp index 5115c7aa8..30a37baee 100644 --- a/src/modules/m_spanningtree/netburst.cpp +++ b/src/modules/m_spanningtree/netburst.cpp @@ -137,6 +137,9 @@ void TreeSocket::SendServerInfo(TreeServer* from) // Send full version string that contains more information and is shown to opers this->WriteLine(CommandSInfo::Builder(from, "fullversion", from->GetFullVersion())); + + // Send the raw version string that just contains the base info + this->WriteLine(CommandSInfo::Builder(from, "rawversion", from->GetRawVersion())); } /** Recursively send the server tree. diff --git a/src/modules/m_spanningtree/override_map.cpp b/src/modules/m_spanningtree/override_map.cpp index a22fa48ac..d1a00ed84 100644 --- a/src/modules/m_spanningtree/override_map.cpp +++ b/src/modules/m_spanningtree/override_map.cpp @@ -76,7 +76,13 @@ static std::vector<std::string> GetMap(User* user, TreeServer* current, unsigned std::string buffer = current->GetName(); if (user->IsOper()) { - buffer += " (" + current->GetID() + ")"; + buffer += " (" + current->GetID(); + + const std::string& cur_vers = current->GetRawVersion(); + if (!cur_vers.empty()) + buffer += " " + cur_vers; + + buffer += ")"; } // Pad with spaces until its at max len, max_len must always be >= my names length diff --git a/src/modules/m_spanningtree/sinfo.cpp b/src/modules/m_spanningtree/sinfo.cpp index 0989ea9a5..7f175bafb 100644 --- a/src/modules/m_spanningtree/sinfo.cpp +++ b/src/modules/m_spanningtree/sinfo.cpp @@ -34,6 +34,10 @@ CmdResult CommandSInfo::HandleServer(TreeServer* server, std::vector<std::string { server->SetVersion(value); } + else if (key == "rawversion") + { + server->SetRawVersion(value); + } else if (key == "desc") { // Only sent when the description of a server changes because of a rehash; not sent on burst diff --git a/src/modules/m_spanningtree/treeserver.cpp b/src/modules/m_spanningtree/treeserver.cpp index be8660e42..ca7959ea7 100644 --- a/src/modules/m_spanningtree/treeserver.cpp +++ b/src/modules/m_spanningtree/treeserver.cpp @@ -37,6 +37,7 @@ TreeServer::TreeServer() , Parent(NULL), Route(NULL) , VersionString(ServerInstance->GetVersionString()) , fullversion(ServerInstance->GetVersionString(true)) + , rawversion(INSPIRCD_VERSION) , Socket(NULL), sid(ServerInstance->Config->GetSID()), behind_bursting(0), isdead(false) , pingtimer(this) , ServerUser(ServerInstance->FakeClient) diff --git a/src/modules/m_spanningtree/treeserver.h b/src/modules/m_spanningtree/treeserver.h index f75adf54c..037edd194 100644 --- a/src/modules/m_spanningtree/treeserver.h +++ b/src/modules/m_spanningtree/treeserver.h @@ -48,6 +48,7 @@ class TreeServer : public Server /** Full version string including patch version and other info */ std::string fullversion; + std::string rawversion; TreeSocket* Socket; /* Socket used to communicate with this server */ std::string sid; /* Server ID */ @@ -144,6 +145,10 @@ class TreeServer : public Server */ const std::string& GetFullVersion() const { return fullversion; } + /** Get the raw version string of this server + */ + const std::string& GetRawVersion() const { return rawversion; } + /** Round trip time of last ping */ unsigned long rtt; @@ -175,6 +180,10 @@ class TreeServer : public Server */ void SetFullVersion(const std::string& verstr) { fullversion = verstr; } + /** Set the raw version string + */ + void SetRawVersion(const std::string& verstr) { rawversion = verstr; } + /** Sets the description of this server. Called when the description of a remote server changes * and we are notified about it. * @param descstr The description to set |