diff options
author | danieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7> | 2009-10-25 15:21:45 +0000 |
---|---|---|
committer | danieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7> | 2009-10-25 15:21:45 +0000 |
commit | 6fe52cbb3ba72a5ecdded3f51c8515bf75e6801f (patch) | |
tree | 19b755377e2d830c78346930b8df27bca7d522f6 /src/modules | |
parent | 5d73e8928826340aaca9e78205ffb093a6b4f95c (diff) |
Fixes found by removing User inheritance from StreamSocket
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11975 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules')
-rw-r--r-- | src/modules/extra/m_ssl_gnutls.cpp | 16 | ||||
-rw-r--r-- | src/modules/extra/m_ssl_openssl.cpp | 15 | ||||
-rw-r--r-- | src/modules/m_cgiirc.cpp | 4 | ||||
-rw-r--r-- | src/modules/m_spanningtree/main.cpp | 4 | ||||
-rw-r--r-- | src/modules/m_spanningtree/override_whois.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_testnet.cpp | 4 | ||||
-rw-r--r-- | src/modules/ssl.h | 6 |
7 files changed, 23 insertions, 28 deletions
diff --git a/src/modules/extra/m_ssl_gnutls.cpp b/src/modules/extra/m_ssl_gnutls.cpp index 25b47c2fe..95beff3aa 100644 --- a/src/modules/extra/m_ssl_gnutls.cpp +++ b/src/modules/extra/m_ssl_gnutls.cpp @@ -86,15 +86,15 @@ public: issl_status status; }; -class CommandStartTLS : public Command +class CommandStartTLS : public SplitCommand { public: - CommandStartTLS (Module* mod) : Command(mod, "STARTTLS") + CommandStartTLS (Module* mod) : SplitCommand(mod, "STARTTLS") { works_before_reg = true; } - CmdResult Handle (const std::vector<std::string> ¶meters, User *user) + CmdResult HandleLocal(const std::vector<std::string> ¶meters, LocalUser *user) { /* changed from == REG_ALL to catch clients sending STARTTLS * after NICK and USER but before OnUserConnect completes and @@ -158,7 +158,7 @@ class ModuleSSLGnuTLS : public Module // Void return, guess we assume success gnutls_certificate_set_dh_params(x509_cred, dh_params); - Implementation eventlist[] = { I_On005Numeric, I_OnRehash, I_OnModuleRehash, I_OnPostConnect, + Implementation eventlist[] = { I_On005Numeric, I_OnRehash, I_OnModuleRehash, I_OnUserConnect, I_OnEvent, I_OnHookIO }; ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); @@ -296,9 +296,9 @@ class ModuleSSLGnuTLS : public Module { if(target_type == TYPE_USER) { - User* user = static_cast<User*>(item); + LocalUser* user = IS_LOCAL(static_cast<User*>(item)); - if (user->GetIOHook() == this) + if (user && user->GetIOHook() == this) { // User is using SSL, they're a local user, and they're using one of *our* SSL ports. // Potentially there could be multiple SSL modules loaded at once on different ports. @@ -547,10 +547,8 @@ class ModuleSSLGnuTLS : public Module } } - void OnPostConnect(User* user) + void OnUserConnect(LocalUser* user) { - // This occurs AFTER OnUserConnect so we can be sure the - // protocol module has propagated the NICK message. if (user->GetIOHook() == this) { if (sessions[user->GetFd()].sess) diff --git a/src/modules/extra/m_ssl_openssl.cpp b/src/modules/extra/m_ssl_openssl.cpp index 25d1cd9dd..61b54eceb 100644 --- a/src/modules/extra/m_ssl_openssl.cpp +++ b/src/modules/extra/m_ssl_openssl.cpp @@ -125,9 +125,7 @@ class ModuleSSLOpenSSL : public Module // Needs the flag as it ignores a plain /rehash OnModuleRehash(NULL,"ssl"); - Implementation eventlist[] = { - I_On005Numeric, I_OnRehash, I_OnModuleRehash, I_OnPostConnect, - I_OnHookIO }; + Implementation eventlist[] = { I_On005Numeric, I_OnRehash, I_OnModuleRehash, I_OnHookIO }; ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); } @@ -250,9 +248,9 @@ class ModuleSSLOpenSSL : public Module { if (target_type == TYPE_USER) { - User* user = (User*)item; + LocalUser* user = IS_LOCAL((User*)item); - if (user->GetIOHook() == this) + if (user && user->GetIOHook() == this) { // User is using SSL, they're a local user, and they're using one of *our* SSL ports. // Potentially there could be multiple SSL modules loaded at once on different ports. @@ -597,13 +595,6 @@ class ModuleSSLOpenSSL : public Module X509_free(cert); SSLCertSubmission(user, this, sslinfo, certinfo); } - - void Prioritize() - { - Module* server = ServerInstance->Modules->Find("m_spanningtree.so"); - ServerInstance->Modules->SetPriority(this, I_OnPostConnect, PRIORITY_AFTER, &server); - } - }; static int error_callback(const char *str, size_t len, void *u) diff --git a/src/modules/m_cgiirc.cpp b/src/modules/m_cgiirc.cpp index 5f8cfeca7..49a96c42d 100644 --- a/src/modules/m_cgiirc.cpp +++ b/src/modules/m_cgiirc.cpp @@ -103,10 +103,10 @@ class CGIResolver : public Resolver { std::string typ; int theirfd; - User* them; + LocalUser* them; bool notify; public: - CGIResolver(Module* me, bool NotifyOpers, const std::string &source, bool forward, User* u, int userfd, const std::string &type, bool &cached) + CGIResolver(Module* me, bool NotifyOpers, const std::string &source, bool forward, LocalUser* u, int userfd, const std::string &type, bool &cached) : Resolver(source, forward ? DNS_QUERY_A : DNS_QUERY_PTR4, cached, me), typ(type), theirfd(userfd), them(u), notify(NotifyOpers) { } virtual void OnLookupComplete(const std::string &result, unsigned int ttl, bool cached) diff --git a/src/modules/m_spanningtree/main.cpp b/src/modules/m_spanningtree/main.cpp index d14f0ebe4..8da34af53 100644 --- a/src/modules/m_spanningtree/main.cpp +++ b/src/modules/m_spanningtree/main.cpp @@ -490,7 +490,7 @@ void ModuleSpanningTree::OnUserNotice(User* user, void* dest, int target_type, c if (target_type == TYPE_USER) { User* d = (User*)dest; - if ((d->GetFd() < 0) && (IS_LOCAL(user))) + if (!IS_LOCAL(d) && IS_LOCAL(user)) { parameterlist params; params.push_back(d->uuid); @@ -543,7 +543,7 @@ void ModuleSpanningTree::OnUserMessage(User* user, void* dest, int target_type, // route private messages which are targetted at clients only to the server // which needs to receive them User* d = (User*)dest; - if ((d->GetFd() < 0) && (IS_LOCAL(user))) + if (!IS_LOCAL(d) && (IS_LOCAL(user))) { parameterlist params; params.push_back(d->uuid); diff --git a/src/modules/m_spanningtree/override_whois.cpp b/src/modules/m_spanningtree/override_whois.cpp index ee3be53fd..db75973d1 100644 --- a/src/modules/m_spanningtree/override_whois.cpp +++ b/src/modules/m_spanningtree/override_whois.cpp @@ -29,7 +29,7 @@ ModResult ModuleSpanningTree::HandleRemoteWhois(const std::vector<std::string>& if ((IS_LOCAL(user)) && (parameters.size() > 1)) { User* remote = ServerInstance->FindNick(parameters[1]); - if ((remote) && (remote->GetFd() < 0)) + if (remote && !IS_LOCAL(remote)) { parameterlist params; params.push_back(remote->uuid); diff --git a/src/modules/m_testnet.cpp b/src/modules/m_testnet.cpp index 7f825a728..e467923c9 100644 --- a/src/modules/m_testnet.cpp +++ b/src/modules/m_testnet.cpp @@ -36,10 +36,10 @@ class CommandTest : public Command { IS_LOCAL(user)->Penalty += 100; } - else if (parameters[0] == "shutdown") + else if (parameters[0] == "shutdown" && IS_LOCAL(user)) { int i = parameters.size() > 1 ? atoi(parameters[1].c_str()) : 2; - ServerInstance->SE->Shutdown(user->GetFd(), i); + ServerInstance->SE->Shutdown(IS_LOCAL(user)->GetFd(), i); } return CMD_SUCCESS; } diff --git a/src/modules/ssl.h b/src/modules/ssl.h index 39a7ef5f6..3bc78cf98 100644 --- a/src/modules/ssl.h +++ b/src/modules/ssl.h @@ -128,6 +128,12 @@ struct SSLCertificateRequest : public Request Send(); } + SSLCertificateRequest(Extensible* e, Module* Me, Module* info = ServerInstance->Modules->Find("m_sslinfo.so")) + : Request(Me, info, "GET_CERT"), item(e), cert(NULL) + { + Send(); + } + std::string GetFingerprint() { if (cert) |