summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/modules/extra/m_ssl_openssl.cpp16
-rw-r--r--src/modules/m_nationalchars.cpp28
-rw-r--r--src/modules/m_spanningtree/main.cpp6
-rw-r--r--src/modules/m_spanningtree/main.h1
-rw-r--r--src/modules/m_spanningtree/utils.cpp13
-rw-r--r--src/modules/m_spanningtree/utils.h5
6 files changed, 68 insertions, 1 deletions
diff --git a/src/modules/extra/m_ssl_openssl.cpp b/src/modules/extra/m_ssl_openssl.cpp
index 518712c00..e9b5c4052 100644
--- a/src/modules/extra/m_ssl_openssl.cpp
+++ b/src/modules/extra/m_ssl_openssl.cpp
@@ -113,6 +113,20 @@ class ModuleSSLOpenSSL : public Module
static void SetContextOptions(SSL_CTX* ctx, long defoptions, const std::string& ctxname, ConfigTag* tag)
{
long setoptions = tag->getInt(ctxname + "setoptions");
+ // User-friendly config options for setting context options
+#ifdef SSL_OP_CIPHER_SERVER_PREFERENCE
+ if (tag->getBool("cipherserverpref"))
+ setoptions |= SSL_OP_CIPHER_SERVER_PREFERENCE;
+#endif
+#ifdef SSL_OP_NO_COMPRESSION
+ if (!tag->getBool("compression", true))
+ setoptions |= SSL_OP_NO_COMPRESSION;
+#endif
+ if (!tag->getBool("sslv3", true))
+ setoptions |= SSL_OP_NO_SSLv3;
+ if (!tag->getBool("tlsv1", true))
+ setoptions |= SSL_OP_NO_TLSv1;
+
long clearoptions = tag->getInt(ctxname + "clearoptions");
ServerInstance->Logs->Log("m_ssl_openssl", DEBUG, "Setting OpenSSL %s context options, default: %ld set: %ld clear: %ld", ctxname.c_str(), defoptions, clearoptions, setoptions);
@@ -630,7 +644,7 @@ class ModuleSSLOpenSSL : public Module
else if (ret == 0)
{
CloseSession(session);
- return true;
+ return false;
}
return true;
diff --git a/src/modules/m_nationalchars.cpp b/src/modules/m_nationalchars.cpp
index b43b6e2b6..bf95f0f9f 100644
--- a/src/modules/m_nationalchars.cpp
+++ b/src/modules/m_nationalchars.cpp
@@ -228,11 +228,37 @@ class ModuleNationalChars : public Module
caller2<bool, const char*, size_t> rememberer;
bool forcequit;
const unsigned char * lowermap_rememberer;
+ unsigned char prev_map[256];
+
+ void CheckRehash()
+ {
+ // See if anything changed
+ if (!memcmp(prev_map, national_case_insensitive_map, sizeof(prev_map)))
+ return;
+
+ memcpy(prev_map, national_case_insensitive_map, sizeof(prev_map));
+
+ ServerInstance->RehashUsersAndChans();
+
+ // The OnGarbageCollect() method in m_watch rebuilds the hashmap used by it
+ Module* mod = ServerInstance->Modules->Find("m_watch.so");
+ if (mod)
+ mod->OnGarbageCollect();
+
+ // Send a Request to m_spanningtree asking it to rebuild its hashmaps
+ mod = ServerInstance->Modules->Find("m_spanningtree.so");
+ if (mod)
+ {
+ Request req(this, mod, "rehash");
+ req.Send();
+ }
+ }
public:
ModuleNationalChars()
: rememberer(ServerInstance->IsNick), lowermap_rememberer(national_case_insensitive_map)
{
+ memcpy(prev_map, national_case_insensitive_map, sizeof(prev_map));
}
void init()
@@ -265,6 +291,7 @@ class ModuleNationalChars : public Module
loadtables(charset, tables, 8, 5);
forcequit = tag->getBool("forcequit");
CheckForceQuit("National character set changed");
+ CheckRehash();
}
void CheckForceQuit(const char * message)
@@ -286,6 +313,7 @@ class ModuleNationalChars : public Module
ServerInstance->IsNick = rememberer;
national_case_insensitive_map = lowermap_rememberer;
CheckForceQuit("National characters module unloaded");
+ CheckRehash();
}
virtual Version GetVersion()
diff --git a/src/modules/m_spanningtree/main.cpp b/src/modules/m_spanningtree/main.cpp
index e7ff3789b..5f06cad58 100644
--- a/src/modules/m_spanningtree/main.cpp
+++ b/src/modules/m_spanningtree/main.cpp
@@ -930,6 +930,12 @@ ModResult ModuleSpanningTree::OnSetAway(User* user, const std::string &awaymsg)
return MOD_RES_PASSTHRU;
}
+void ModuleSpanningTree::OnRequest(Request& request)
+{
+ if (!strcmp(request.id, "rehash"))
+ Utils->Rehash();
+}
+
void ModuleSpanningTree::ProtoSendMode(void* opaque, TargetTypeFlags target_type, void* target, const parameterlist &modeline, const std::vector<TranslateType> &translate)
{
TreeSocket* s = (TreeSocket*)opaque;
diff --git a/src/modules/m_spanningtree/main.h b/src/modules/m_spanningtree/main.h
index eb17c4195..17adc9287 100644
--- a/src/modules/m_spanningtree/main.h
+++ b/src/modules/m_spanningtree/main.h
@@ -178,6 +178,7 @@ class ModuleSpanningTree : public Module
void OnLoadModule(Module* mod);
void OnUnloadModule(Module* mod);
ModResult OnAcceptConnection(int newsock, ListenSocket* from, irc::sockets::sockaddrs* client, irc::sockets::sockaddrs* server);
+ void OnRequest(Request& request);
CullResult cull();
~ModuleSpanningTree();
Version GetVersion();
diff --git a/src/modules/m_spanningtree/utils.cpp b/src/modules/m_spanningtree/utils.cpp
index 3bd0aa2c7..367a3b921 100644
--- a/src/modules/m_spanningtree/utils.cpp
+++ b/src/modules/m_spanningtree/utils.cpp
@@ -428,3 +428,16 @@ Link* SpanningTreeUtilities::FindLink(const std::string& name)
}
return NULL;
}
+
+void SpanningTreeUtilities::Rehash()
+{
+ server_hash temp;
+ for (server_hash::const_iterator i = serverlist.begin(); i != serverlist.end(); ++i)
+ temp.insert(std::make_pair(i->first, i->second));
+ serverlist.swap(temp);
+ temp.clear();
+
+ for (server_hash::const_iterator i = sidlist.begin(); i != sidlist.end(); ++i)
+ temp.insert(std::make_pair(i->first, i->second));
+ sidlist.swap(temp);
+}
diff --git a/src/modules/m_spanningtree/utils.h b/src/modules/m_spanningtree/utils.h
index a0543b6bd..5559b3459 100644
--- a/src/modules/m_spanningtree/utils.h
+++ b/src/modules/m_spanningtree/utils.h
@@ -173,6 +173,11 @@ class SpanningTreeUtilities : public classbase
/** Refresh the IP cache used for allowing inbound connections
*/
void RefreshIPCache();
+
+ /** Recreate serverlist and sidlist, this is needed because of m_nationalchars changing
+ * national_case_insensitive_map which is used by the hash function
+ */
+ void Rehash();
};
#endif